Try

ZipFile(request.vars.body.file, 'r')

Anthony

On Monday, March 26, 2012 10:18:40 AM UTC-4, Cliff 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