'name is too long' (tarfile, python 2.2, Debian Woody)

Helmut Jarausch jarausch at skynet.be
Wed Aug 20 04:25:17 EDT 2003


Lars Behrens wrote:
> Hi, Pythonistas!
> 
> I'm quite new to Python and have a problem with a simple backup script.
> 
> This code:
> 
>  tar = tarfile.open('/home/lars/test.tar.gz', 'w:gz')
>  tar.addfile('/home/lars')
> 
> brings up the following error message:
> 
> **********************************************************************
> /usr/lib/python2.2/site-packages/tarfile.py in addfile(self, tarinfo, 
> fileobj)
>    1289
>    1290                 if not prefix or len(name) > LENGTH_NAME:
> -> 1291                     raise ValueError, "name is too long (>%d)" \
>    1292                                       % (LENGTH_NAME)
>    1293
> 
> ValueError: name is too long (>100)
> **********************************************************************
> 

The standard tar format allows only names (i.e. complete path) of 100
characters. So in your '/home/lars' are names (fully expanded) which are
longer.
Please have a look at the documentation of tarfile, there is an option
to store extended path names. Most other tar programs (like gnu-tar)
support these, as well.


-- 
Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany





More information about the Python-list mailing list