R: R: R: [mod_python] problem in file download

Manera, Villiam vmanera at manord.com
Fri Jun 7 13:04:42 EST 2002


I've fixed publisher.py : 
> for m in dir(field.file) :
and now the download seams to do well, but when I attempt to read the file:
	for F in req.form.list:
			if F.name == 'file_costi':
			a=F.file.read()  <-------------this message will
showed:
Mod_python error: "PythonHandler mod_python.publisher"

Traceback (most recent call last):

  File "C:\Program Files\Python22\Lib\mod_python\apache.py", line 193, in
Dispatch
    result = object(req)

  File "C:\Program Files\Python22\Lib\mod_python\publisher.py", line 171, in
handler
    result = apply(object, (), args)

  File "e:/script/cgi/cgi-mpy\download.py", line 48, in printfile
    #doc.append(dir(req))

ValueError: I/O operation on closed file

Villiam

-----Messaggio originale-----
Da: Dustin Mitchell [mailto:dustin at ywlcs.org]
Inviato: venerdì 7 giugno 2002 5.45
A: mod_python at modpython.org
Oggetto: Re: R: R: [mod_python] problem in file download


>         for m in field.file.__methods__:
>             self.__dict__[m] = getattr(field.file, m)
> 
>         self.headers = field.headers
>         self.filename = field.filename

Untested in this instance, but in similar situations the equivalent of
dir(field.file) has worked for me.  It does all the chasing up the
inheritance hierarchy necessary.

Dustin

-- 

  Dustin Mitchell
  dustin at ywlcs.org
  http://people.cs.uchicago.edu/~dustin/
_______________________________________________
Mod_python mailing list
Mod_python at modpython.org
http://www.modpython.org/mailman/listinfo/mod_python



More information about the Mod_python mailing list