Linked Questions

0 votes
1 answer
3k views

I am trying to run a shell command via subprocess.run, and I would like to redirect the output to a file, but also display it on stdout at the same time. I have not found a way to do it, is this ...
darxsys's user avatar
  • 1,620
319 votes
28 answers
311k views

I'm using a python script as a driver for a hydrodynamics code. When it comes time to run the simulation, I use subprocess.Popen to run the code, collect the output from stdout and stderr into a ...
DilithiumMatrix's user avatar
428 votes
11 answers
726k views

I'm trying to port a shell script to the much more readable python version. The original shell script starts several processes (utilities, monitors, etc.) in the background with "&". How can I ...
Artem's user avatar
  • 6,880
99 votes
7 answers
111k views

I'm using Python's subprocess.communicate() to read stdout from a process that runs for about a minute. How can I print out each line of that process's stdout in a streaming fashion, so that I can ...
Heinrich Schmetterling's user avatar
92 votes
9 answers
37k views

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 ...
32 votes
4 answers
46k views

The task I try to accomplish is to stream a ruby file and print out the output. (NOTE: I don't want to print out everything at once) main.py from subprocess import Popen, PIPE, STDOUT import pty ...
vermin's user avatar
  • 1,099
20 votes
2 answers
12k views

I'm running a script that executes a number of executables by using subprocess.call(cmdArgs,stdout=outf, stderr=errf) when outf/errf is either None or a file descriptor (different files for stdout/...
user515766's user avatar
4 votes
2 answers
13k views

Using the python logging package, and writing a class Log, I'd like to tee stdout and stderr to a log file : log = Log("log.txt") print "line1" print "line2" print >>sys.stderr, "err1" del log ...
Eric H.'s user avatar
  • 2,279
0 votes
1 answer
2k views

I want to redirect the output of (potentially multiple) processes started from within a python script to both stdout and a log file, pretty much like as the unix tool tee does it. A the processes are ...
Stefan's user avatar
  • 1,226
5 votes
1 answer
718 views

I want something have similar effect of cmd > >(tee -a {{ out.log }}) 2> >(tee -a {{ err.log }} >&2) in python subporcess without calling tee. Basically write stdout to both stdout ...
Wang's user avatar
  • 8,436
1 vote
0 answers
1k views

I have a python script_1 which will be used to call another python script_2 using subprocess. When I do that I can see so many print statements and ouputs on the python console (or cmd). How can I ...
Dheeraj's user avatar
  • 11
0 votes
1 answer
625 views

Below is my script which calls another script using below example and produces entire output after execution is completed while expectation is that it should produce live output as well as write in ...
Ujjawal Khare's user avatar
1 vote
0 answers
403 views

I'm calling my Ansible playbook from a Python script. subprocess.call("ansible-playbook -i hosts my_playbook.yml", shell=True) When this completes there is a PLAY RECAP which includes a ...
esafresa's user avatar
  • 600
1 vote
0 answers
292 views

I am trying to achieve a functionality where I can open a new command prompt and run some batch commands. Then redirecting the output to a logfile and console on real time. So I am using wtee.exe (ex ...
AlanAdams's user avatar
0 votes
0 answers
295 views

I want to run a subprocess.Popen('echo 1; sleep 1; echo 1', shell=True, stdout=?) in a way I would have the output appear (at run time) and also be able to save it into a PIPE or file. So far I ran ...
CIsForCookies's user avatar

15 30 50 per page