On 02/11/2016 09:31 AM, Ulli Horlacher wrote:
> https://docs.python.org/2/library/tarfile.html says:
>
>  tarfile.open(name=None, mode='r', fileobj=None, bufsize=10240, **kwargs)
>
>     Return a TarFile object for the pathname name.
>
>
> (How) can I read a tar file from a (tcp) socket?
> I do not have a pathname but a socket object from socket.create_connection

# First you construct a file object with makefile.

fo = socket.makefile()

# Then you use the fileobj argument with tarfile.open.

tarfile.open(mode='r', fileobj = fo)

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to