tarfile : read from a socket?
Ulli Horlacher
framstag at rus.uni-stuttgart.de
Thu Feb 11 11:41:43 EST 2016
Ulli Horlacher <framstag at rus.uni-stuttgart.de> wrote:
> With
>
> taro = tarfile.open(fileobj=sock.makefile('w',kB64),mode='w|')
>
> I get no more error.
Of course, this is the writing client.
Now I have a small problem with the reading client.
This code works so far:
sfo = sock.makefile('r')
taro = tarfile.open(fileobj=sfo,mode='r|')
taro.extractall(path=edir)
But it does not writes anything to the terminal to inform the user.
When I use:
for member in taro.getmembers():
print('extracting "%s"' % member.name)
taro.extract(member)
I get the error:
File "/usr/lib/python2.7/tarfile.py", line 556, in seek
raise StreamError("seeking backwards is not allowed")
Of course, a stream is not seekable.
Any ideas?
--
Ullrich Horlacher Server und Virtualisierung
Rechenzentrum IZUS/TIK E-Mail: horlacher at tik.uni-stuttgart.de
Universitaet Stuttgart Tel: ++49-711-68565868
Allmandring 30a Fax: ++49-711-682357
70550 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/
More information about the Python-list
mailing list