NameError Problem

Jonathon jblake at eskimo.com
Fri Jun 18 19:48:20 EDT 1999


	I'm writing a long << 25K line >> script to verify data from a
 	database.
		
	The following bit of script is giving me a NameError, and
	I can't figure out why.

	datafile = open ( the_data_file_is, "r" )
	new_datafile = open ( the_temp_data_file_is, "w" )
	line_kounter = 0
	while line_kounter < 50000
	    line_kounter = line_kounter + 1
	    templine = datafile.readline(line_kounter)
            validate_line = templine
	    if ( the_file_is == "john_www.db" ) :
	         temp_record_id = int(validate_line[2:18])
		 temp_country  = strip(validate_line[20:50])
            elif ( the_file_is == "jan_www.db " ):
                 temp_record_id = int(validate_line[2:10])
                 temp_country = strip(validate_line[12:20])
            print temp_record_id
		
	At that point I get a NameError message.
	All I'm trying to do is have it print to screen
	the record number it is working on.  
	
	I've double checked the white spaces, and they are
	all lined up at 0, 4, 8, 12, 16 etc.
	
	What am I missing here?  << And how do I correct it. >>
	
	<< If it matters, there are actually six more
	elif constructs  each containing
	containing thirty or so initializations.  >>

	<< The person who wrote the original database input functions
	didn't believe in error trapping, with the result that it is
	replete with errors -- and now that database is going onto
	the web --- but has to be error free.  >>

	xan

	jonathon
-- 
	I'm still looking for a good book on
		3:	The Recent Unpleasantness
		1:	The War Of Northern Aggression.
		2:	The War of Southern Rebellion.




More information about the Python-list mailing list