views:

81

answers:

1

My code executes successfully when I run it locally, but when I upload it to GAE and attempt to run it throws me a BadZipfile: File is not a zip file, or ends with a comment

raw_file = urllib2.urlopen(url)
buffer = cStringIO.StringIO(raw_file.read())
z = zipfile.ZipFile(buffer)

zipped file size is 2.5 mb unzipped size is 14 mb

What is the difference in the two environments that is causing this error?

+2  A: 

The maximum size you can fetch using urlfetch (App Engine's API for making HTTP requests to other sites) is 1MB, so your file is getting truncated. The dev_appserver doesn't enforce the 1MB limit.

Nick Johnson
Is there anyway to request files larger than 1MB from App Engine?
rockstardev
Not currently, no, unless you use multiple range requests and concatenate them together.
Nick Johnson