[pypy-issue] [issue1165] call to _RealGetContents from zipfile.py draws error in tests

Ian Delaney tracker at bugs.pypy.org
Mon Jun 11 11:21:37 CEST 2012


New submission from Ian Delaney <della5 at iinet.com.au>:

I note you made an entry a couple of months ago re pypy managing zip files.
from the test suite of latest odfpy,.-0.9.4, 

--------------------------------------------------------------------------
 * Running testwrite.py ...
.E
======================================================================
ERROR: test_write (__main__.TestWrite)
document's write method
----------------------------------------------------------------------
Traceback (most recent call last):
  File "testwrite.py", line 40, in test_write
    z = zipfile.ZipFile(outfp,"r")
  File "/usr/lib64/pypy1.9/lib-python/2.7/zipfile.py", line 712, in __init__
    self._GetContents()
  File "/usr/lib64/pypy1.9/lib-python/2.7/zipfile.py", line 746, in _GetContents
    self._RealGetContents()
  File "/usr/lib64/pypy1.9/lib-python/2.7/zipfile.py", line 761, in _RealGetContents
    raise BadZipfile, "File is not a zip file"
BadZipfile: File is not a zip file

and to seal the deal, let's go to the source and do the test directly in
pypy-1.9's own interpeter;

archtester tests # pwd
/mnt/gen2/TmpDir/portage/dev-python/odfpy-0.9.4/work/odfpy-0.9.4/tests
archtester tests # PYTHONPATH=../ pypy-c1.9
Python 2.7.2 (341e1e3821fff77db3bb5cdb7a4851626298c44e, Jun 09 2012, 10:32:11)
[PyPy 1.9.0 with GCC 4.5.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``The extra blank lines that pypy
prints under windows come from distutils that does not find Visual Studio 6''
>>>> import unittest, os
>>>> import cStringIO
>>>> import zipfile
>>>> from odf.opendocument import OpenDocumentText
>>>> from odf import style, text
>>>> from odf.text import P
>>>> outfp = cStringIO.StringIO()
>>>> textdoc = OpenDocumentText()
>>>> p = P(text=u"Æblegrød")
>>>> p.addText(u' Blåbærgrød')
>>>> textdoc.text.addElement(p)
>>>> textdoc.write(outfp)
>>>> outfp.seek(0)
>>>> z = zipfile.ZipFile(outfp,"r")
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/lib64/pypy1.9/lib-python/2.7/zipfile.py", line 712, in __init__
    self._GetContents()
  File "/usr/lib64/pypy1.9/lib-python/2.7/zipfile.py", line 746, in _GetContents
    self._RealGetContents()
  File "/usr/lib64/pypy1.9/lib-python/2.7/zipfile.py", line 761, in _RealGetContents
    raise BadZipfile, "File is not a zip file"
BadZipfile: File is not a zip file

Needles to say it passes fine with Cpython2..  I don't follow how the above code
results in a zip file, the files in the examples folder are files of extensions
odp && odt

----------
assignedto: amcnabb
messages: 4406
nosy: amcnabb, idella5, pypy-issue
priority: performance bug
release: 1.9
status: unread
title: call to _RealGetContents from zipfile.py draws error in tests

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1165>
________________________________________


More information about the pypy-issue mailing list