Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #40827
| From | John Nagle <nagle@animats.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Unhelpful traceback |
| Date | 2013-03-07 13:23 -0800 |
| Organization | A noiseless patient Spider |
| Message-ID | <khb0d7$q74$1@dont-email.me> (permalink) |
| References | <kh9c95$t68$1@dont-email.me> <mailman.3016.1362661824.2939.python-list@python.org> |
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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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