Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81743
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!bcyclone05.am1.xlned.com!bcyclone05.am1.xlned.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.87.MISMATCH!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <torriem+gmail@torriefamily.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'subject:: [': 0.04; 'encoding': 0.05; 'subject:Python': 0.06; 'python3': 0.07; 'utf-8': 0.07; 'uses.': 0.09; 'posted': 0.15; 'ascii,': 0.16; 'bytes).': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'subject:Dev': 0.16; 'subject:Unicode': 0.16; 'subject:exception': 0.16; 'traceback.': 0.16; 'wrote:': 0.18; 'subject:] ': 0.20; 'header:User-Agent:1': 0.23; 'byte': 0.24; 'unicode': 0.24; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'errors': 0.30; "i'm": 0.30; 'usually': 0.31; 'default,': 0.31; 'file': 0.32; 'supposed': 0.32; 'open': 0.33; 'says': 0.33; "can't": 0.35; 'something': 0.35; 'but': 0.35; 'scheme': 0.36; 'error.': 0.37; 'message-id:@gmail.com': 0.38; 'handle': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'skip:u 10': 0.60; 'tell': 0.60; 'full': 0.61; 'invalid': 0.68; 'default': 0.69; 'do:': 0.91; 'whereas': 0.91 |
| X-Virus-Scanned | amavisd-new at torriefamily.org |
| Date | Sun, 30 Nov 2014 21:33:28 -0700 |
| From | Michael Torrie <torriem@gmail.com> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131118 Thunderbird/17.0.11 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: [Python-Dev] Unicode decode exception |
| References | <CAKcrOwft6+6TBCpcLoG8Z4fcbpjcECUmNd4Wu-NhRbHDwr1V-g@mail.gmail.com> <CAPTjJmqbUm8g0qszy-RamDQrDQgb1O3ievY+86dRJO=9Jr5weA@mail.gmail.com> <CAKcrOweVZ4-KUpW4a428zO_3_43-n5HA=YnXrAuFx3KyWkcmSA@mail.gmail.com> |
| In-Reply-To | <CAKcrOweVZ4-KUpW4a428zO_3_43-n5HA=YnXrAuFx3KyWkcmSA@mail.gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 7bit |
| 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 | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.16446.1417408427.18130.python-list@python.org> (permalink) |
| Lines | 16 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1417408427 news.xs4all.nl 2910 [2001:888:2000:d::a6]:58352 |
| X-Complaints-To | abuse@xs4all.nl |
| X-Received-Bytes | 3619 |
| X-Received-Body-CRC | 3953621515 |
| Xref | csiph.com comp.lang.python:81743 |
Show key headers only | View raw
On 11/30/2014 09:19 PM, balaji marisetti wrote:
> The default encoding is "UTF-8". It works if I do:
>
> with open("filename", errors="ignore") as f:
> ....
>
> So I think Python2, by default, ignores all errors whereas Python3 doesn't
Do you mean that the file is supposed to be utf-8 but isn't? Because if
it is, you need to tell open about it in Python3 to make sure that's the
decoding scheme it uses. Otherwise you will see this decode error.
Also I'm not sure you posted the full traceback. Usually a
UnicodeDecodeError says something about an invalid byte while using a
specific unicode decoding scheme (say, ASCII, which can't handle utf-8
bytes).
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: [Python-Dev] Unicode decode exception Michael Torrie <torriem@gmail.com> - 2014-11-30 21:33 -0700 Re: [Python-Dev] Unicode decode exception wxjmfauth@gmail.com - 2014-12-01 23:28 -0800
csiph-web