Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
4a7e25f4
Commit
4a7e25f4
authored
Jun 24, 2012
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#444582: fix example and rewrap docs a bit.
parent
4168764c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
13 deletions
+14
-13
Doc/library/shutil.rst
Doc/library/shutil.rst
+14
-13
No files found.
Doc/library/shutil.rst
View file @
4a7e25f4
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment