Chris wrote:
> But sometimes you can have too many of these statements in your
> program, and it starts to get tangled and nasty looking. Is there a way
> I can modify sys.error so that when the interpreter comes accross an
> IndexError it prints "That number is way too big!" before it exits?

Hi,

Try placing the try/except block around the main function of your program:

if __name__ == '__main__':
     try:
         main()
     except IndexError:
         sys.exit("That number is way too big!")

-Farshid
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to