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

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

Date: Mon, 3 Feb 2014 16:53:32 -0800

To: Tomi Ollila

Cc: notmuch@notmuchmail.org

From: W. Trevor King


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.

>   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

Cheers,
Trevor

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

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
signature.asc (application/pgp-signature)

Thread: