Skip to content

Instantly share code, notes, and snippets.

@jphalip
Created June 1, 2012 07:31
Show Gist options
  • Save jphalip/2849931 to your computer and use it in GitHub Desktop.
Save jphalip/2849931 to your computer and use it in GitHub Desktop.
Some issues I'm having installing a bundle on
------------------------------------------------------------------------
zip-test.py:
import zipfile
zf = zipfile.ZipFile('django-compressor-1.1.2.pybundle', 'r')
zf.debug=3
------------------------------------------------------------------------
$ python zip-test.py
Traceback (most recent call last):
File "zip-test.py", line 3, in <module>
zf = zipfile.ZipFile('django-compressor-1.1.2.pybundle', 'r')
File "/usr/local/python/lib/python2.6/zipfile.py", line 696, in __init__
self._GetContents()
File "/usr/local/python/lib/python2.6/zipfile.py", line 716, in _GetContents
self._RealGetContents()
File "/usr/local/python/lib/python2.6/zipfile.py", line 728, in _RealGetContents
raise BadZipfile, "File is not a zip file"
zipfile.BadZipfile: File is not a zip file
------------------------------------------------------------------------
$ pip install django-compressor-1.1.2.pybundle
Unpacking ./django-compressor-1.1.2.pybundle
Exception:
Traceback (most recent call last):
File "/var/www/sites/virtualenvs_python/venv/lib/python2.6/site-packages/pip/basecommand.py", line 104, in main
status = self.run(options, args)
File "/var/www/sites/virtualenvs_python/venv/lib/python2.6/site-packages/pip/commands/install.py", line 245, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/var/www/sites/virtualenvs_python/venv/lib/python2.6/site-packages/pip/req.py", line 985, in prepare_files
self.unpack_url(url, location, self.is_download)
File "/var/www/sites/virtualenvs_python/venv/lib/python2.6/site-packages/pip/req.py", line 1105, in unpack_url
return unpack_file_url(link, loc)
File "/var/www/sites/virtualenvs_python/venv/lib/python2.6/site-packages/pip/download.py", line 306, in unpack_file_url
unpack_file(source, location, content_type, link)
File "/var/www/sites/virtualenvs_python/venv/lib/python2.6/site-packages/pip/util.py", line 490, in unpack_file
unzip_file(filename, location, flatten=not filename.endswith('.pybundle'))
File "/var/www/sites/virtualenvs_python/venv/lib/python2.6/site-packages/pip/util.py", line 380, in unzip_file
zip = zipfile.ZipFile(zipfp)
File "/usr/local/python/lib/python2.6/zipfile.py", line 696, in __init__
self._GetContents()
File "/usr/local/python/lib/python2.6/zipfile.py", line 716, in _GetContents
self._RealGetContents()
File "/usr/local/python/lib/python2.6/zipfile.py", line 728, in _RealGetContents
raise BadZipfile, "File is not a zip file"
BadZipfile: File is not a zip file
@jphalip
Copy link
Author

jphalip commented Jun 7, 2012

Hi @pnasrat. I finally realized that the bundle file was actually somehow corrupted because of the FTP program I was using (Coda 2). When I upload it with Coda 2, even though the file has the exact same size as locally, it fails when installing with pip, giving that BadZipFile error. But it works if I upload it with Coda 1. This is really weird...

But anyways, I just wanted to thank you again for all your help and patience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment