471,335 Members | 1,460 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,335 software developers and data experts.

to access a file which is passed through CGI

print "Content-Type: text/html\n"
form = cgi.FieldStorage()

item = form['file2'].file

data = item.file.read()
print data
================================================== =====================
this is the ERROR on the browser
================================================== =====================

<type 'exceptions.AttributeError'> Python 2.5: /usr/bin/python
Thu Aug 30 13:14:04 2007

A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
/var/www/cgi-bin/patch_mgr_frontend1.py in ()
16 item = form['file2'].file
17 data = item.file.read()
18 print data
data undefined, item = None, item.file undefined

<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'file'

================================================== =========================
when i try and print the fieldStorage of the CGI it is as follows
================================================== =========================
FieldStorage(None, None, [MiniFieldStorage('file2', 'gaj.xml')]) None

================================================== ====================
PLZ help me out!!!!!!
================================================== ===================
Aug 30 '07 #1
0 781

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Jorge Cecílio | last post: by
8 posts views Thread by Michel Rouzic | last post: by
1 post views Thread by gm | last post: by
5 posts views Thread by Mahendra Kumar Kutare | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.