[docs] [issue33119] python sys.argv argument parsing not clear

Nick Coghlan report at bugs.python.org
Sat Mar 24 00:25:00 EDT 2018

Nick Coghlan <ncoghlan at gmail.com> added the comment:

This is deliberate, and is covered in the documentation at https://docs.python.org/3/using/cmdline.html#cmdoption-m where it says 'If this option is given, the first element of sys.argv will be the full path to the module file (while the module file is being located, the first element will be set to "-m").'

The part in parentheses is the bit that's applicable here.

We've not going to change that, as the interpreter startup relies on checking sys.argv[0] for "-m" and "-c" in order to work out how it's expected to handle sys.path initialization.

resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

Python tracker <report at bugs.python.org>

More information about the docs mailing list