Help: pickle module unable to load "rb" mode files in linux

88888 Dihedral dihedral88888 at googlemail.com
Sun Apr 7 09:43:41 EDT 2013


Surya Kasturi於 2013年4月2日星期二UTC+8下午10時54分25秒寫道:
> Hi, hope you can help me on it..
> 
> 
> 
> with open(pickle_f, 'r') as fhand:
>         obj = pickle.load(fhand)
> 
> 
> 
> 
> This works on linux but not in windows until  I use "rb" mode while creating file object. Surprisingly, the "rb" mode is not working on Linux.. raising EOFError.
> 
Just use a decorator with a pass in parameter about the OS
to wrap the two versions in different platforms.

By the way any function can be saved in a variable  to 
be passed around means that the lambda 1-liner is not 
necessarily required in Python.

In C++,  the sub-classing with virtual membership function 
reload mechanism is the equivalent part.





More information about the Python-list mailing list