473,383 Members | 1,885 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Arugument list too long on Linux System

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
Jul 18 '05 #1
2 5798
If your python script processed '*.jpg' files, then you could probably
get away with using the glob module ->

import glob
files_to_process = glob.glob( "/path/to/files/*.jpg" )
for f in files_to_process:
tar_it.add(f)

Something like that ought to be close to what you need. I'm not sure
what the limitation is to commandline arguments, so I can't be much
help there :(.

jw

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)
On Mon, 01 Nov 2004 09:45:22 -0500, Brad Tilley <br********@gmail.com> wrote: 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
--
http://mail.python.org/mailman/listinfo/python-list

Jul 18 '05 #2
>
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.


Its a system limit - googling reveals that is usually set to 128kb on linux
systems.

Using the -T option of tar might help you here - just create a temporary
file, stare your filenames in there and pass it to tar.
--
Regards,

Diez B. Roggisch
Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Karl Ebener | last post by:
Hi! A newbie question: How can I check, whether a key has been pressed and take that input to perform some action? I don't want to wait for that input (=> no Enter needed) and the input should...
6
by: Danny Lesandrini | last post by:
I'm using an Access database to drive a web site and the colors of various table backgrounds are stored in Access. I want users of the Access database to be able to select colors for the site, but...
35
by: Thierry Loiseau | last post by:
Hello all, and Happy end year 2005 ! Well, I would like to obtain a list of all JavaScript var statement, With "for...in" perharps ? That is bellow my recent test here, but the problem is...
7
by: Kristan | last post by:
Hi there, quick question, how would I retrieve a list of files in ANSI C in a purely platform independent way? Any pointers would be great! thanks Kristan
73
by: Yevgen Muntyan | last post by:
Hey, I was reading C99 Rationale, and it has the following two QUIET CHANGE paragraphs: 6.5.3.4: "With the introduction of the long long and extended integer types, the sizeof operator may...
6
by: Nehil | last post by:
i've following union union header { struct { unsigned int size; union header *next; }s;
21
by: Bart C | last post by:
I've always had a problem knowing exactly how wide my integer variables were in C, and the little program below has increased my confusion. Run on 3 compilers on the same cpu (32-bit pentium),...
12
by: kalyan | last post by:
Hi, I am using Linux + SysV Shared memory (sorry, but my question is all about offset + pointers and not about linux/IPC) and hence use offset's instead on pointers to store the linked list in...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.