Steve Dower <steve.do...@python.org> added the comment:
Proposed alternative based on Eryk's: For maximum reliability, use a fully-qualified path for the executable. To search for an unqualified name on :envvar:`PATH`, use :meth:`shutil.which`. On all platforms, passing :data:`sys.executable` is the recommended way to launch the current Python interpreter again, and use the ``-m`` command-line format to launch an installed module. Resolving the path of *executable* (or the first item of *args*) is platform dependent. For POSIX, see :meth:`os.execvpe`, and note that when resolving or searching for the executable path, *cwd* overrides the current working directory and *env* can override the ``PATH`` environment variable. For Windows, see the documentation of the ``lpApplicationName`` and ``lpCommandLine`` parameters of WinAPI ``CreateProcess``, and note that when resolving or searching for the executable path with ``shell=False``, *cwd* does not override the current working directory and *env* cannot override the ``PATH`` environment variable. Using a full path avoids all of these variations. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42041> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com