<[EMAIL PROTECTED]> wrote
infile = sys.argv[1]
IndexError: list index out of range
is there a way that i could suppress this and add my own error code
Hi Bryan,
You are probably better off pursuing Danny's suggestion. But, this
is what you asked for:
IDLE 1.1.4
class CustomError(Exception):
pass
Or, combining the suggestions you get:
import sys
try:
infile = sys.argv[1]
except IndexError:
# handle the error by assigning a default value
# just as you would do if checking len()
Lots of options :-)
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor