[Python-bugs-list] [Bug #116397] Python takes cmd line options after module name for itself
noreply@sourceforge.net
noreply@sourceforge.net
Mon, 9 Oct 2000 00:31:12 -0700
Bug #116397, was updated on 2000-Oct-09 00:31
Here is a current snapshot of the bug.
Project: Python
Category: Core
Status: Open
Resolution: None
Bug Group: None
Priority: 5
Summary: Python takes cmd line options after module name for itself
Details: Let the file foo.py be:
import sys
print sys.argv
Here is the behavior for version 1.6:
$ python1.6 foo.py
['foo.py']
$ python1.6 foo.py john doe
['foo.py', 'john', 'doe']
$ python1.6 foo.py john doe -o /dev/null
[... long insult message to say that Python does not recognize the "-o" option ...]
$ python1.6 foo.py -- john doe -o /dev/null
['foo.py', 'john', 'doe', '-o', '/dev/null']
^-- NOTE: an argument WAS stripped
And that was the behavior for version 1.5.2:
$ python1.5 foo.py
['foo.py']
$ python1.5 foo.py john doe
['foo.py', 'john', 'doe']
$ python1.5 foo.py john doe -o /dev/null
['foo.py', 'john', 'doe', '-o', '/dev/null']
$ python1.5 foo.py -- john doe -o /dev/null
['foo.py', '--', 'john', 'doe', '-o', '/dev/null']
^-- NOTE: argument NOT stripped
The manual page says:
python [options] script [script args]
so strictly speaking this is a bug since arguments starting with '-' are located AFTER the script argument, as specified in the manual page.
Is the bug in Python or the manual page ? (in the latter case this means a change in the command line syntax, and we will have to make scripts that distinguish Python versions when we want to make commands that accept options)
For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=116397&group_id=5470