IT Nursery
Is there a way to specify the running directory of command in Python’s subprocess.Popen()? For example: Popen('c:\mytool\tool.exe', workingdir="d:\test\local") My Python script is located in C:\programs\python Is is possible to...
  • May 27, 2022
  • 0 Comments
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...
  • May 23, 2022
  • 0 Comments
To launch programs from my Python-scripts, I’m using the following method: def execute(command): process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) output = process.communicate()[0] exitCode = process.returncode if (exitCode == 0):...
  • May 20, 2022
  • 0 Comments
My python script uses subprocess to call a linux utility that is very noisy. I want to store all of the output to a log file and show some...
  • May 18, 2022
  • 0 Comments
If I do the following: import subprocess from cStringIO import StringIO subprocess.Popen(['grep','f'],stdout=subprocess.PIPE,stdin=StringIO('one\ntwo\nthree\nfour\nfive\nsix\n')).communicate()[0] I get: Traceback (most recent call last): File "<stdin>", line 1, in ? File "/build/toolchain/mac32/python-2.4.3/lib/python2.4/subprocess.py", line 533,...
  • May 14, 2022
  • 0 Comments
I want to use subprocess.check_output() with ps -A | grep 'process_name'. I tried various solutions but so far nothing worked. Can someone guide me how to do it? 9...
  • May 14, 2022
  • 0 Comments
I’m using eSpeak on Ubuntu and have a Python 2.7 script that prints and speaks a message: import subprocess text="Hello World." print text subprocess.call(['espeak', text]) eSpeak produces the desired...
  • May 13, 2022
  • 0 Comments