diff options
author | Georg Brandl <georg@python.org> | 2012-06-24 15:37:07 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2012-06-24 15:37:07 (GMT) |
commit | 4a7e25f4df31cf73e4cc28119744b5c2c82a54ab (patch) | |
tree | e4251e8fcfcc7ae9c29d8bead2737c5db3ea81a0 /Doc | |
parent | 4168764c1a849877ecae45ededfe28d1f371db62 (diff) | |
download | cpython-4a7e25f4df31cf73e4cc28119744b5c2c82a54ab.zip cpython-4a7e25f4df31cf73e4cc28119744b5c2c82a54ab.tar.gz cpython-4a7e25f4df31cf73e4cc28119744b5c2c82a54ab.tar.bz2 |
#444582: fix example and rewrap docs a bit.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/shutil.rst | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst index 7526e5e..aeaf62c 100644 --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -268,31 +268,32 @@ Directory and files operations .. versionadded:: 3.3 + .. function:: which(cmd, mode=os.F_OK | os.X_OK, path=None) - Return the path to an executable which would be run if the given *cmd* - was called. If no *cmd* would be called, return ``None``. + Return the path to an executable which would be run if the given *cmd* was + called. If no *cmd* would be called, return ``None``. *mode* is a permission mask passed a to :func:`os.access`, by default determining if the file exists and executable. - When no *path* is specified, the results of :func:`os.environ` are - used, returning either the "PATH" value or a fallback of :attr:`os.defpath`. + When no *path* is specified, the results of :func:`os.environ` are used, + returning either the "PATH" value or a fallback of :attr:`os.defpath`. - On Windows, the current directory is always prepended to the *path* - whether or not you use the default or provide your own, which - is the behavior the command shell uses when finding executables. - Additionaly, when finding the *cmd* in the *path*, the - ``PATHEXT`` environment variable is checked. 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. + On Windows, the current directory is always prepended to the *path* whether + or not you use the default or provide your own, which is the behavior the + command shell uses when finding executables. Additionaly, when finding the + *cmd* in the *path*, the ``PATHEXT`` environment variable is checked. 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:: - >>> print(shutil.which("python")) + >>> shutil.which("python") 'c:\\python33\\python.exe' .. versionadded:: 3.3 + .. exception:: Error This exception collects exceptions that are raised during a multi-file |