Arugument list too long on Linux System
Brad Tilley
bradtilley at gmail.com
Mon Nov 1 09:45:22 EST 2004
I was using Python to tar up some files each day in a directory by
calling os.popen("/bin/tar.......).
Everything was working well until the app that generated the files was
set to generate a file every two seconds for nine hours each day (16,200
files each day). After this I began getting this error:
"Argument list too long"
This would happen from the script or from the command line invoking tar
natively. So, I wrote my way around this by using this code:
tar_it = tarfile.open("%s.tar" %real_time, "w")
for root, dirs, files in os.walk(path):
for f in files:
jpg = os.path.splitext(f)
## If the file has a '.jpg' extension add it to the tar file.
if jpg[1] == '.jpg':
tar_it.add(f)
But, I don't understand why I got this error in the first place. I use a
rather robust Debian GNU\Linux system (3.2GHz proc, 2GB DDR400 RAM, 15K
SCSI drives) what causes this type of error? This is not really a Python
issue, but I thought some knowledgeable users on the list might be
willing to explain it.
Thanks,
Brad
More information about the Python-list
mailing list