tarlib.py

Holger Jannsen holger at phoenix-edv.netzservice.de
Tue Jun 22 06:30:42 EDT 1999


High,

I'd like to untar differnt files with the module from
Clemens Hintze (hi, Clemens, are you watching, uh??).

But there occurs an error:

>>> print os.getcwd()
c:\tmp
>>> os.listdir(os.getcwd())
['filecach', 'copycach', 'unbenannt1', 'Tb1_rpt.sdw', 'netzwerk2.sda', 'netzwerk1.sda',
'nls45.tar']
>>> fp=open('nls45.tar')
>>> print fp
<open file 'nls45.tar', mode 'r' at 7f7520>
>>> tar=tarlib.TAR(fp,cached=0)
>>> for entry in tar:
...     print entry.name
...
Traceback (innermost last):
  File "<stdin>", line 1, in ?
  File "C:\Programme\Python\tarlib.py", line 291, in __getitem__
    return self.__getindex(i)
  File "C:\Programme\Python\tarlib.py", line 639, in __getindex
    entry = self._next()
  File "C:\Programme\Python\tarlib.py", line 487, in _next
    recordcount = (size / RECORDSIZE) + ((size % RECORDSIZE) != 0)
TypeError: bad operand type(s) for /
>>>

[workin' under WinNT, with Python1.52]

What's wrong?

Sorry for asking newbie-questions again:
How could I start extern Gnu-tar inside of python,
or any other program outside of python?
I think 'execfile' is not the thing...

thanx,
Holger




More information about the Python-list mailing list