[issue33119] python sys.argv argument parsing not clear

2018-03-23 Thread Nick Coghlan
Nick Coghlan 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 lo

[issue33119] python sys.argv argument parsing not clear

2018-03-23 Thread Terry J. Reedy
Terry J. Reedy added the comment: Two of your 3 suggested alternatives could lead to bugs. To use your example: python -m mainmodule.submodule.foobar -o -b is a convenient alternative and abbreviation for python .../somedir/mainmodule/submodule/foobar.py -o -b The two invocations should give e

[issue33119] python sys.argv argument parsing not clear

2018-03-22 Thread Brett Cannon
Change by Brett Cannon : -- nosy: +ncoghlan ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pytho

[issue33119] python sys.argv argument parsing not clear

2018-03-22 Thread Jonathan Huot
New submission from Jonathan Huot : Executing python modules with -m can lead to weird sys.argv parsing. "Argument parsing" section at https://docs.python.org/3.8/tutorial/interpreter.html#argument-passing mention : - When -m module is used, sys.argv[0] is set to the full name of the located