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


Groups > comp.lang.python > #40827

Re: Unhelpful traceback

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!yojimbo.hack!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail
From John Nagle <nagle@animats.com>
Newsgroups comp.lang.python
Subject Re: Unhelpful traceback
Date Thu, 07 Mar 2013 13:23:13 -0800
Organization A noiseless patient Spider
Lines 28
Message-ID <khb0d7$q74$1@dont-email.me> (permalink)
References <kh9c95$t68$1@dont-email.me> <mailman.3016.1362661824.2939.python-list@python.org>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
Injection-Date Thu, 7 Mar 2013 21:21:43 +0000 (UTC)
Injection-Info mx05.eternal-september.org; posting-host="9357aff9dc287a4774c734240519a392"; logging-data="26852"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+sMIKWnLFOYggioD77vHJt"
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1
In-Reply-To <mailman.3016.1362661824.2939.python-list@python.org>
Cancel-Lock sha1:x1MmX5OkuSa9qs04dY7qfiQkCOo=
Xref csiph.com comp.lang.python:40827

Show key headers only | View raw


On 3/7/2013 5:10 AM, Dave Angel wrote:
> On 03/07/2013 01:33 AM, John Nagle wrote:

>>
>> "infdraw" is a stream from the zip module, create like this:
>>
>>      with inzip.open(zipelt.filename,"r") as infd :
> 
> You probably need a 'rb' rather than 'r', since the file is not ASCII.
> 
>>          self.dofilecsv(infile, infd)
>>
>> This works for data records that are pure ASCII, but as soon as some
>> non-ASCII character comes through, it fails.

   No, the ZIP module gives you back the bytes you
put in.  "rb" is not accepted there:

  File "InfoCompaniesHouse.py", line 197, in dofilezip
    with inzip.open(zipelt.filename,"rb") as infd :            # do this
file
  File "C:\python27\lib\zipfile.py", line 872, in open
    raise RuntimeError, 'open() requires mode "r", "U", or "rU"'
RuntimeError: open() requires mode "r", "U", or "rU"

   "b" for files is about end of line handling (CR LF -> LF), anyway.

					John Nagle

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


Thread

Unhelpful traceback John Nagle <nagle@animats.com> - 2013-03-06 22:33 -0800
  Re: Unhelpful traceback Andrew Berg <bahamutzero8825@gmail.com> - 2013-03-07 00:57 -0600
  Re: Unhelpful traceback Chris Rebert <clp2@rebertia.com> - 2013-03-06 23:04 -0800
  Re: Unhelpful traceback Dave Angel <davea@davea.name> - 2013-03-07 08:10 -0500
    Re: Unhelpful traceback John Nagle <nagle@animats.com> - 2013-03-07 10:42 -0800
      Re: Unhelpful traceback John Nagle <nagle@animats.com> - 2013-03-07 14:13 -0800
        Re: Unhelpful traceback Ian Kelly <ian.g.kelly@gmail.com> - 2013-03-07 15:32 -0700
    Re: Unhelpful traceback John Nagle <nagle@animats.com> - 2013-03-07 13:23 -0800
      Re: Unhelpful traceback Dave Angel <davea@davea.name> - 2013-03-07 19:23 -0500

csiph-web