[Tutor] try..except - what about that ton of **Error statements?

Jim Mooney cybervigilante at gmail.com
Wed May 22 08:20:29 CEST 2013


> Keep the try block small. For example if it's for a call to
> open(filename, "r") the only possible errors (assuming correct syntax)
> are NameError for using an undefined variable and IOError for
> specifying a file which doesnt exist.

Thanks. Since I'm new at this the error lists I saw just had the bald
names, which didn't tell me much. But I found a concise and basic
explanation of each error at
http://python.about.com/od/pythonstandardlibrary/a/lib_exceptions.htm

Although it's still a bit circular at my level. I won't be sure what
errors to raise until I see enough errors, but that will come with
experience, I guess. Now I just have to figure how to print the list
out without the ads ;')

Jim


More information about the Tutor mailing list