[Python-bugs-list] [ python-Bugs-610584 ] readlines will not read the whole file
noreply@sourceforge.net
noreply@sourceforge.net
Tue, 17 Sep 2002 07:59:46 -0700
Bugs item #610584, was opened at 2002-09-17 10:48
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=610584&group_id=5470
Category: Windows
>Group: Not a Bug
>Status: Closed
>Resolution: Invalid
>Priority: 5
Submitted By: Wenhua (wezhang)
Assigned to: Tim Peters (tim_one)
Summary: readlines will not read the whole file
Initial Comment:
put the w.jpg file in c:\w.jpg
run the following:
>>>inputfile=open('c:\w.jpg', 'r')
>>>outputfile=open('c:\w2.jpg', 'w')
>>>L=inputfile.readlines()
>>>outputfile=writelines(L)
the w2.jpg will be much samller than the input file w.jpg
w2.jpg ends right before the character x1a.
it also happened in read(n), readline()...
I have install and reinstall python 22 a few times on two
different computer running windows2000 prof.
under Cygwin the python 2.2.1 works fine, so I think the
bug only happened under windows.
please fix it ASAP, I could not find a way to go around
it. I try to use python 2.1.3 but it may has the same
problem.
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2002-09-17 10:59
Message:
Logged In: YES
user_id=31435
Open binary files in binary mode. That is, don't dare use 'r'
and 'w' when opening binary files, use 'rb' and 'wb'.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=610584&group_id=5470