Message5060
This program compresses a string and an array.array.
import array
import zlib
INPUT = 'CrunchyFrog'
ci = zlib.compress(INPUT)
print len(ci), repr(ci)
a = array.array('c', INPUT)
ca = zlib.compress(a)
print len(ca), repr(ca)
The output of each print statement in CPython is the same length and
string. Jython 2.5.0 results in
19 'x\x9cs.*\xcdK\xce\xa8t+\xcaO\x07\x00\x1a"\x04k'
Traceback (most recent call last):
File "ztest.py", line 10, in <module>
ca = zlib.compress(a)
File "C:\opt\jython2.5.0\Lib\zlib.py", line 62, in compress
deflater.setInput(string, 0, len(string))
TypeError: setInput(): 1st arg can't be coerced to byte[]
The result in this case should be as if zlib.compress() was called with
ca.tostring(). |
|
Date |
User |
Action |
Args |
2009-08-21 12:26:01 | pjdm | set | recipients:
+ pjdm |
2009-08-21 12:26:01 | pjdm | set | messageid: <1250857561.11.0.0920167531749.issue1444@psf.upfronthosting.co.za> |
2009-08-21 12:26:00 | pjdm | link | issue1444 messages |
2009-08-21 12:26:00 | pjdm | create | |
|