Skip to content
Advertisement

Tag: popen

Python subprocess returning exception

I have the following code that has been working until recently: it calls the opt_module_v3.py and returns messages as the child process runs. When I run the main code, I’m getting the following exception: Like I mentioned, this code was working before but I might have stuffed up since I’ve been working on improvements. Any clues on what could be

Python subprocess Popen periodic callback

I am running an HPC simulation on amazon AWS with spot instances. Spot instances can be terminated with 2 minutes notice by AWS. In order to check for termination you need to exectute curl on a spefiic URL every 5 seconds. It is a simple request that returns a json with the termination time, if AWS have initiated the termination

New line character appended to os.popen().read() command

I am retrieving a file through the below command: while printing fileName, I see n appended. I know we can remove n through replace command, but I want to know why this is happening. Answer It is the ls command that append a new-line character to the output, you can figure it out opening a terminal and executing the command

real time subprocess.Popen via stdout and PIPE

I am trying to grab stdout from a subprocess.Popen call and although I am achieving this easily by doing: I would like to grab stdout in “real time”. With the above method, PIPE is waiting to grab all the stdout and then it returns. So for logging purposes, this doesn’t meet my requirements (e.g. “see” what is going on while

Advertisement