Another question from the 'Learn to Program...' book:
Peter Hansen
peter at engcorp.com
Wed Jan 16 08:25:04 EST 2002
More information about the Python-list mailing list
Wed Jan 16 08:25:04 EST 2002
- Previous message (by thread): Another question from the 'Learn to Program...' book:
- Next message (by thread): efficient idiomatic queue?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Erno Kuusela wrote: > > In article <V8918.29890$uA.343738 at rwcrnsc51.ops.asp.att.net>, "Dan > Hamm" <dan at dmhamm.org> writes: > > | I copied the code example from page 95 (no errata sheet data on this): > | import os, time > > | try: # initialize files and variables > [...] > | except: > | print 'ERROR: Failed to create new menu' > > | But when I run it, it just prints out the error message without modifying > | the file. > > bare except: is bad for the reason you just discovered :) try taknig > the code out of the try/except block and you'll get a better error. Agreed, although easier to do than that, and requiring less reformatting etc., is to insert "raise" after the print statement. -Peter
- Previous message (by thread): Another question from the 'Learn to Program...' book:
- Next message (by thread): efficient idiomatic queue?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list