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 <[email protected]> wrote:
> > On 2009-09-17, Tarek Ziadé <[email protected]> wrote:
> >> On Thu, Sep 17, 2009 at 2:46 PM, Reinout van Rees <[email protected]> 
> >> 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.

Marius Gedminas
-- 
Westheimer's Discovery:
        A couple of months in the laboratory can
        frequently save a couple of hours in the library.

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Distutils-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to