Looks like your're retrieving the payload from the form field. I'd try
using the value recorded in the database instead, something like:

myfile = open(db.mytable[n].body)

I'm affraid I don't recall exactly how the upload mechanism works, but
there is a lot of info in the online manual about it.

On 26 mar, 11:18, Cliff <[email protected]> wrote:
> I have an upload field called 'body.'  It is meant to contain zipped
> archives.
>
> I want to extract and parse one file from the archive.  Right now I am
> using ZipFile which should be able to work with a file-like object,
> according to the Python docs.
>
> This does not work:
>
> This also does not work:
> from StringIO import StringIO
> output = StringIO()
> output.write(form.vars.body)
> print output # prints nothing
> zippo = ZipFile(output, 'r')
>
> ZipFile complains that the input is not a zip file.  Not surprising
> because the call to print showed nothing.
>
> Can anyone give me a clue what I'm doing wrong?
>
> Thanks,
> Cliff Kachinske

Reply via email to