NameError Problem

Andrew M. Kuchling akuchlin at mems-exchange.org
Sat Jun 19 02:18:51 CEST 1999


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

Hmm...  try adding 
	     else:
	         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			http://starship.python.net/crew/amk/
"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