I have a C# command-line application that I need to run in windows and under mono in unix. At some point I want to launch a subprocess given a set of arbitrary paramaters passed in via the command line. For instance:
Usage: mycommandline [-args] -- [arbitrary program]
Unfortunately, System.Diagnostics.ProcessStartInfo only takes a st...
An example: a permit must be examined by two lawyers and one engineer. If any of those three reject it, the process enters a "rejected" end state. If all three grant the permit, it enters a "granted" end state. All three examiners may examine simultaneously, or in any order.
Once one engineer has granted it, it shouldn't be available t...
I want to execute an external program in each thread of a multi-threaded python program.
Let's say max running time is set to 1 second. If started process completes within 1 second, main program capture its output for further processing. If it doesn't finishes in 1 second, main program just terminate it and start another new process.
H...
I'm looking for a Python solution that will allow me to save the output of a command in a file without hiding it from the console.
FYI: I'm asking about tee (as the Unix command line utility) and not the function with the same name from Python intertools module.
Details
Python solution (not calling tee, it is not available under Wind...
Hi,
I'm using the killableprocess package (built on top of subprocess) for running processes
Whenever I run the "killableprocess.Popen(command)" piece of code in my script I get the following error:
File "killableprocess.py", line 157, in _execute_child
winprocess.AssignProcessToJobObject(self._job, hp)
File "winprocess.py", lin...
I want to run a csh file from a python script,
example,
#!/usr/bin/python
import os
os.system("source path/to/file.csh")
and I want this file to run in the same shell as I am running the python script, because the file.csh script is settings some environment variables that I need.
Does anyone know how to do this in Python?
...
I use
check_call('convert ...', shell=True)
to open the process. This is run inside apache. I start getting this exception after a few days:
File "/usr/lib/python2.6/subprocess.py", line 457, in check_call
retcode = call(*popenargs, **kwargs)
File "/usr/lib/python2.6/subprocess.py", line 444, in call
return Popen(*popenar...
I'm calling pipe.communicate from Python's subprocess module from Python 2.6. I get the following error from this code:
from subprocess import Popen
pipe = Popen(cwd)
pipe.communicate( data )
For an arbitrary cwd, and where data that contains unicode (specifically 0xE9):
Exec. exception: 'ascii' codec can't encode character u'\x...
Hello, it's not the first time I'm having this problem and its really bugging me.
Whenever I open a pipe using the Python subprocess module, I can only communicate with it once, as the documentation specifies: Read data from stdout and stderr, until end-of-file is reached
proc = sub.Popen("psql -h darwin -d main_db".split(),stdin=sub.PI...
Hi,
I need a way to either read all currently available characters in stream created by Popen or to find out how many characters are left in the buffer.
Backround:
I want to remote control an interactive application in Python. So far I used Popen to create a new subprocess:
process=subprocess.Popen(["python"],shell=True,stdin=subproce...
Hello, I'm trying to start a text editor (nano) from inside Python, have the user enter text, and then capture the text once they writeout (Control-O). I haven't worked with the subprocess module before, nor pipes, so I don't know what to try next.
So far I have this code:
a = subprocess.Popen('nano', stdout=subprocess.PIPE, shell=True...
In perl, I often need to run a child process, send some input to it, and then read its output. There are a number of modules to do this, but they all seem to require you to pass in pre-existing variables, which are then modified by the function to contain filehandles. Here is an example from the Synopsis of IPC::Open3:
my ($wtr, $rdr, $...
Hi all. I'm testing python subprocess and I keep getting this error:
$ python subprocess-test.py
Traceback (most recent call last):
File "subprocess-test.py", line 3, in <module>
p = subprocess.Popen(['rsync', '-azP', 'rsync://cdimage.ubuntu.com/cdimage/daily-live/current/maverick-desktop-amd64.iso', '/home/roaksoax/Desktop/iso']...
Hi all. I have this code:
def method_a(self):
command_line = 'somtoolbox GrowingSOM ' + som_prop_path
subprocess.Popen(shlex.split(command_line))
......
def method_b(self): .....
....
and like you all see, method_a has a subprocess that is calling the somtoolbox program. But this program have a long stdout, and I want to ...
Hi, I need to interface a C console program (as subprocess) with Python using stdin/stdout.
the C program is more o less it:
tmp = 0.0;
printf("\ninput>>");
scanf_s("%f",&tmp);
printf ("\ninput was: %f",tmp);
tmp = 0.0;
printf("\ninput>>");
scanf_s("%f",&tmp);
printf ("\ninput was: %f",tmp);
tmp ...
Again, the same question. The reason is - I still can't make it work after reading the following:
http://stackoverflow.com/questions/1085071/real-time-intercepting-of-stdout-from-another-process-in-python
http://stackoverflow.com/questions/527197/intercepting-stdout-of-a-subprocess-while-it-is-running
http://stackoverflow.com/question...
I've looked around a bit but I can't seem to solve this problem I have. I'd like to execute a python script within a view of my django app. I've placed the code I'd like to execute inside a django management command so it can be accessed via command line python manage.py command-name. I then tried to run this command using subprocess....
I'm using a third party library that starts various sub processes. When there's an exception I'd like to kill all the child processes. How can I get a list of child pids?
...
I've got a script that downloads and then converts videos. I'm trying to do all of the downloads at once(a lot of wgets) and then when they're done, convert them. Right now I have to wait while each file downloads individually and then convert when done. I want all the download requests to run concurrently.
Here's the part in my 'downlo...
I'm writing a python script that uses subprocess.Popen to execute two programs (from compiled C code) which each produce stdout. The script gets that output and saves it to a file. Because the output is sometimes large enough to overwhelm subprocess.PIPE, causing the script to hang, I send the stdout directly to the log file. I want to ...