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 chaica_
Recipients chaica_
Date 2015-02-12.11:19:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1423739998.49.0.706967373594.issue23453@psf.upfronthosting.co.za>
In-reply-to
Content
I'm trying to use a tar stream to a Python tarfile object but each time I do have a  TypeError: can't concat bytes to str error

Here is my test:
-----8<-----
#!/usr/bin/python3.4

import tarfile
import sys

tarobj = tarfile.open(mode='r|', fileobj=sys.stdin)
print(tarobj)
tarobj.close()
-----8<-----


$ tar cvf test.tar.gz tests/
tests/
tests/foo1
tests/foo/
tests/foo/bar
$ tar -O -xvf test.tar | ./tarstream.py
tests/
tests/foo1
tests/foo/
tests/foo/bar
Traceback (most recent call last):
  File "./tarstream.py", line 6, in <module>
    tarobj = tarfile.open(mode='r|', fileobj=sys.stdin)
  File "/usr/lib/python3.4/tarfile.py", line 1578, in open
    t = cls(name, filemode, stream, **kwargs)
  File "/usr/lib/python3.4/tarfile.py", line 1470, in __init__
    self.firstmember = self.next()
  File "/usr/lib/python3.4/tarfile.py", line 2249, in next
    tarinfo = self.tarinfo.fromtarfile(self)
  File "/usr/lib/python3.4/tarfile.py", line 1082, in fromtarfile
    buf = tarfile.fileobj.read(BLOCKSIZE)
  File "/usr/lib/python3.4/tarfile.py", line 535, in read
    buf = self._read(size)
  File "/usr/lib/python3.4/tarfile.py", line 543, in _read
    return self.__read(size)
  File "/usr/lib/python3.4/tarfile.py", line 569, in __read
    self.buf += buf
TypeError: can't concat bytes to str

Regards,
Carl Chenet
History
Date User Action Args
2015-02-12 11:19:58chaica_setrecipients: + chaica_
2015-02-12 11:19:58chaica_setmessageid: <1423739998.49.0.706967373594.issue23453@psf.upfronthosting.co.za>
2015-02-12 11:19:58chaica_linkissue23453 messages
2015-02-12 11:19:58chaica_create