need some cgi help please

nephish at xit.net nephish at xit.net
Tue Jun 7 22:15:26 EDT 2005


Hey there. Here is the deal.... i have a script that is supposed to
open a file based on criteria from a web form.
i cant seem to get it to work though.

here is the code:

form = cgi.FieldStorage()
DataRecord = form['DataTime'].value
Customer = form['CustName'].value # should be automatically filled in


print "Content-Type: text/html\n\n"
print

WorkingFile =
open("/var/www/stretch/web_root/SidCrops/"+Customer+"/"+DataRecord,
"r")
all_lines = WorkingFile.readlines()
WorkingFile.close()
for line in all_lines:
	print line

here is the error:
WorkingFile undefined, builtin open = <type 'file'>, Customer =
'tenderloin', DataRecord = 'Tue Jun 7 20:13:35 2005.txt'

IOError: [Errno 2] No such file or directory:
'/var/www/stretch/web_root/SidCrops/tenderloin/Tue Jun 7 20:13:35
2005.txt'
      args = (2, 'No such file or directory')
      errno = 2
      filename = '/var/www/stretch/web_root/SidCrops/tenderloin/Tue Jun
7 20:13:35 2005.txt'
      strerror = 'No such file or directory'

here is the deal.... the file is there ! i run similar code in idle and
it works.
i just dont get it. it isn't a permissions issue, its chmod  777 all
the way.
i gotta find out why this is goofing on me... 

please help me!




More information about the Python-list mailing list