Re: Windows vs. file.read

2010-09-02 Thread Lawrence D'Oliveiro
In message , MRAB wrote: > On 02/09/2010 08:49, Lawrence D'Oliveiro wrote: >> In message, MRAB >> wrote: >> >>> You should open the files in binary mode, not text mode, ie file(path, >>> "rb"). Text mode is the default. Not a problem on *nix because the line >>> ending is newline. >> >> We used t

Re: Windows vs. file.read

2010-09-02 Thread Thomas Jollans
On Thursday 02 September 2010, it occurred to ipatrol6...@yahoo.com to exclaim: > Correct in that regard. In Python 3.x, strings are by default considered > UTF-8. Wheras ASCII isn't a problem because it's fixed-width, UTF-8 will > give you a different character depending on the last byte value. T

Re: Windows vs. file.read

2010-09-02 Thread ipatrol6...@yahoo.com
Correct in that regard. In Python 3.x, strings are by default considered UTF-8. Wheras ASCII isn't a problem because it's fixed-width, UTF-8 will give you a different character depending on the last byte value. Therefore handling any kind of data that is not UTF-8 will need you to open it with '

Re: Windows vs. file.read

2010-09-02 Thread MRAB
On 02/09/2010 08:49, Lawrence D'Oliveiro wrote: In message, MRAB wrote: You should open the files in binary mode, not text mode, ie file(path, "rb"). Text mode is the default. Not a problem on *nix because the line ending is newline. We used to pride ourselves on not having to worry about tex

Re: Windows vs. file.read

2010-09-02 Thread Lawrence D'Oliveiro
In message , MRAB wrote: > You should open the files in binary mode, not text mode, ie file(path, > "rb"). Text mode is the default. Not a problem on *nix because the line > ending is newline. We used to pride ourselves on not having to worry about text versus binary I/O modes on *nix, but I’m

Re: Windows vs. file.read

2010-09-01 Thread Mike
On Sep 1, 12:31 pm, MRAB wrote: > You should open the files in binary mode, not text mode, ie file(path, > "rb"). Text mode is the default. Not a problem on *nix because the line > ending is newline. Thanks. That was it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows vs. file.read

2010-09-01 Thread David Robinow
On Wed, Sep 1, 2010 at 1:03 PM, Mike wrote: > I have a ppm file that python 2.5 on Windows XP cannot read > completely. > Python on linux can read the file with no problem > Python on Windows can read similar files. > I've placed test code and data here: > http://www.cs.ndsu.nodak.edu/~hennebry/pp

Re: Windows vs. file.read

2010-09-01 Thread MRAB
On 01/09/2010 18:03, Mike wrote: I have a ppm file that python 2.5 on Windows XP cannot read completely. Python on linux can read the file with no problem Python on Windows can read similar files. I've placed test code and data here: http://www.cs.ndsu.nodak.edu/~hennebry/ppm_test.zip Within the