Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #56405
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <andipersti@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'encoding': 0.05; 'binary': 0.07; 'received:192.168.178': 0.07; 'sys': 0.07; 'msg': 0.09; 'subject:parsing': 0.09; 'python': 0.11; 'andreas': 0.16; 'bye,': 0.16; 'received:192.168.178.20': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'import': 0.22; 'header:User-Agent:1': 0.23; "i've": 0.25; 'skip:" 20': 0.27; 'header:In-Reply-To:1': 0.27; 'url:python': 0.33; 'skip:# 10': 0.33; 'subject:from': 0.34; 'received:google.com': 0.35; 'there': 0.35; 'url:org': 0.36; 'message-id:@gmail.com': 0.38; 'url:library': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'read': 0.60; 'url:3': 0.61; 'pardon': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=p1FpkS9MYAfSgkGQBdchBlWW3T08LG5FzfgIMAtPI2M=; b=T+j2E+p2aH/Ow76Y35uP9rKC+UUVmJwDPUqaNIhdhpWVcA6XGNGuZ7woAVXG4bToIE WzMjwEllRZ6YFxixsxGSft12m73Rtt450Mh/4oEXjlyhaoxzQcGbim679E0GMlTzowv7 c98ccNp6tCPuMD0N9y19BEbcj9s1RwQZ4IitHya9jlGIPNsZE6r4UlSdt7h7UQprlS7m ZXjO+4H65YSHKbJzL1oklFaELCOu3Bbc5EWOgsVCYUjpuAebQaPWiYhOHZbj1iLc5JEH 2Hy/O/3jg7DAjeB2ZHqs8RI12j7UjaECS4s/SFL+W6rFwVHZgHEdEdOdihJ0fUmYfPva PqEQ== |
| X-Received | by 10.204.226.135 with SMTP id iw7mr1853105bkb.4.1381242294146; Tue, 08 Oct 2013 07:24:54 -0700 (PDT) |
| Date | Tue, 08 Oct 2013 16:24:52 +0200 |
| From | Andreas Perstinger <andipersti@gmail.com> |
| User-Agent | Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: parsing email from stdin |
| References | <5253F884.7020306@rece.vub.ac.be> |
| In-Reply-To | <5253F884.7020306@rece.vub.ac.be> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| 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.855.1381242709.18130.python-list@python.org> (permalink) |
| Lines | 20 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1381242710 news.xs4all.nl 15913 [2001:888:2000:d::a6]:52071 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:56405 |
Show key headers only | View raw
On 08.10.2013 14:20, Antoon Pardon wrote: > As I don't know what encoding these messages will be in, I thought it > would be prudent to read stdin as binary data. > > Using python 3.3 on a debian box I have the following code. > > #!/usr/bin/python3 > > import sys > from email import message_from_file > > sys.stdin = sys.stdin.detach() > msg = message_from_file(sys.stdin) Looking at the docs, I've found there is also "message_from_binary_file" which works for me with your code. http://docs.python.org/3/library/email.parser.html#email.message_from_binary_file Bye, Andreas
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: parsing email from stdin Andreas Perstinger <andipersti@gmail.com> - 2013-10-08 16:24 +0200
csiph-web