[mod_python] Uploading files with 2.7.10

Bartlomiej Rymarski bart at wsisiz.edu.pl
Tue Jun 8 16:09:37 EDT 2004


I wrote a script that uploads a file to the server using mod_python 3.1.3, 
everything works fine, until I've tried to put the script on the main 
server which uses mod_python 2.7.10 (apache 2.6.x).

Here is the function responsible for uploading files.

def add(req, file_up):
   name_up = file_up.filename
   data = file_up.file.read(5*1024*1024) # limit to 5 MB

   localfile = open(file_up, "wb")

As I said, this code works perfectly fine with mod_python 3.1.3. With 
2.7.10 I'm getting this error:

Mod_python error: "PythonHandler mod_python.publisher"

Traceback (most recent call last):

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

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

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

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

Is there any way to fix it?

Thanks in advance.

Bartek Rymarski <bart at wsisiz.edu.pl>
$ %blow
bash: fg: %blow: no such job

More information about the Mod_python mailing list