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: 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: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=123.192.32.215; posting-account=5JdMBQoAAABHnS4mjpqEzxnmWtgiiVNw References: 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: 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 Surya Kasturi=E6=96=BC 2013=E5=B9=B44=E6=9C=882=E6=97=A5=E6=98=9F=E6=9C=9F= =E4=BA=8CUTC+8=E4=B8=8B=E5=8D=8810=E6=99=8254=E5=88=8625=E7=A7=92=E5=AF=AB= =E9=81=93=EF=BC=9A > Hi, hope you can help me on it.. >=20 >=20 >=20 > with open(pickle_f, 'r') as fhand: > =C2=A0 =C2=A0 =C2=A0 =C2=A0 obj =3D pickle.load(fhand) >=20 >=20 >=20 >=20 > This works on linux but not in windows until =C2=A0I use "rb" mode while = creating file object. Surprisingly, the "rb" mode is not working on Linux..= raising EOFError. >=20 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=20 be passed around means that the lambda 1-liner is not=20 necessarily required in Python. In C++, the sub-classing with virtual membership function=20 reload mechanism is the equivalent part.