Skip to main content

launch

This function launches the given URL (or filename) in the default viewer application for this file type. If this is an executable, it might launch the executable in a new session. The return value is the exit code of the launched application. Usually, 0 indicates success.

def launch(
url: str,
wait: bool = False,
locate: bool = False
) - > int

This function launches the given URL (or filename) in the default viewer application for this file type. If this is an executable, it might launch the executable in a new session. The return value is the exit code of the launched application. Usually, 0 indicates success.

Parameters

NameTypeDescription
urlstrURL or filename of the thing to launch.
waitbool = FalseWait for the program to exit before returning. This only works if the launched program blocks. In particular, xdg-open on Linux does not block.
locatebool = FalseIf this is set to True, then instead of launching the application associated with the URL, it will attempt to launch a file manager with the file located. This might have weird effects if the URL does not point to the filesystem.

Returns

TypeDescription
intThe exit code of the launched application, where 0 typically indicates success.