On Sun, 02 Mar 2014 17:11:19 -0800, Mike wrote: > without ")" i have the same sintax error: > > [root@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'
That is not a syntax error. It is a type error. You cannot add a file object and a string object together. Please inspect the value of dumpfile. You are treating it as if it were a string, but it looks like it is an open file object. I think that you probably expect this: dumpfile = "path to some file" tarfile.open(dumpfile + '.tar.gz','w:gz') but what you actually have is probably something like this: dumpfile = open("path to some file") tarfile.open(dumpfile + '.tar.gz','w:gz') -- Steven D'Aprano http://import-that.dreamwidth.org/ -- https://mail.python.org/mailman/listinfo/python-list