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


Groups > comp.lang.python > #40712

Re: Unhelpful traceback

References <kh9c95$t68$1@dont-email.me>
Date 2013-03-06 23:04 -0800
Subject Re: Unhelpful traceback
From Chris Rebert <clp2@rebertia.com>
Newsgroups comp.lang.python
Message-ID <mailman.2982.1362639844.2939.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, Mar 6, 2013 at 10:33 PM, John Nagle <nagle@animats.com> wrote:
> Here's a traceback that's not helping:
<snip>
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xa3' in
> position 14: ordinal not in range(128)
<snip>
> The program is converting some .CSV files that come packaged in .ZIP
> files.  The files are big, so rather than expanding them, they're
> read directly from the ZIP files and processed through the ZIP
> and CSV modules.
<snip>
> This works for data records that are pure ASCII, but as soon as some
> non-ASCII character comes through, it fails.

I'd recommend using the `unicodecsv` package, which, unlike the std
lib `csv` module, is properly Unicode-compatible:
https://pypi.python.org/pypi/unicodecsv

Cheers,
Chris

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