Tarfile module error

Beowulf beowulf40 at lycos.com
Fri Jan 21 10:49:31 EST 2005


Hello,

I'm using Python to automate admin tasks on my job. We use Windoze
2000 as desktop platform. When executing this daily backup scripts I
get the following error:

Traceback (most recent call last):
  File "C:\UTILS\backup.py", line 8, in ?
    TarFileBackup = tarfile.open(NewBackupFilename, 'w:bz2')
  File "C:\Python23\lib\tarfile.py", line 875, in open
    return func(name, filemode, fileobj)
  File "C:\Python23\lib\tarfile.py", line 980, in bz2open
    raise ReadError, "not a bzip2 file"
tarfile.ReadError: not a bzip2 file
----
Here's the code:
----
import tarfile
from datetime import datetime

DirBackup = r'\\skpdc01\Backups'
DirOrig = r'C:\WUTemp'

NewBackupFilename = DirBackup + '\\' + '%s' % (datetime.today()) +
'.tar.bz2'
TarFileBackup = tarfile.open(NewBackupFilename, 'w:bz2')
TarFileBackup.add(DirOrig)
TarFileBackup.close()
----
What am I doing wrong? From the error message I gues the library is
expecting the bzip file to exists, but I am explicitly open it whit
'w:bz2' Any ideas?

Thanks.



More information about the Python-list mailing list