Message378992
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. |
|
Date |
User |
Action |
Args |
2020-10-19 19:16:59 | steve.dower | set | recipients:
+ steve.dower, paul.moore, vinay.sajip, tim.golden, docs@python, zach.ware, eryksun, gaborjbernat, keller00 |
2020-10-19 19:16:59 | steve.dower | set | messageid: <1603135019.19.0.997571590865.issue42041@roundup.psfhosted.org> |
2020-10-19 19:16:59 | steve.dower | link | issue42041 messages |
2020-10-19 19:16:59 | steve.dower | create | |
|