Hi,

I was trying to parse the contents of a single gzipped file, but kept 
getting an empty file.

@auth.allows_jwt()
@request.restful()
def log():
    def POST(*args,**vars):

        with gzip.GzipFile(fileobj=request.vars.file.file, mode='rb') as f:
            test = f.readlines()
            print test
        return dict()
    return dict(POST=POST)




So i decided to print the contents of the file beforehand to make sure it 
wasn't empty.

print request.vars.file

with gzip.GzipFile(fileobj=request.vars.file.file, mode='rb') as f:
    test = f.readlines()
    print test

To my surprise it started outputting the the contents of the zipped file.

If I comment out the print statement it stops working... Any ideas what is 
causing this behaviour?


Cheers,

James

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to