[New-bugs-announce] [issue13639] UnicodeDecodeError when creating tar.gz with unicode name
Jason R. Coombs
report at bugs.python.org
Tue Dec 20 02:23:24 CET 2011
New submission from Jason R. Coombs <jaraco at jaraco.com>:
python -c "import tarfile; tarfile.open(u'hello.tar.gz', 'w|gz')"
produces
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\jaraco\projects\public\cpython\Lib\tarfile.py", line 1687, in open
_Stream(name, filemode, comptype, fileobj, bufsize),
File "C:\Users\jaraco\projects\public\cpython\Lib\tarfile.py", line 431, in __init__
self._init_write_gz()
File "C:\Users\jaraco\projects\public\cpython\Lib\tarfile.py", line 459, in _init_write_gz
self.__write(self.name + NUL)
File "C:\Users\jaraco\projects\public\cpython\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)
Remove the compression ('|gz') or remove the unicode name or run under Python 3 and the command completes without error.
The error does not occur under Python 3 (even with non-ascii characters), so it should be possible to create a tarfile with a unicode filename on Python 2.7.
This failure is the underlying cause of #11638.
----------
messages: 149896
nosy: jason.coombs
priority: normal
severity: normal
status: open
title: UnicodeDecodeError when creating tar.gz with unicode name
versions: Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13639>
_______________________________________
More information about the New-bugs-announce
mailing list