classification
Title: Error in sys.argv documenation
Type: Stage:
Components: Documentation Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, kisielk (2)
Priority: normal Keywords

Created on 2007-04-23 09:31 by kisielk, last changed 2007-04-24 15:10 by georg.brandl.

Messages (2)
msg31868 - (view) Author: Kamil Kisiel (kisielk) Date: 2007-04-23 09:31
From the current version on http://docs.python.org/lib/module-sys.html:

argv

The list of command line arguments passed to a Python script. argv[0] is the script name (it is operating system dependent whether this is a full pathname or not). If the command was executed using the -c command line option to the interpreter, argv[0] is set to the string '-c'. If no script name was passed to the Python interpreter, argv has zero length.


The last line, "If no script name was passed to the Python interpreter, argv has zero length." does not appear to be correct, the length of argv is 1 and argv[0] is '':

kamil@zaphod:~$ python2.5
Python 2.5 (release25-maint, Dec  9 2006, 14:35:53)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-20)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> len(sys.argv)
1
>>> sys.argv[0]
''
>>>
msg31869 - (view) Author: Georg Brandl (georg.brandl) Date: 2007-04-24 15:10
Thanks for the report, fixed in rev. 54939, 54940 (2.5).
History
Date User Action Args
2007-04-23 09:31:05kisielkcreate