当 zip 文件在我的本地 GAE sdk 中正确读取时,什么会导致 Google App Engine 无法识别该文件
当我在本地运行时,我的代码执行成功,但是当我将其上传到 GAE 并尝试运行时,它会抛出 BadZipfile: File is not a zip file, or以注释结尾
raw_file = urllib2.urlopen(url)
buffer = cStringIO.StringIO(raw_file.read())
z = zipfile.ZipFile(buffer)
zipped file size is 2.5 mb 解压后的大小为 14 mb
导致此错误的两个环境有何不同?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 urlfetch(App Engine 向其他站点发出 HTTP 请求的 API)获取的最大大小为 1MB,因此您的文件将被截断。 dev_appserver 不强制执行 1MB 限制。
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.