tarfile : read from a socket?

Random832 random832 at fastmail.com
Thu Feb 11 16:23:52 EST 2016


On Thu, Feb 11, 2016, at 11:41, Ulli Horlacher wrote:
> 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?

Try this:

while True:
    member = taro.next()
    if member is None: break
    print('extracting "%s"' % member.name)
    taro.extract(member)


More information about the Python-list mailing list