This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jaraco
Recipients eric.araujo, jaraco, tarek
Date 2011-11-11.11:49:09
SpamBayes Score 1.4377388e-14
Marked as misclassified No
Message-id <1321012152.18.0.159938975919.issue13383@psf.upfronthosting.co.za>
In-reply-to
Content
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().
History
Date User Action Args
2011-11-11 11:49:12jaracosetrecipients: + jaraco, tarek, eric.araujo
2011-11-11 11:49:12jaracosetmessageid: <1321012152.18.0.159938975919.issue13383@psf.upfronthosting.co.za>
2011-11-11 11:49:11jaracolinkissue13383 messages
2011-11-11 11:49:09jaracocreate