Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #42999

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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <dihedral88888@googlemail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'c++,': 0.07; 'decorator': 0.09; 'obj': 0.09; 'parameter': 0.09; 'subject:files': 0.09; 'subject:module': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.11; 'subject:Help': 0.11; 'windows': 0.15; 'lambda': 0.16; 'reload': 0.16; '\xc2\xa0i': 0.16; 'variable': 0.18; 'mechanism': 0.19; 'cc:addr:python.org': 0.22; 'creating': 0.23; 'header:User- Agent:1': 0.23; 'versions': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'equivalent': 0.26; 'pass': 0.26; 'header:In- Reply-To:1': 0.27; 'function': 0.29; 'mode': 0.30; 'membership': 0.31; 'object.': 0.31; 'file': 0.32; 'linux': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'raising': 0.36; 'hi,': 0.36; 'virtual': 0.37; 'two': 0.37; 'from:addr:googlemail.com': 0.38; 'subject:" ': 0.39; 'hope': 0.61; 'different': 0.65
X-Received by 10.49.35.111 with SMTP id g15mr250841qej.15.1365342221630; Sun, 07 Apr 2013 06:43:41 -0700 (PDT)
Newsgroups comp.lang.python
Date Sun, 7 Apr 2013 06:43:41 -0700 (PDT)
In-Reply-To <mailman.1.1364914494.3114.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=123.192.32.215; posting-account=5JdMBQoAAABHnS4mjpqEzxnmWtgiiVNw
References <mailman.1.1364914494.3114.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 123.192.32.215
MIME-Version 1.0
Subject Re: Help: pickle module unable to load "rb" mode files in linux
From 88888 Dihedral <dihedral88888@googlemail.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Message-ID <mailman.242.1365342229.3114.python-list@python.org> (permalink)
Lines 28
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1365342229 news.xs4all.nl 6986 [2001:888:2000:d::a6]:34405
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:42999

Show key headers only | View raw


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.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

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

csiph-web