logo       

Problem using zipfile.py in ZIP_DEFLATED mode: msg#00013

lang.jython.user

Subject: Problem using zipfile.py in ZIP_DEFLATED mode

Hi all,

I've been trying to use the module zipfile.py in to archive files in a zip archive with compression, and I've encountered some problems. Here is my code:

from zipfile import *
#creating my archive
z = ZipFile('C:\\myZipArchive.zip', 'a', ZIP_DEFLATED)

#adding my first file to the archive
z.write('C:\\Test.txt')


And i get this error:

Traceback (innermost last):
File "<console>", line 1, in ?
File "C:\jython\Lib\zipfile.py", line 395, in write
File "C:\jython\Lib\zlib.py", line 65, in compress
File "C:\jython\Lib\zlib.py", line 99, in _get_deflate_data
java.lang.IllegalAccessException: Class
org.python.core.PyReflectedFunction can
not access a member of class java.lang.AbstractStringBuilder with
modifiers "pub
lic"
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
at java.lang.reflect.Method.invoke(Method.java:578)
at
org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java
)
at org.python.core.PyMethod.__call__(PyMethod.java)
at org.python.core.PyObject.__call__(PyObject.java)
at org.python.core.PyInstance.invoke(PyInstance.java)
at zlib$py._get_deflate_data$14(C:\jython\Lib\zlib.py:99)
at zlib$py.call_function(C:\jython\Lib\zlib.py)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyFunction.__call__(PyFunction.java)
at zlib$py.compress$8(C:\jython\Lib\zlib.py:65)
at zlib$py.call_function(C:\jython\Lib\zlib.py)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyFunction.__call__(PyFunction.java)
at org.python.core.PyInstance.invoke(PyInstance.java)
at zipfile$py.write$17(C:\jython\Lib\zipfile.py:395)
at zipfile$py.call_function(C:\jython\Lib\zipfile.py)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyFunction.__call__(PyFunction.java)
at org.python.core.PyInstance.invoke(PyInstance.java)
at org.python.pycode._pyx4.f$0(<console>:1)
at org.python.pycode._pyx4.call_function(<console>)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyCode.call(PyCode.java)
at org.python.core.Py.runCode(Py.java)
at org.python.core.Py.exec(Py.java)
at
org.python.util.PythonInterpreter.exec(PythonInterpreter.java)
at
org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter
.java)
at
org.python.util.InteractiveInterpreter.runsource(InteractiveInterpret
er.java)
at
org.python.util.InteractiveInterpreter.runsource(InteractiveInterpret
er.java)
at
org.python.util.InteractiveConsole.push(InteractiveConsole.java)
at
org.python.util.InteractiveConsole.interact(InteractiveConsole.java)
at org.python.util.jython.main(jython.java)


But when I create my zipfile with no compression with z = ZipFile('C:\\myZipArchive.zip', 'a', ZIP_STORED), everything is ok...
Does anybody knows why it fails when trying to compress?

Thanks,

Romain










-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise