Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #42570 > unrolled thread
| Started by | Surya Kasturi <suryak@ieee.org> |
|---|---|
| First post | 2013-04-02 20:24 +0530 |
| Last post | 2013-04-07 06:43 -0700 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.lang.python
Help: pickle module unable to load "rb" mode files in linux Surya Kasturi <suryak@ieee.org> - 2013-04-02 20:24 +0530
Re: Help: pickle module unable to load "rb" mode files in linux 88888 Dihedral <dihedral88888@googlemail.com> - 2013-04-07 06:43 -0700
Re: Help: pickle module unable to load "rb" mode files in linux 88888 Dihedral <dihedral88888@googlemail.com> - 2013-04-07 06:43 -0700
| From | Surya Kasturi <suryak@ieee.org> |
|---|---|
| Date | 2013-04-02 20:24 +0530 |
| Subject | Help: pickle module unable to load "rb" mode files in linux |
| Message-ID | <mailman.1.1364914494.3114.python-list@python.org> |
[Multipart message — attachments visible in raw view] — view raw
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.
Why is this happening?
[toc] | [next] | [standalone]
| From | 88888 Dihedral <dihedral88888@googlemail.com> |
|---|---|
| Date | 2013-04-07 06:43 -0700 |
| Message-ID | <f35b39fd-1940-484b-a522-74fbbb546ea8@googlegroups.com> |
| In reply to | #42570 |
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.
[toc] | [prev] | [next] | [standalone]
| From | 88888 Dihedral <dihedral88888@googlemail.com> |
|---|---|
| Date | 2013-04-07 06:43 -0700 |
| Message-ID | <mailman.242.1365342229.3114.python-list@python.org> |
| In reply to | #42570 |
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.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web