NameError Problem

Andrew M. Kuchling akuchlin at
Fri Jun 18 20:18:51 EDT 1999

Jonathon writes:
>	    if ( the_file_is == "john_www.db" ) :
>            elif ( the_file_is == "jan_www.db " ):
>            print temp_record_id

Hmm...  try adding 
	         print "EEK! Got unexpected filename:", repr(the_file_is)

You could also raise an exception, instead of just printing a message.
I'll wager that the_file_is winds up with some sort of unexpected
value, and causes your variable to never be assigned a value,. because 
none of the conditions trigger.

A.M. Kuchling
"Since the invasion of Grenada," a military source informed me, "we call it
C^5. That's Command, Control, Communications, Computers and Confusion."
    -- Barbara Garson, _The Electronic Sweatshop_ (1988)

More information about the Python-list mailing list