UnicodeDecodeError on docutils with zest.releaser

when running zest.releaser I'm getting the following error:

INFO: This package is registered on PyPI.
Register and upload to pypi (Y/n)? 
INFO: Running: /home/hvelarde/buildout.python/python-2.7/bin/python setup.py register -r pypi sdist --formats=zip upload -r pypi
Showing first few lines...
running register
running egg_info
writing requirements to src/collective.prettydate.egg-info/requires.txt
writing src/collective.prettydate.egg-info/PKG-INFO
writing namespace_packages to src/collective.prettydate.egg-info/namespace_packages.txt
Showing last few lines...
    return [nodes.Text(unescape(text), rawsource=unescape(text, 1))]
  File "/home/hvelarde/.buildout/eggs/docutils-0.12-py2.7.egg/docutils/nodes.py", line 344, in __new__
    return reprunicode.__new__(cls, data)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)

any hints?

0xc3 is the code point for ä, so a quick grep for that character could help. Depending on the file the a with umlaut is you will be able to fix it somehow, or at least you would be able then to report a more specific bug :slight_smile:

I have no ä on my package so I ended changing the default encoding on the Python I use on my virtual environments for development to utf-8.

I hope that will hide the issue and stop making me lose my time every time I have to make a release.


In the past we have tried to fix this, and I think there is still code that tries to work around this possible failure, but it is a really hairy one. Maybe even more so when trying to fix it in several python versions. Come to think of it, I think we tried fixing this because it went wrong a while ago when using zest.releaser to release zest.releaser... The changelog file had a name with a non-ascii character and this tripped up either our release command or maybe already a plain setup.py call. We tried some funky stuff in our own setup.py, but ripped it out because it always failed at one point or another.

It goes wrong while executing this command and printing the last few lines of it:

/home/hvelarde/buildout.python/python-2.7/bin/python setup.py register -r pypi sdist --formats=zip upload -r pypi

I wonder if that command also fails if you call it manually on the command line. It may already fail when you do 'python setup.py --long-description', or when parsing that output with a rst2html command, like the longtest command that zest.releaser gives.

If you feel like debugging, check show_last_lines:

which is called from this line:

Maybe we should not use 'print line' but something else.

Is this on a public package, so that I can have a look?

yes, I think is a similar problem as I always spell my name with an "é"
instead of an "e".

the command along doesn't fail, so every time I got the error I had to
run "python setup.py register .. upload ..." and then ran the
postrelease script.

the package is public, yes:

specifically, check this file:

best regards

Weird: when I try it, it works just fine. I have created three test releases on the test pypi server:

The first one was with docutils 0.10, the second with 0.12, the last one without docutils as it is not needed by the core of zest.releaser. All with the current master of zest.releaser, which is the same as 3.52.

I am using this in a buildout to install zest.releaser and friends (one of the friends pulls in docutils apparently):

recipe = zc.recipe.egg
eggs =