[Distutils] non-ascii characters in long description

Reinout van Rees reinout at vanrees.org
Thu Sep 17 14:46:23 CEST 2009

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.

So if I do long_description=my_unicode_string, --long-description fails and if
I do long_description=my_unicode_string.encode('utf-8') the pypi upload

In the end I used the dirty UltraMagicString() hack from

Any suggestions?


Reinout van Rees - reinout at vanrees.org - http://reinout.vanrees.org
Software developer at http://www.thehealthagency.com
"Military engineers build missiles. Civil engineers build targets"

More information about the Distutils-SIG mailing list