using tarfile with an open file object

Matthew Thorley ruach at chpc.utah.edu
Wed May 4 16:44:10 EDT 2005


I've been using tarfile like this

import tarfile
tar = tarfile.open('path_to_tar_archive', 'r:gz')


But I need to use it like this:

archive = open('path_to_tar_archive', 'r')
tar = tarfile.open(archive.readlines())

or something similar. In essence I need to use tarfile to manipulate an
already open file object. I searched in the docs but didn't find
anything. Maybe I just over looked the obvious.

Does any one know how to do this?

Thanks
-matthew



More information about the Python-list mailing list