[mod_python] Is this related to not having support to upload a file?

Alberto Ruiz al at ruiz.ws
Mon Apr 3 21:26:54 EDT 2006


Like I mentioned in earlier threads, this code used to work in a Debian
system, but now it doesn't work on FreeBSD with modpython 2.7.11.
I'm getting the following error.

Mod_python error: "PythonHandler mod_python.publisher"

Traceback (most recent call last):

  File "/usr/local/lib/python2.4/site-packages/mod_python/apache.py",
line 193, in Dispatch
    result = object(req)

  File "/usr/local/lib/python2.4/site-packages/mod_python/publisher.py",
line 106, in handler
    val = File(field)

  File "/usr/local/lib/python2.4/site-packages/mod_python/publisher.py",
line 322, in __init__
    for m in field.file.__methods__:

AttributeError: 'file' object has no attribute '__methods__'



It is hard to pin point the problem, since it doesn't show where in my
code is happening. But my guess is that it is somewhere in this code
snippet:

for p in photo:
phpath='/data/webroot/propman/propphotos/'
F= open(phpath+str("tempprop"+id+"-"+p.name[-1:]+p.filename[-4:]),'wb')
F.write(p.file.read())
F.flush()
os.system("convert "+phpath+str("tempprop"+id
+"-"+p.name[-1:]+p.filename[-4:])+" -resize 400x300 "+phpath
+""+str("prop"+id+"-"+p.name[-1:]+p.filename[-4:]))
com="convert "+phpath+str("tempprop"+id
+"-"+p.name[-1:]+p.filename[-4:])+" -resize 80x60 "+phpath
+"thm"+str("prop"+id+"-"+p.name[-1:]+p.filename[-4:])
R.write("\n\n"+com+"\n\n")
os.system(com)
if p.name[-1:]=="1":
com="convert "+phpath+str("tempprop"+id
+"-"+p.name[-1:]+p.filename[-4:])+" -resize 220x165\! "+phpath
+"bthm"+str("prop"+id+"-"+p.name[-1:]+p.filename[-4:])
R.write("\n\n"+com+"\n\n")
os.system(com)

Sorry about the indentation, it got missed up while pasting in the
email.

My guess is in 'p.file.read()

How do I implemented for 2.7.11? or do I need to configure my Apache
conf file.



More information about the Mod_python mailing list