[PATCH 00/17] nmbug-status: Python-3-compabitility and general refactoring

Tomi Ollila tomi.ollila at iki.fi
Tue Feb 4 02:30:30 PST 2014


On Tue, Feb 04 2014, "W. Trevor King" <wking at tremily.us> wrote:

> On Mon, Feb 03, 2014 at 11:10:23PM +0200, Tomi Ollila wrote:
>>     data['message-id-term'] = 'id:"{}"'.format(value)
>> ValueError: zero length field name in format
>
> Oops, Python 2.6 still needs explicit indexes ('{0}', not '{}').  It's
> an easy fix, so I'll queue it for v2.  You're still going to need
> Python 2.7 or greater for collections.OrderedDict().  We could word
> around that too, but do we really care about 2.6?  I don't expect that
> the installed nmbug-status userbase is so large and backward that
> upgrading to 2.7 will be that hard ;).  2.6 isn't even getting
> security fixes anymore [1], so I think it's time to migrate :p.

Probably not many cares about 2.6; I already use argparse and I can add
that OrderedDict() too. Still {0} is easy enough to do :D. I am running
this notmuch & nmbug in Scientific Linux 6.2 machine which has python 2.6
-- and this is the only machine where I can review your nmbug-status
changes ;)

>>   File "devel/nmbug/nmbug-status", line 197, in _write_threads
>>     ).format(**message_display_data))
>>   File "/usr/lib64/python2.6/codecs.py", line 351, in write
>>     data, consumed = self.encode(object, self.errors)
>> UnicodeEncodeError: 'ascii' codec can't encode character u'\u017b' in
>>   position 176: ordinal not in range(128)
>
> Hmm.  __future__'s unicode_literals should be giving us a Unicode
> target, so I'm not sure why we'd have trouble injecting Unicode.  This
> works fine for me on Python 2.7 and 3.3.  Maybe you just have a funky
> encoding?  What is your:
>
>   $ locale
>   LANG=en_US.UTF-8
>>   $ python -c 'import locale, sys; print(locale.getpreferredencoding() or sys.getdefaultencoding())'
>   UTF-8

LANG=en_US.UTF-8
all other LC_* variables en_US.UTF-8 except
LC_TIME=en_GB.utf8
LC_ALL empty (naturally)

python -c 'import locale; print(locale.getpreferredencoding())'
UTF-8
python -c 'import sys; print(sys.getdefaultencoding())'
ascii


anyway, if this doesn't resolve out and there is no resistance to require
python 2.7 (that means from David) I can hack around this to get this
reviewed.

>
> Cheers,
> Trevor

Tomi

>
> [1]: http://www.python.org/download/releases/2.6.9/


More information about the notmuch mailing list