test_bz2 on Python 2.4.1
Reinhold Birkenfeld wrote:
Are you sure that you are calling the newly-built python.exe? It is strange that the test should pass in interactive mode when it doesn't in normal mode.
For a confirmation, can you execute this piece of code both interactively and from a file:
Yes, both Python's tested are fresh from CVS. Here is the output of the test you asked I run #---------------------- # File: testbz2.py #---------------------- """ import os from bz2 import BZ2File data = 'BZh91AY&SY\xd9b\x89]\x00\x00\x00\x03\x80\x04\x00\x02\x00\x0c\x00 \x00!\x9ah3M\x13<]\xc9\x14\xe1BCe\x8a%t' f = open('test.bz2', "wb") f.write(data) f.close() bz2f = BZ2File('test.bz2') lines = bz2f.readlines() bz2f.close() assert lines == ['Test'] bz2f = BZ2File('test.bz2') xlines = list(bz2f.xreadlines()) bz2f.close() assert lines == ['Test'] os.unlink('test.bz2') """ ------------- RESULTS: ------------- #--------------------------- Python 2.5a0 from CVS -----------------# # Result: passes $ /g/projs/py25/python/dist/src/MinGW/python testbz2.py #--------------------------- Python 2.4.1 from CVS -----------------# # Result: fails $ /g/projs/py24/python/dist/src/MinGW/python testbz2.py Traceback (most recent call last): File "testbz2.py", line 9, in ? lines = bz2f.readlines() RuntimeError: wrong sequence of bz2 library commands used #--------------------------- Python 2.4.1 from CVS -----------------# # Interpreted session: testbz2 fails here as well now $ /g/projs/py24/python/dist/src/MinGW/python -i Python 2.4.1 (#65, Aug 26 2005, 14:38:48) [GCC 3.4.4 (mingw special)] on win32 Type "help", "copyright", "credits" or "license" for more information.
import os from bz2 import BZ2File data = 'BZh91AY&SY\xd9b\x89]\x00\x00\x00\x03\x80\x04\x00\x02\x00\x0c\x00 \x0 0!\x9ah3M\x13<]\xc9\x14\xe1BCe\x8a%t' f = open('test.bz2', "wb") f.write(data) f.close() bz2f = BZ2File('test.bz2') lines = bz2f.readlines() Traceback (most recent call last): File "<stdin>", line 1, in ? RuntimeError: wrong sequence of bz2 library commands used raise SystemExit
#--------------------------- Python 2.5a0 from CVS -----------------# # Interpreted session: testbz2 passes $ /g/projs/py25/python/dist/src/MinGW/python -i Python 2.5a0 (#65, Aug 26 2005, 14:57:28) [GCC 3.4.4 (mingw special)] on win32 Type "help", "copyright", "credits" or "license" for more information.
import os from bz2 import BZ2File data = 'BZh91AY&SY\xd9b\x89]\x00\x00\x00\x03\x80\x04\x00\x02\x00\x0c\x00 \x0 0!\x9ah3M\x13<]\xc9\x14\xe1BCe\x8a%t' f = open('test.bz2', "wb") f.write(data) f.close() bz2f = BZ2File('test.bz2') lines = bz2f.readlines() bz2f.close() assert lines == ['Test'] bz2f = BZ2File('test.bz2') xlines = list(bz2f.xreadlines()) bz2f.close() assert lines == ['Test'] os.unlink('test.bz2') raise SystemExit
Regards, Khalid _________________________________________________________________ FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
A.B., Khalid wrote:
#--------------------------- Python 2.5a0 from CVS -----------------# # Result: passes $ /g/projs/py25/python/dist/src/MinGW/python testbz2.py
#--------------------------- Python 2.4.1 from CVS -----------------# # Result: fails $ /g/projs/py24/python/dist/src/MinGW/python testbz2.py Traceback (most recent call last): File "testbz2.py", line 9, in ? lines = bz2f.readlines() RuntimeError: wrong sequence of bz2 library commands used
I don't understand this. The sources for the bz2 modules are exactly equal in both branches. How do you check out the 2.4.1 from CVS? Reinhold -- Mail address is perfectly valid!
participants (2)
-
A.B., Khalid
-
Reinhold Birkenfeld