From 84e412613d0db0aa942780a3f1c3f8a954813e5b Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Tue, 4 Feb 2014 22:06:01 +0200 Subject: [PATCH] Re: [PATCH 00/17] nmbug-status: Python-3-compabitility and general refactoring --- 70/7b47e373da7967765b1a3baf98b11603d8753a | 123 ++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 70/7b47e373da7967765b1a3baf98b11603d8753a diff --git a/70/7b47e373da7967765b1a3baf98b11603d8753a b/70/7b47e373da7967765b1a3baf98b11603d8753a new file mode 100644 index 000000000..0121665c8 --- /dev/null +++ b/70/7b47e373da7967765b1a3baf98b11603d8753a @@ -0,0 +1,123 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 9B47F431FBD + for ; Tue, 4 Feb 2014 12:06:16 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id nxdL+jiJk2K4 for ; + Tue, 4 Feb 2014 12:06:10 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id A32BB431FBC + for ; Tue, 4 Feb 2014 12:06:10 -0800 (PST) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id 3B070100033; + Tue, 4 Feb 2014 22:06:02 +0200 (EET) +From: Tomi Ollila +To: "W. Trevor King" +Subject: Re: [PATCH 00/17] nmbug-status: Python-3-compabitility and general + refactoring +In-Reply-To: <20140204191453.GV14197@odin.tremily.us> +References: + + <20140204005331.GQ14197@odin.tremily.us> + + <20140204161142.GS14197@odin.tremily.us> + + <20140204191453.GV14197@odin.tremily.us> +User-Agent: Notmuch/0.17+55~g4397960 (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: quoted-printable +Cc: notmuch@notmuchmail.org +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Tue, 04 Feb 2014 20:06:16 -0000 + +On Tue, Feb 04 2014, "W. Trevor King" wrote: + +>>=20 +>> I don't know what to paste, so i paste this: +>>=20 +>> $ python +>> Python 2.6.6 (r266:84292, Nov 21 2013, 12:39:37)=20 +>> [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2 +>> Type "help", "copyright", "credits" or "license" for more information. +> +> It looks like you left out: +> +> from __future__ import unicode_literals +> +> Can you try again with that line as the first command? +> +>> >>> data =3D {'from': '\u017b'} +>> >>> print(type(data['from']))=20 +>> +> +> which is why your data is a 'str' and not a 'unicode' instance. +> +>> >>> string =3D ' {from}\n'.format(**data) +>> >>> print string +>> \u017b + +Quick update before getting to sleep: + +$ python=20 +Python 2.6.6 (r266:84292, Nov 21 2013, 12:39:37)=20 +[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2 +Type "help", "copyright", "credits" or "license" for more information. +>>> from __future__ import print_function +>>> from __future__ import unicode_literals +>>> data =3D {'from': '\u017b'} +>>> print(type(data['from'])) + +>>> string =3D ' {from}\n'.format(**data) +>>> print(string) + =C5=BB + +so getting success there + +$ PYTHONPATH=3D$PWD/bindings/python/ ./devel/nmbug/nmbug-status +... +Traceback (most recent call last): + File "devel/nmbug/nmbug-status", line 318, in + page.write(database=3Ddb, views=3Dconfig['views']) + File "devel/nmbug/nmbug-status", line 94, in write + self._write_view(database=3Ddatabase, view=3Dview, stream=3Dstream) + File "devel/nmbug/nmbug-status", line 113, in _write_view + self._write_threads(threads=3Dthreads, stream=3Dstream) + File "devel/nmbug/nmbug-status", line 215, in _write_threads + ).format(**message_display_data)) + File "/usr/lib64/python2.6/codecs.py", line 351, in write + data, consumed =3D self.encode(object, self.errors) +UnicodeEncodeError: 'ascii' codec can't encode character u'\u017b' in +position 176: ordinal not in range(128) + + +I'll dig deeper tomorrow. + + +Tomi -- 2.26.2