[New-bugs-announce] [issue25997] Tarfile.add with bytes path is failling

Patrik Dufresne report at bugs.python.org
Sat Jan 2 14:53:25 EST 2016


New submission from Patrik Dufresne:

With python 3.4, Tarfile doesn't properly support adding a files with bytes path. Only unicode is supported. It's failing with exception similar to:

    tar.add(os.path.join(dirpath, filename), filename)
  File "/usr/lib/python3.4/tarfile.py", line 1907, in add
    tarinfo = self.gettarinfo(name, arcname)
  File "/usr/lib/python3.4/tarfile.py", line 1767, in gettarinfo
    arcname = arcname.replace(os.sep, "/")
TypeError: expected bytes, bytearray or buffer compatible object

It uses os.sep, and u"/". Instead, it should use something like posixpath.py:_get_sep(path).

----------
components: Unicode
messages: 257355
nosy: Patrik Dufresne, ezio.melotti, haypo
priority: normal
severity: normal
status: open
title: Tarfile.add with bytes path is failling
type: behavior
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25997>
_______________________________________


More information about the New-bugs-announce mailing list