The Python subprocess module provides an API for creating and communicating with secondary processes.

learn more… | top users | synonyms (2)

3
votes
0answers
123 views

How to open a file in a new process everytime irrespective of fileopener

I am using windows 7 64 bit python 2.7 I am opening the file, and monitoring the file changes and then waiting till the opened file is closed. This works well in case of simple notepad file opener. As ...
3
votes
0answers
116 views

Pausing Python subprocesses from keyboard input without killing the subprocess

I'm working on a project to produce a shell in Python, and one important feature is the ability to pause and background a running subprocess. However the only methods I've found of pausing the ...
3
votes
0answers
152 views

Parallel Python (pp) and subprocess : task never ends on the client

I'm trying to use the module "Parallel Python" (pp) to distribute the computation of a "big" tool (gdal2tiles, if you've heard of it). I was running a few simple tests to get familiar with pp, but I ...
3
votes
0answers
1k views

Python can't communicate with subprocess of a Minecraft server

I'm trying to write a handler/controller for the Minecraft server. My problem is that I can't seem get writing and reading to work properly. When a client issues a command that uses the server class's ...
2
votes
0answers
41 views

How do I know if a file has been closed if I open it using subprocess.Popen?

I am opening files using the following commands in python : file = os.path.normpath(file_path) phandler = subprocess.Popen(['open', '-W', file]) I am polling is_opened = phandler.poll() == None ...
2
votes
0answers
37 views

Need better option when trying to restore from the recycle bin

This is the code I have now. This goes through the explorer. But I need a better option. o = win32com.client.Dispatch("WScript.Shell") #o.SendKeys("#m") #time.sleep(5) import ...
2
votes
0answers
104 views

How to return stdout from long running process with subprocess and Popen?

I'm using a pretty basic setup with subprocess.Popen() and directing stdout to a variable which I later return to a different part of my python script. Here is my basic Popen code: process = ...
2
votes
0answers
103 views

PyQt - comboBox and/or lineEdit value as subProcess.call argument

I am new to Python and Qt4 and am running into some problems with taking user entered/selected information and then using them as arguments for other python files. Here's the two situations & ...
2
votes
0answers
83 views

subprocess reading multiline

I want to read out this text given from a command: System Data At this Computer Sector: id1 Name: name1 Data: data1 Sector: id2 Name: name2 Data: data2 Want ...
2
votes
0answers
93 views

Communicating with the stdin via python subprocess

I'm running an exe from my python code using subprocess with the following code: if subprocess.call(string, stderr=stdPoller, stdout=stdPoller, stdin=stdPoller, shell=True)==0: return ...
2
votes
0answers
54 views

Can stdout and stderr from a child process be correctly interleaved? (Python 2.7, Windows)

I've seen several posts on this topic but haven't made much progress. I would like to run a command line app from a Python script and receive back: 1.) The stdout only 2.) The stderr only 3.) Stdout ...
2
votes
0answers
215 views

Wait for git command inside subprocess call to complete before submitting pull request

I'm trying to submit a pull request on a new branch that I created with pyGithub (https://github.com/jacquev6/PyGithub) API. I'm getting varying results every time I run my script. Sometimes I'm ...
2
votes
0answers
178 views

Python subprocess.call() returning Access is denied [error 5] on Django Deployed App in Windows with HeliconZoo

Ok, I'm starting to get a headache to solve this problem and now i decide to ask for help here in the stackoverflow. First, let me know introduce what i'm trying to do: My django app is quite simple ...
2
votes
0answers
421 views

Calling subprocess.Popen with stdin, stdout, and stderr set to subprocess.PIPE changes the behavior of the terminal

