subprocess

subprocess with multiple parallel jobs

I'm running some subprocesses from python in parallel. I want to wait until every subprocess have finished. I'm doing a non elegant solution: runcodes = ["script1.C", "script2.C"] ps = [] for script in runcodes: args = ["root", "-l", "-q", script] p = subprocess.Popen(args) ps.append(p) while True: ps_status = [p.poll() for p in...

Python subprocess.call weird behavior with multiple calls

I am trying to call remote (ssh) commands using the subprocess.call function like this. import shlex from subprocess import call cmd1='ssh [email protected] mkdir temp' cmd2='scp test.txt [email protected]:temp' call(shlex.split(cmd1)) call(shlex.split(cmd2)) When I call the above, the mkdir does not seem to execute - although the doc...

Virtuozzo and automating commands with Python's subprocesses

Hey everyone, I'm dealing with a Virtuozzo server and want to automate logging into each container and issuing a few commands in Python by creating a subprocess for 'vzctl enter '. Here is the snippet that I'm working on right now - #!/usr/bin/python import subprocess print 'Start' proc = subprocess.Popen(['vzctl enter 123'], ...

Delphi: Can I start short apps from a service?

Hi! I created a scheduler. It was threaded first, but because of memory leaks and separatable tasks I changed to subprocesses. The service starts the subprocesses by N minutes or in determined time. I finished with all thing, but I'm not sure now that service can start an application or not? I want to use this as processfarm - as Post...

Python2.7 Active Console to Prevent Deadlock?

I noticed an interesting behavior for my system on Windows XP To debug my system, I used cmd console to start the server xProcess = subprocess.Popen(args='Python.exe ClntMgrSvrFact.py', creationflags=CreationFlags|win32con.CREATE_NEW_CONSOLE) For each client(MSExcel) connected via TCP/IP, server factory will spawn a new process using...

ruby: How do i get the number of subprocess(fork) running

I want to limit the subprocesses count to 3. Once it hits 3 i wait until one of the processes stops and then execute a new one. I'm using Kernel.fork to start the process. How do i get the number of running subprocesses? or is there a better way to do this? ...

How to stop SIGINT being passed to subprocess in python?

My python script intercepts the SIGINT signal with the signal process module to prevent premature exit, but this signal is passed to a subprocess that I open with Popen. is there some way to prevent passing this signal to the subprocess so that it also is not exited prematurely when the user presses ctrl-c? ...

Overcoming os.system() limitation in Python 2.3

I am having a problem converting one of my company's scripts from csh to Python. The csh script calls an aliased command, but when I call that same aliased command via os.system(), it does not work. So, if foo is the aliased command: CSH Script (this works, executes foo): foo <argument> Python (this does not work, error claims foo ...

Run a C# application from python script

I've just about finished coding a decently sized disease transmission model in C#. However, I'm fairly new to .NET and am unsure how to proceed. Currently I just double-click on the .exe file and the model imports config setting from text files, does its thing, and outputs the results into a text file. What I would like to do next i...

Idle Subprocess connection problem

I'm new to python programming, and want to try to edit scripts in IDLE instead of the OSX command line. However, when I try to start it, it gives me the error "Idle Subprocess didn't make a connection. Either Idle can't start a subprocess or personal firewall software is blocking the connection." I don't have a firewall configured, so wh...

Running subprocess.call to run a Cocoa command-line application

I have one piece of Cocoa code I wrote that takes in an XML file containing bounding boxes that are then drawn on top of a video (each box has an associated frame). The Cocoa program is meant to be run from the command line (and takes in all its parameters as command line arguments) I can run program just fine with any XML document. How...

Weird subprocess issue with Django

Hello! I'm sorry if this is a duplicate question, but after searching through 3 pages for "django subprocess", I, for one, could not find the answer to my particular problem. I'm trying to run pdflatex on tex file, but for some reason in Django it doesn't produce anything. It works just fine in a regular python script, though. I've om...

How to stop a python subprocess which is running unit tests right away? Terminate and kill not working

I have a Tkinter GUI running two threads, the main tread for the GUI and a worker thread. The worker thread creates a subprocess using the following code: myProcess = subprocess.Popen(['python', '-u', 'runTests.py'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) The file ru...

issue running a program (R) in Python to perform an operation (execute a script)

Hi all, I'm tying to execute an R script from python, ideally displaying and saving the results. Using rpy2 has been a bit of a struggle, so I thought I'd just call R directly. I have a feeling that I'll need to use something like "os.system" or "subprocess.call," but I am having difficulty deciphering the module guides. Here's the R...

python subprocess calling "internal" process

Out of curiosity and trying to understand the subprocess module: Is it possible to do something like: import subprocess def myfun(arg): # do stuff arg = something; p = subprocess.Popen(["myfun","arg"]) without putting "myfun" in a file of its own? It seems like this would in general be a scary thing to do if you are not careful ...

Problems with process created using 32bit python on Debian 5.0 IA-64

So, the problem is with creating processes - all of them immediately return with exit code -9. I tried to use subprocess.Popen module and os.popen2, os.system and some other. Nothing helps. I'm using python 2.5. I have a python binary executable built on 32bit platform with 32bit python using pyinstaller. This is very important and I kn...

How do I eliminate Windows consoles from spawned processes in Python (2.7)?

I'm using python 2.7 on Windows to automate batch RAW conversions using dcraw and PIL. The problem is that I open a windows console whenever I run dcraw (which happens every couple of seconds). If I run the script using as a .py it's less annoying as it only opens the main window, but I would prefer to present only the GUI. I'm involvi...

How to manage subprocess in Python when the output is huge?

I'm controlling long running simulations (hours, days, even weeks) using a bash script that iterates over all wanted parameters. If only one simulation runs concurrently, the output is piped to "tee", else the output is plainly piped ">" to an output file. All output are huge: some log files are ~2GB and could be even bigger. The script...

python: simple approach to killing children or reporting their success?

I want to call shell commands (for example 'sleep' below) in parallel, report on their individual starts and completions and be able to kill them with 'kill -9 parent_process_pid'. There is already a lot written on these kinds of things already but I feel like I haven't quite found the elegant pythonic solution I'm looking for. I'...

Python subprocess + mencoder not working, same command works in terminal

I am having a problem using mencoder (SVN-r30531-4.2.1) through a python (2.6.1) subprocess. I am trying to join two mp4 files which are exactly the same size, codec, etc. Both have no audio. The code I am using to test is: import subprocess mp4merge = [ "mencoder", "in1.mp4", "in2.mp4", "-ovc", "copy", "-oac", "copy", "-of", "lavf", "...