You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Display the invoked executable name when displaying help #91818
Display the invoked executable name such as python3 or python.exe so users can copy and paste without having to translate, for tools such as ast and json.tool.
Pitch
The example below shows a before usage of json.tool and an after below.
This is more friendly to users on windows because of the .exe extension and to *nix users who's OS might install python 3 at python3 and have an old python2 version somewhere else. Or as we move into the future and some OS drop python2 but never rectify python point to python3.
Activity
hugovk commentedon Apr 22, 2022
This could be done something like this:
Or (less helpfully?) without the full path:
pip does something along these lines:
https://github.com/pypa/pip/blob/c247ddce123513198858d4589c5ee198dcc6ba40/src/pip/_internal/cli/main_parser.py#L21
https://github.com/pypa/pip/blob/c247ddce123513198858d4589c5ee198dcc6ba40/src/pip/_internal/utils/misc.py#L109-L118
scrummyin commentedon Apr 22, 2022
I did a little more than that with #91819 , partially to guarantee that something comes out when sys.executable might fail, since it can return
None.serhiy-storchaka commentedon Sep 28, 2024
The general issue is a duplicate of #66436.
Leaving this issue open as
json.toolsspecific issue.pythongh-91818: Use default program name in the CLI of many modules
gh-91818: Use default program name in the CLI of many modules (GH-124867