New submission from Jason R. Coombs <jar...@jaraco.com>: If the version or name passed to distutils.core.setup is unicode, this results in a UnicodeDecodeError. Consider this setup.py:
from distutils.core import setup setup( name=u'issue13381', version=u'1.0', modules=['setup.py'], ) Run it with python2.7 setup.py sdist --format gztar and you'll get the following: C:\Python\lib\distutils\dist.py:267: UserWarning: Unknown distribution option: 'modules' warnings.warn(msg) running sdist running check warning: check: missing required meta-data: url warning: check: missing meta-data: either (author and author_email) or (maintainer and maintainer_email) must be supplied warning: sdist: manifest template 'MANIFEST.in' does not exist (using default file list) warning: sdist: standard file not found: should have one of README, README.txt writing manifest file 'MANIFEST' copying files to foo-1.0... copying setup.py -> foo-1.0 Creating tar archive Traceback (most recent call last): File "C:\Users\jaraco\bugs\setup.py", line 6, in <module> modules=['setup.py'], File "C:\Python\lib\distutils\core.py", line 152, in setup dist.run_commands() File "C:\Python\lib\distutils\dist.py", line 953, in run_commands self.run_command(cmd) File "C:\Python\lib\distutils\dist.py", line 972, in run_command cmd_obj.run() File "C:\Python\lib\distutils\command\sdist.py", line 168, in run self.make_distribution() File "C:\Python\lib\distutils\command\sdist.py", line 451, in make_distribution owner=self.owner, group=self.group) File "C:\Python\lib\distutils\cmd.py", line 392, in make_archive owner=owner, group=group) File "C:\Python\lib\distutils\archive_util.py", line 237, in make_archive filename = func(base_name, base_dir, **kwargs) File "C:\Python\lib\distutils\archive_util.py", line 101, in make_tarball tar = tarfile.open(archive_name, 'w|%s' % tar_compression[compress]) File "C:\Python\lib\tarfile.py", line 1687, in open _Stream(name, filemode, comptype, fileobj, bufsize), File "C:\Python\lib\tarfile.py", line 431, in __init__ self._init_write_gz() File "C:\Python\lib\tarfile.py", line 459, in _init_write_gz self.__write(self.name + NUL) File "C:\Python\lib\tarfile.py", line 475, in __write self.buf += s UnicodeDecodeError: 'ascii' codec can't decode byte 0x8b in position 1: ordinal not in range(128) Since tarfile doesn't support unicode filenames, distutils should encode the generated filename. issue8396 suggests encoding using sys.getfilesystemencoding(). ---------- assignee: tarek components: Distutils messages: 147427 nosy: eric.araujo, jason.coombs, tarek priority: normal severity: normal status: open title: UnicodeDecodeError in distutils.core.setup when version is unicode versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13383> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com