[Distutils] non-ascii characters in long description
marius at pov.lt
Thu Sep 17 20:31:54 CEST 2009
On Thu, Sep 17, 2009 at 03:46:27PM +0200, Tarek Ziadé wrote:
> On Thu, Sep 17, 2009 at 3:31 PM, Reinout van Rees <reinout at vanrees.org> wrote:
> > On 2009-09-17, Tarek Ziadé <ziade.tarek at gmail.com> wrote:
> >> On Thu, Sep 17, 2009 at 2:46 PM, Reinout van Rees <reinout at vanrees.org> wrote:
> >>> I have non-ascii characters in my long description (as I just fixed a bug in
> >>> my package that had to do with non-ascii characters). I did all the right
> >>> things like opening my changelog and readme with "codecs.open(...,
> >>> encoding='utf-8')" and so. But I ran into the following setuptools problem:
> >>> When calling "python setup.py --long-description", setuptools effectively does
> >>> a "print long_description", which works with a utf8 string, but fails with a
> >>> unicode string.
> >>> When uploading to pypi, setuptools calls unicode() on my long description,
> >>> which fails with a utf8 string and works with a unicode string.
> >> Mmm, I've fixed that problem in Distutils code in 2.6+ IIRC
> > Traceback (most recent call last):
> > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/command/register.py", line 257, in post_to_server
> > value = unicode(value).encode("utf-8")
> > UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 6030:
> > ordinal not in range(128)
> Yes that's the one I've fixed. You have to backport a fix in your
> setup.py if python < 2.6
I think you mean <= 2.6; I was seeing this problem with 2.6.2.
It's good to know this is going to be fixed in 2.7.
> You can register.patch post_to_server to pre-process all values in the
> "data" argument, so they are
> all in unicode, then call the real one.
This sounds mysterious; I'll wait and look at Reinout's package in a
while (assuming he choses to do this).
> That's hackish, but at least unicode() won't break anymore when called
> on already decoded strings eg unicode objects.
A couple of months in the laboratory can
frequently save a couple of hours in the library.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: Digital signature
More information about the Distutils-SIG