catch empty sys.argv
pedro at athlet.de
Thu Jul 12 08:58:24 CEST 2001
my scripts gets a variable from .sys.argv (a filename). when the
filename is not entered the scripts is completely useless, so i
thought i'd do a basic check like:
if sys.argv == ''
exit('enter something, stupid')
but the script just fails if nothing is entered (it also fails without
the check of course):
Traceback (most recent call last):
File "lm4l.py", line 118, in ?
obj = argv
IndexError: list index out of range
what can i do ?
More information about the Python-list