Skip to content

gh-132971: update shutil.which doc #133067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 10, 2025
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Doc/library/shutil.rst
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,12 @@ Directory and files operations
:envvar:`PATH` environment variable is read from :data:`os.environ`,
falling back to :data:`os.defpath` if it is not set.

.. note::

If *cmd* contains a directory component, :func:`!which` only checks the
specified path directly and does not search the directories listed in *path*
or in the system's :envvar:`PATH` environment variable.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's wrap this line so that it doesn't exceed the length of the line

Suggested change
specified path directly and does not search the directories listed in *path*
or in the system's :envvar:`PATH` environment variable.
specified path directly and does not search the directories listed in
*path* or in the system's :envvar:`PATH` environment variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I will follow that next time.Thank you.


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
Windows API ``NeedCurrentDirectoryForExePathW`` will be consulted to
Expand Down
Loading