Created
June 1, 2012 07:31
-
-
Save jphalip/2849931 to your computer and use it in GitHub Desktop.
Some issues I'm having installing a bundle on
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------------------------------------------------ | |
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 |
actually you can do the
python -mpdb zip-test.py
(Pdb) break zipfile:192
(Pdb) cont
(Pdb) p sys.exc_info()
To get the underlying IOError.
Thanks so much for following up on this. Please see the outputs below:
(myenv)bash-3.00$ ls -l django-compressor-1.1.2.pybundle -rw-r--r-- 1 myuser myuser 140928 Jun 1 00:01 django-compressor-1.1.2.pybundle (myenv)bash-3.00$ python -mpdb zip-test.py > /export/home/myuser/bundles/zip-test.py(1)() -> import zipfile (Pdb) break zipfile:192 Breakpoint 1 at /usr/local/python/lib/python2.6/zipfile.py:192 (Pdb) cont Traceback (most recent call last): File "/usr/local/python/lib/python2.6/pdb.py", line 1296, in main pdb._runscript(mainpyfile) File "/usr/local/python/lib/python2.6/pdb.py", line 1215, in _runscript self.run(statement) File "/usr/local/python/lib/python2.6/bdb.py", line 372, in run exec cmd in globals, locals File "", line 1, in File "zip-test.py", line 3, in 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" BadZipfile: File is not a zip file Uncaught exception. Entering post mortem debugging Running 'cont' or 'step' will restart the program > /usr/local/python/lib/python2.6/zipfile.py(728)_RealGetContents() -> raise BadZipfile, "File is not a zip file" (Pdb) print locals() {'fp': , 'self': , 'endrec': None} (Pdb) p sys.exc_info() (, ImportError(u'Could not import keysym for local pythonversion', ImportError('No module named _ctypes',)), )
The 'stat' command isbn't available but I've tried using 'truss' instead (not sure if that's helpful):
bash-3.00$ truss -t lstat64 -v lstat64 ls django-compressor-1.1.2.pybundle lstat64("django-compressor-1.1.2.pybundle", 0x08046920) = 0 d=0x02D50015 i=203595 m=0100644 l=1 u=2210 g=2210 sz=140928 at = Jun 4 21:52:08 GMT 2012 [ 1338846728 ] mt = Jun 1 00:01:38 GMT 2012 [ 1338508898 ] ct = Jun 4 06:29:06 GMT 2012 [ 1338791346 ] bsz=131072 blks=517 fs=zfs django-compressor-1.1.2.pybundle
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
So looking at the code at 728 in 2.6 we're raising here:
Looking at _EndRecData we return none when we are seeking back through the file
Can you do
python -c "import zipfile;print zipfile.sizeEndCentDir"
and also statdjango-compressor-1.1.2.pybundle
andls -l django-compressor-1.1.2.pybundle
and put the output here in a comment.Can you also do (ignoring my output lines those ones with
->