Issue805725
Created on 2003-09-13.19:22:26 by nwbrown, last changed 2005-10-31.19:01:01 by fwierzbicki.
History | |||
---|---|---|---|
Date | User | Action | Args |
2003-09-13 19:22:26 | nwbrown | create |
Created on 2003-09-13.19:22:26 by nwbrown, last changed 2005-10-31.19:01:01 by fwierzbicki.
Messages | |||
---|---|---|---|
msg863 (view) | Author: Nicholas Brown (nwbrown) | Date: 2003-09-13.19:22:26 | |
A file objects read() function does not seem to work correctly after using the peek() function. For instance consider the following python code used on a file containing nothing but "Hello World": >>> f=open(r'C:\temp.txt') >>> f.read() 'Hello World' >>> f.seek(0) >>> f.read() 'Hello World' The jython version on the other hand: >>> f=open(r'C:\temp.txt') >>> f.read() 'Hello World' >>> f.seek(0) >>> f.read() '' It always outputs an empty string after a seek is called. readlines() seems to work correctly: >>> f=open(r'C:\temp.txt') >>> f.readlines() ['Hello World'] >>> f.seek(0) >>> f.readlines() ['Hello World'] A possible quick fix could just replace read with a call to readlines and join the results with newline characters. This should also fix the already posted problem with read and readlines not working together. BTW, I'm using Jython 2.1 on java1.4.1_01 |
|||
msg864 (view) | Author: Jonathan Ellis (ellisj) | Date: 2004-02-25.21:39:10 | |
Logged In: YES user_id=657828 I cannot reproduce the bug in read he describes. Tested both on very small and medium-size files. |
|||
msg865 (view) | Author: Frank Wierzbicki (fwierzbicki) | Date: 2005-10-31.19:01:01 | |
Logged In: YES user_id=193969 cannot reproduce |
History | |||
---|---|---|---|
Date | User | Action | Args |
2003-09-13 19:22:26 | nwbrown | create |
Supported by Python Software Foundation,
Powered by Roundup