Error compressing tar file
Mike
miguelcoam at gmail.com
Sun Mar 2 20:11:19 EST 2014
El domingo, 2 de marzo de 2014 21:38:49 UTC-3, Mike escribió:
> Hello,
>
> I have the script that make a backup file (this process is ok), but now i wish compress the file on tar file format. But i have problem syntax in the line of the tar function.
>
>
>
> The error is
>
>
>
> [root at master ~]# python bkp_db.py
>
> File "bkp_db.py", line 19
>
> tar = tarfile.open(dumpfile)+'.tar.gz','w:gz')
>
> ^
>
>
>
> Note: The 'dumpfile' is the variable for my dump generate with format db_02-27-14
>
>
>
> ......
>
> tar = tarfile.open(dumpfile)+'.tar.gz','w:gz')
>
> tar.add(os.path.join(dumpfile), arcname=dumpfile)
>
> tar.close()
>
> ........
>
>
>
> Wath is the correct sintax?
>
>
>
>
>
> Thanks.
Hello,
without ")" i have the same sintax error:
[root at master ~]# python bkp_db.py
Traceback (most recent call last):
File "bkp_db.py", line 19, in <module>
tar = tarfile.open(dumpfile + '.tar.gz','w:gz')
TypeError: unsupported operand type(s) for +: 'file' and 'str'
Thanks.
More information about the Python-list
mailing list