I recently developed a Python script to leverage a tool to retrieve metrics from JVMs via JMX. The parent process (p1) uses the following code to start another process (p2). p2 = subprocess.Popen( ...
2
votes
0answers
83 views

subprocess.call() is not waiting

I'm using subprocess.call and I need to track the amount of time that it takes to execute. The documentation says that subprocess.call should block execution while the child process runs but the ...
2
votes
0answers
138 views

Pygame mixer in a subprocess does not work

Debian OS. I call a subprocess subprocess.Popen([sys.executable, "/home/pi/play_sound.py"]) And in play_sound.py, I play a sound with: def load_sound(url): class NoneSound: def ...
2
votes
0answers
84 views

Python subprocess check_output and call yielding different results for the same arguments to pwgen

I'm using the subprocess call() method to execute the pwgen utility to create a 12 character password. When I use check_output() I get a different result for the same arguments. Here's a working code ...
2
votes
0answers
224 views

Python script breaks linux shell

I have a Python script that makes use of the following modules: import sys, getopt, os, time, subprocess When I run this script, at some point the output starts 'tabbing' itself. Expected output: ...
2
votes
0answers
304 views

Python subprocess pipes hanging with communicate()

I'm having a few issues with what seems like a simple piece of code in Python using the subprocess module. My goal is that I have a file in gzip format, I want to read that file, decompress it and ...
2
votes
0answers
457 views

Why does stdout behave differently for subprocess.Popen called with shell=True vs False?

As a minimal example, I want to run "ping website.com" on both a remote and local machine and print output from both in parallel to local stdout. I use multiprocessing to call both functions to run ...
2
votes
0answers
813 views

can winpexpect get the same result with subprocess?

I want to communicate with the subprocess on Windows, and I find winpexpect is one way can help to complete the task. The codes is as following >>> import winpexpect >>> ...
1
vote
0answers
19 views

subprocess cannot exec when use python-daemon package

When i use python-daemon in code, subprocess cannot exec def main_pro(): #some code cmd="/path/to/alert.py " + ip + " "+ title + " " + content handler = subprocess.Popen(args = cmd, ...
1
vote
0answers
23 views

Python3 subprocess check_output returns empty for some commands

I am a python3 beginner. I am trying to get the java version with a python3 script. After I checked the docs, I saw that subprocess.check_output might be what I need. output = ...
1
vote
0answers
54 views

Python: subprocess memory leak

I want to run a serial program on multiple cores at the same time and I need to do that multiple time (in a loop). I use subprocess.Popen to distribute the jobs on the processors by limiting the ...
1
vote
0answers
48 views

making sure a thread performs work last time

Finally I was able to spawn multiple subprocesses and getting their stdout into python in real-time using threads. I have a list of dicts which contains all the data structures I need to spawn the ...
1
vote
0answers
30 views

python pipe gets output from wrong subprocess

I have an app written in python 3.2 running in linux that makes heavy use of the subprocess module and theading. One of the functions is to call a custom script to get the up/down status of various ...
1
vote
0answers
38 views

Python svn commands

I'm on python3 and not found any module to work with svn, and choose to make it myself First of all i create a list of parameters: cmd and later run this code: p = subprocess.call(cmd, ...
1
vote
0answers
62 views

Python: parsing logs from remote server

I need to process log files from a remote directory and parse their contents. This task can be divided into the following: Run ssh find with criteria to determine files to process Get the relevant ...
1
vote
0answers
31 views

More woes with subprocess, lists

I have the following code clearfile = '/tmp/jjj' passphrase = "one fish two fish" opts = '--no-tty --homedir=/www/vhost/.gnupg --passphrase-fd 0 -a -c -o - ' cmd = ['/usr/bin/gpg', opts, clearfile ] ...
1
vote
0answers
33 views

python subprocess.Popen delaying command when in a class

When I embed this function: def RunCommand(self, command): try: p = subprocess.Popen(command) stdout,stderr = p.communicate() except OSError, e: raise RuntimeError, "Error while ...
1
vote
0answers
32 views

subprocess.call runs Ctypes msgbox ok but also opens python.exe window

Running Python 3.4 on Windows platform. I want to use ctypes to kick out an error msgbox when no input is put into an input field. code is: if len(pet) == 0: subprocess.call("Python help.py") if ...
1
vote
0answers
71 views

Handle is Invalid: Calling BCP from Python using the subprocess module

I have a project where I am uploading a lot of data in the form of text files to SQLServer. There is a python script which calls the BCP command iteratively using the function SQLUpload. The input ...
1
vote
0answers
57 views

Using pipe for writing strings to a windows cmd running a spy app

Using Windows7 64-bit and Python 2.6.6 32-bit I'm trying to create a spy window that my application can spawn and write text to so it can be displayed. The window is simply cmd.exe run in a process ...
1
vote
0answers
42 views

Pythonw crash without any log?

I have a pythonw application , running with a daemon to watch child process status. So it has 2 process when system normal. Once a worker-process die, daemon process will fork a new worker-process in ...
1
vote
0answers
38 views

IO + subprocess.check_output iteration breaking file writes

I am writing a python script that will go through a code file, comment out an import, build the program, and determine if each import is actually being used. I have each component working, but for ...
1
vote
0answers
127 views

Python installation issue, IDLE subprocess didn't make connection

I am trying to install python 3.3.4 for the first time on Win Vista OS and it seems to install successfully but when I try to open the IDlE gui I get the error msg: IDLE subprocess didn't make ...
1
vote
0answers
40 views

Calling subprocess.call in Django 161 WSGI fails to execute sql update

I have a python script that I wish to kick off its process from a simple upload via CentOS6 Django 1.6.1 once the upload is complete a series of conversions and sql updates occur all of which happen ...
1
vote
0answers
66 views

Python multiprocessing performance degradation

I've written a Python script, using the multiprocessing and subprocess modules, to run 8 (multiprocessing.cpu_count()) Java processes at a time in parallel. Some relevant code (redacted for brevity): ...
1
vote
0answers
87 views

How can I send keystrokes to a program thats inactive in Mac OS X

I want to create a program that will allow me to 'multi-box' a flash game (ROTMG). All I've seen for sending keystrokes in Mac is the applescript but that only works for programs that are active, My ...
1
vote
0answers
162 views

Hive Python CLI Subprocess Stream stdout

I am trying to wrap the hive cli (I know I could use hive server) in a python subprocess and stream the output. When I run this query via the cli: hive -e "SELECT * from table" Logging ...
1
vote
0answers
83 views

How do you kill a python subprocess if it generates too much output on stdout

I have a program that either terminates with almost no output, or it prints stuff to standard out for 10 minutes before terminating. Currently I run the process using subprocess.Popen with stdout, ...
1
vote
0answers
113 views

python subprocess.popen not honouring LD_LIBRARY_PATH

I'm trying to spawn a subprocess from python using the following code in a python script: p = subprocess.Popen(['./appleseed.cli', '--version']) the problem is the command relies on a shared ...
1
vote
0answers
26 views

Does DBIx::Connector address the “per process basis” limitation of Apache::DBI?

Apache::DBI's docs say: Apache::DBI [...] has a limitation: it keeps database connections persistent on a per process basis. [...In] a heavy loaded Web-site where every user connects to the ...
1
vote
0answers
202 views

Trapping and handling taskkill in Windows Python

I am using Python 2.6.6 for Windows (on Windows XP SP3) with pywin32-218. In my Python application, I have a second thread (apart from the main thread) which spawns a subprocess to run another ...
1
vote
0answers
85 views

Python:subprocess:Reading a string from the terminal

I would like to read each line from a terminal program and have the python program react to it. The program starts fine but I am having trouble making it read lines from the terminal. Help on doing so ...
1
vote
0answers
127 views

Calling upstart job from inside python code causes process freeze

I have a situation where I want to start an upstart job from inside my python code. The job to be started is itself written in python(that should not matter here) Here is what my upstart job ...
1
vote
0answers
28 views

parallel python timeout spawns another process instead of failing?

Using parallel python 1.6.4 I spawn a subprocess.Popen command on a remote server. For whatever reason, the command isn't completing in a timely matter, i.e., within the socket_timeout I've set. In ...
1
vote
0answers
179 views

OpenMPI code runs on command line but not through python subprocess or shell script

I am trying to run MPI on a virutal cluster using KVM. My OpenMPI code runs fine when run through terminal using: mpiuser@niru:~$ mpirun -n 5 -hostfile /home/mpiuser/hosts /home/mpiuser/hello ...
1
vote
0answers
84 views

Gracefully Terminate Child Python Process On Windows so Finally clauses run

On Windows boxes, I have a number of scenarios where a parent process will start a child process. For various reasons - the parent process may want to abort the child process but (and this is ...
1
vote
0answers
230 views

Python subprocess.Popen: not accepting a string with spaces but only when there are two strings

subprocess.Popen accepts this string and starts the tcl shell process: '"C:\\Program Files (x86)\\TCL\\bin\\tclsh.exe "' If you can just see, I have encapsulated the string in double quotes. Now, ...