473,698 Members | 2,609 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.splitex t(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 5815
If your python script processed '*.jpg' files, then you could probably
get away with using the glob module ->

import glob
files_to_proces s = glob.glob( "/path/to/files/*.jpg" )
for f in files_to_proces s:
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.splitex t(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********@gma il.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.splitex t(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
4577
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 not be displayed. Tnx a lot Karl
6
6152
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 my mappings between named colors, HEX values and the Long Integer values used in Access are not jibbing. Anyone have a nice list laying around? Danny J Lesandrini dlesandrini@hotmail.com
35
3594
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 to management theses :-((( I must to declare and use all variable with this scheme :
7
32900
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
7410
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 yield a value that exceeds the range of an unsigned long." 6.5.6: "With the introduction of the long long and extended integer
6
1661
by: Nehil | last post by:
i've following union union header { struct { unsigned int size; union header *next; }s;
21
2632
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), sometimes int and long int are the same, and long long int is twice the width; or sometimes both long int and long long int are twice the width of int. This apparently all quite normal according to my c99 draft and c-faq.com. However it doesn't...
12
4037
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 the shared memory. I run fedora 9 and gcc 4.2. I am able to insert values in to the list, remove values from the list, but the problem is in traversing the list. Atlease one or 2 list nodes disappear when traversing from the base of the list or...
0
8676
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8608
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9164
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8898
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7734
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6524
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3051
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2332
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.