Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #63924
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:application': 0.07; 'directive.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:script': 0.09; 'python': 0.11; 'codec': 0.16; 'ordinal': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:when': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'producing': 0.19; 'example': 0.22; 'shell': 0.22; 'header:User-Agent:1': 0.23; 'byte': 0.24; 'skip:l 30': 0.24; 'fine': 0.24; 'environment': 0.24; 'script': 0.25; 'skip:" 40': 0.26; 'skip:" 20': 0.27; 'header:X-Complaints- To:1': 0.27; 'tried': 0.27; '(like': 0.30; "i'm": 0.30; 'file': 0.32; 'me?': 0.32; 'stuff': 0.32; 'subject:from': 0.34; "can't": 0.35; 'but': 0.35; 'add': 0.35; 'e.g.': 0.38; 'to:addr:python- list': 0.38; 'skip:. 10': 0.39; 'to:addr:python.org': 0.39; 'changed': 0.39; 'received:org': 0.40; 'called': 0.40; 'skip:u 10': 0.60; 'read': 0.60; '26,': 0.68; 'florian': 0.84; 'infamous': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Peter Otten <__peter__@web.de> |
| Subject | Re: Encoding trouble when script called from application |
| Date | Tue, 14 Jan 2014 18:43:57 +0100 |
| Organization | None |
| References | <11036720.dCfMmLrdqv@horus> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="ISO-8859-1" |
| Content-Transfer-Encoding | 7Bit |
| X-Gmane-NNTP-Posting-Host | p508498d1.dip0.t-ipconnect.de |
| User-Agent | KNode/4.7.3 |
| 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.5469.1389721451.18130.python-list@python.org> (permalink) |
| Lines | 51 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1389721451 news.xs4all.nl 2889 [2001:888:2000:d::a6]:50098 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:63924 |
Show key headers only | View raw
Florian Lindner wrote: > Hello! > > I'm using python 3.2.3 on debian wheezy. My script is called from my mail > delivery agent (MDA) maildrop (like procmail) through it's xfilter > directive. > > Script works fine when used interactively, e.g. ./script.py < testmail but > when called from maildrop it's producing an infamous UnicodeDecodeError: > > File "/home/flindner/flofify.py", line 171, in main > mail = sys.stdin.read() > File "/usr/lib/python3.2/encodings/ascii.py", line 26, in decode > return codecs.ascii_decode(input, self.errors)[0] > > Exception for example is always like > > UnicodeDecodeError: 'ascii' codec can't decode byte 0x82 in position 869: > ordinal not in range(128) UnicodeDecodeError: 'ascii' codec can't decode > byte 0xc3 in position 1176: ordinal not in range(128) UnicodeDecodeError: > 'ascii' codec can't decode byte 0x8c in position 846: ordinal not in > range(128) > > I read mail from stdin "mail = sys.stdin.read()" > > Environment when called is: > > locale.getpreferredencoding(): ANSI_X3.4-1968 > environ["LANG"]: C > > System environment when using shell is: > > ~ % echo $LANG > en_US.UTF-8 > > As far as I know when reading from stdin I don't need an decode(...) call, > since stdin has a decoding. I also tried some decoding/encoding stuff but > changed nothing. > > Any ideas to help me? I known nothing about maildrop, but found > add "import LANG" to .maildropfilter. in this thread: <http://courier-mail-server.10983.n7.nabble.com/Maildrop-behaviour-change- td18610.html>
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Encoding trouble when script called from application Peter Otten <__peter__@web.de> - 2014-01-14 18:43 +0100
csiph-web