Another question from the 'Learn to Program...' book:

Erno Kuusela erno-news at
Wed Jan 16 06:24:36 EST 2002

In article <V8918.29890$uA.343738 at>, "Dan
Hamm" <dan at> 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.

  -- erno

More information about the Python-list mailing list