On Tue, 2007-04-03 at 13:26 -0400, Boudreau, Emile wrote: > I am trying to extract one file from a tarball, without success. This > is the code I'm using to open the tarball and extract the file: > > tar = tarfile.open(component+'-win32-app-'+bestVersion+'-dev.tar.gz', > 'r') > extractedFile = tar.extractfile('symbols.xml') > > And this is my error: > > Traceback (most recent call last): > File "C:\CognosInstalls\AutoTest\PollDir.py", line 121, in <module> > main() > File "C:\CognosInstalls\AutoTest\PollDir.py", line 119, in main > extract('c:\\', 'I:\\daily\\'+components[i], components[i]) > File "C:\CognosInstalls\AutoTest\PollDir.py", line 27, in extract > filelike = tar.extractfile('symbols.xml') > File "C:\Python25\lib\tarfile.py", line 1488, in extract > tarinfo = self.getmember(member) > File "C:\Python25\lib\tarfile.py", line 1171, in getmember > raise KeyError("filename %r not found" % name) > KeyError: "filename 'symbols.xml' not found" > > I know that the tarball contants this file "symbols.xml"
What does tar.getnames() return? -Carsten -- http://mail.python.org/mailman/listinfo/python-list