diff options
author | Tom Most <twm@freecog.net> | 2024-09-25 07:54:13 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-25 07:54:13 (GMT) |
commit | 0d38409f422b7be158a45e59766d8f4605dfa5df (patch) | |
tree | 4cde2eee109fb245fa653415101a2deeb4b881bd /Doc | |
parent | 54dd77fb8c880d7655fffab934978e277b4275fe (diff) | |
download | cpython-0d38409f422b7be158a45e59766d8f4605dfa5df.zip cpython-0d38409f422b7be158a45e59766d8f4605dfa5df.tar.gz cpython-0d38409f422b7be158a45e59766d8f4605dfa5df.tar.bz2 |
Doc: Improve documentation for the ``path`` argument in ``shutil.which()`` (#124494)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/shutil.rst | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst index e623c3d..d25701c 100644 --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -449,9 +449,10 @@ Directory and files operations *mode* is a permission mask passed to :func:`os.access`, by default determining if the file exists and is executable. - *path* is a "``PATH`` string" specifying the lookup directory list. When no - *path* is specified, the results of :func:`os.environ` are used, returning - either the "PATH" value or a fallback of :data:`os.defpath`. + *path* is a "``PATH`` string" specifying the directories to look in, + delimited by :data:`os.pathsep`. When no *path* is specified, the + :envvar:`PATH` environment variable is read from :data:`os.environ`, + falling back to :data:`os.defpath` if it is not set. On Windows, the current directory is prepended to the *path* if *mode* does not include ``os.X_OK``. When the *mode* does include ``os.X_OK``, the @@ -460,9 +461,9 @@ Directory and files operations consulting the current working directory for executables: set the environment variable ``NoDefaultCurrentDirectoryInExePath``. - Also on Windows, the ``PATHEXT`` variable is used to resolve commands - that may not already include an extension. For example, if you call - ``shutil.which("python")``, :func:`which` will search ``PATHEXT`` + Also on Windows, the :envvar:`PATHEXT` environment variable is used to + resolve commands that may not already include an extension. For example, + if you call ``shutil.which("python")``, :func:`which` will search ``PATHEXT`` to know that it should look for ``python.exe`` within the *path* directories. For example, on Windows:: |