Windows vs. file.read

David Robinow drobinow at gmail.com
Wed Sep 1 13:34:06 EDT 2010


On Wed, Sep 1, 2010 at 1:03 PM, Mike <hennebry at web.cs.ndsu.nodak.edu> 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 directory ppm_test, type
> python ppm_test.py
> The chunk size commentary occurs only if file.read cannot read enough
> bytes.
> The commentary only occurs for the last file.
> Any ideas?
> Any ideas that don't require getting rid of Windows?
> It's not my option.
Open the files in binary mode. i.e.,
    x=Ppm(file("ff48x32.ppm",'rb'))
    x=Ppm(file("bw48x32.ppm",'rb'))
    x=Ppm(file("bisonfootball.ppm",'rb'))

You were just lucky on the first two files.



More information about the Python-list mailing list