Issue #266 new

Running 'setup.py register --list-classifiers' with Python 3 fails.

Jurko Gospodnetić
created an issue

[Issue detected with distutils 0.6.24, on Windows XP x86 SP3. Do not know which version or milestone to assign to this issue.]

distutils/command/register.py does the following to fetch the classifier listing:

{{{ def classifiers(self): ''' Fetch the list of classifiers from the server. ''' url = self.repository+'?:action=list_classifiers' response = urllib.request.urlopen(url) log.info(response.read()) }}}

This however fails because response.read() returns a bytes object and log.info() expects a unicode string parameter.

The proper solution would be to detect the exact character set declared in the returned HTTP response or do some auto-detection or just try using 'ascii' or 'utf-8' encoding.

An imperfect quick-fix (but still better than the current state) could be to do this: {{{ def classifiers(self): ''' Fetch the list of classifiers from the server. ''' url = self.repository+'?:action=list_classifiers' response = urllib.request.urlopen(url) encoding = response.headers.get_charsets()[0] log.info(response.read().decode(encoding)) }}}

Hope this helps.

Best regards, Jurko Gospodnetić

Comments (0)

  1. Log in to comment