Message88994
That "typo" is intentional, it's also written in the comment:
try:
foo = opne("file") # misspelled "open"
except:
sys.exit("could not open file!")
This example shows how a bare except will catch the NameError caused by
'opne' and return the wrong error message, whereas "except IOError" will
only catch IOErrors and show the NameError. |
|
Date |
User |
Action |
Args |
2009-06-06 10:13:26 | ezio.melotti | set | recipients:
+ ezio.melotti, georg.brandl, jszakmeister, cate |
2009-06-06 10:13:26 | ezio.melotti | set | messageid: <1244283206.41.0.586583693106.issue6220@psf.upfronthosting.co.za> |
2009-06-06 10:13:25 | ezio.melotti | link | issue6220 messages |
2009-06-06 10:13:24 | ezio.melotti | create | |
|