Message30548
When comparing two files which should be equal the last line is
different:
The first file is a bzip2 compressed file and is read with
bz2.BZ2File()
The second file is the same file uncompressed and read with open()
The first file named file.txt.bz2 is uncompressed with:
$ bunzip2 -k file.txt.bz2
To compare I use this script:
###############################
import bz2
f1 = bz2.BZ2File(r'file.txt.bz2', 'r')
f2 = open(r'file.txt', 'r')
lines = 0
while True:
line1 = f1.readline()
line2 = f2.readline()
if line1 == '':
break
lines += 1
if line1 != line2:
print 'line number:', lines
print repr(line1)
print repr(line2)
f1.close()
f2.close()
##############################
Output:
$ python bzp.py
line number: 588317
'\x07'
''
The offending attached file is 5.5 MB. Sorry, i could not reproduce this problem
with a smaller file.
Tested in Fedora Core 5 and Python 2.4.3 |
|
Date |
User |
Action |
Args |
2007-08-23 14:49:50 | admin | link | issue1597011 messages |
2007-08-23 14:49:50 | admin | create | |
|