popen Questions

4

Solved

I am using ffmpeg's extract_mvs file to generate some text information. I would use a command like this in the terminal: /extract_mvs input.mp4 > output.txt I would like to use this command w...
Redd asked 23/2, 2018 at 11:9

7

Solved

How do I go about running a bash script using the subprocess module, to which I must give several arguments? This is what I'm currently using: subprocess.Popen(['/my/file/path/programname.sh', 'a...
Poulson asked 21/6, 2013 at 19:23

3

I'm using subprocess.Popen with Python, and I haven't come across an elegant solution for joining commands (i.e. foobar&& bizbang) via Popen. I could do this: p1 = subprocess.Popen(["m...
Midtown asked 17/3, 2013 at 22:51

3

Solved

I am running a subprocess using 'Popen'. I need to block till this subprocess finishes and then read its output. p = Popen(command, stdin=PIPE, stdout=PIPE, stderr=PIPE, encoding="utf-8") p.commun...
Cusped asked 2/8, 2018 at 18:27

5

I'd like to execute multiple commands in a standalone application launched from a python script, using pipes. The only way I could reliably pass the commands to the stdin of the program was using P...
Ignoble asked 29/1, 2010 at 11:33

2

I am having a problem... does anyone knows why this code hangs in the while loop. The loop doesn't seem to catch the last line of the stdout. working_file = subprocess.Popen(["/pyRoot/iAmACras...
Groundsill asked 13/12, 2011 at 20:33

9

Solved

I want to call a process via a python program, however, this process need some specific environment variables that are set by another process. How can I get the first process environment variables ...
Strahan asked 31/7, 2009 at 19:44

3

Solved

I was trying to compile the code below (from https://mcmap.net/q/64265/-how-do-i-execute-a-command-and-get-the-output-of-the-command-within-c-using-posix). The compile went OK, if I compile with ...
Poisoning asked 4/3, 2014 at 8:31

10

Solved

I believe that running an external command with a slightly modified environment is a very common case. That's how I tend to do it: import subprocess, os my_env = os.environ my_env["PATH"] = "/usr/...
Glazier asked 9/2, 2010 at 17:55

2

Solved

What options are there for commiting and pushing files to github from python? Here are three methods I thought should be feasible so attempted in order: Use pygithub: (Github's python API) to send...
Casaubon asked 28/4, 2018 at 0:59

4

Solved

I'm trying to use popen() to catch the stderr of a call, but of course it doesn't seem to be doing that. Any ideas? My code looks more or less like this: popen("nedit", "r"); But I'm getting al...
Atwood asked 1/8, 2011 at 15:16

4

Solved

I'm writing a c++ program that executes and outputs (in real-time) a shell script, makefile or just another program. However I would like to have my program return differently when there are errors...
Flagrant asked 25/2, 2013 at 1:37

3

I have a program that uses popen() in order to open and read the output from a shell command. The problem is, as far as I can tell, there is no easy way to get the PID of the running process, and h...
Barbur asked 10/11, 2014 at 20:13

2

Solved

I have a executable which requires a tty (as stdin and stderr), and want to be able to test it. I want to input stdin, and capture the output of stdout and stderr, here's an example script: # test...
Premillenarian asked 23/10, 2018 at 16:56

7

C standard library provides functions system and popen to run a command. But is there a portable way to detect if a command exists?
Summerwood asked 21/5, 2009 at 0:27

4

Solved

Is it possible to modify code below to have printout from 'stdout 'and 'stderr': printed on the terminal (in real time), and finally stored in outs and errs variables? The code: #!/usr/bin/pyt...
Meniscus asked 19/6, 2013 at 11:38

5

I have some custom commands. This works: subprocess.Popen(['python'], stdout=subprocess.PIPE) But if I have my own system commands like deactivate, I get that error Traceback (most recent call las...
Henna asked 29/3, 2012 at 23:38

3

Solved

I'm working with Python 2.7 on Windows 8/XP. I have a program A that runs another program B using the following code: p = Popen(["B"], stdout=PIPE, stderr=PIPE) stdout, stderr = p.communi...
Shearwater asked 6/11, 2012 at 3:12

4

Solved

I can successfully redirect my output to a file, however this appears to overwrite the file's existing data: import subprocess outfile = open('test','w') #same with "w" or "a" as opening mode outf...
Serles asked 12/9, 2011 at 14:4

5

Solved

I'd like to use Python 2.6 on Windows to launch several separate command windows, each running their own Python script. The purpose is: these are clients, and I'm trying to load up the server with ...
Clariceclarie asked 5/10, 2012 at 12:19

4

I am currently trying to write (Python 2.7.3) kind of a wrapper for GDB, which will allow me to dynamically switch from scripted input to interactive communication with GDB. So far I use self.pr...
Restricted asked 18/6, 2015 at 20:26

6

Solved

I have a program with a GUI that runs an external program through a Popen call: p = subprocess.Popen("<commands>" , stdout=subprocess.PIPE , stderr=subprocess.PIPE , cwd=os.getcwd()) p.commu...
Chartier asked 28/11, 2009 at 21:50

4

Solved

When I run in my Ubuntu terminal: sudo dd if=/dev/sda of=~/file bs=8k count=200k; rm -f ~/file it works fine. If I run it through Pythons subprocess.Popen(): output, err = subprocess.Popen(['s...
Snatch asked 17/11, 2016 at 18:51

3

Solved

Using Python 3.4.3 on Windows. My script runs a little java program in console, and should get the ouput: import subprocess p1 = subprocess.Popen([ ... ], stdout=subprocess.PIPE, stderr=subproces...
They asked 22/10, 2015 at 14:33

5

Solved

I'm using the subprocess.Popen call, and in another question I found out that I had been misunderstanding how Python was generating arguments for the command line. My Question Is there a way to f...
Adest asked 12/2, 2013 at 16:19

© 2022 - 2025 — McMap. All rights reserved.