open_with_app

emlib.misc.open_with_app(path, app=None, wait=False, shell=False, min_wait=0.5, timeout=None)[source]

Open a given file with a given app.

It can either wait on the app to exit or wait until the file was modified. The app can be either a command as a string or a list of string arguments passed to subprocess.Popen

Parameters:
  • path (str) – the path to the file to open

  • app (Union[str, list[str], None]) – a command-line string or a list of string arguments. If no app is given, we ask the os to open this file with its standard app

  • wait (bool | str) – if True, wait until the app stops. If the app is a daemon app (it returns immediately), this situation is detected and a dialog is created which needs to be clicked in order for the function to return. Alternatively, wait can be “modified”, in which case we wait until path has been modified; or “dialog”, where a confirmation dialog is open for the user to signal when the editing is done

  • shell – should app be started from a shell?

  • min_wait – if the application returns before this time a wait dialog is created

  • timeout – a timeout for wait_on_modified

Return type:

None