Amaury Forgeot d'Arc amaur...@gmail.com added the comment:
The following works for me:
import subprocess
p=subprocess.Popen('findstr disk c:\\boot.ini',
stdout=subprocess.PIPE)
print p.communicate()[0]
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
Alex James ac.ja...@shaw.ca added the comment:
import subprocess
fileName = 'test_a5.py.out'
locator = 'step 5200 '
p = subprocess.Popen('findstr /O /B /C:' + locator + ' '+
fileName, stdout=subprocess.PIPE, shell=True)
print p.stdout.read()
print p.communicate()[0]
And stderr is also
Alex James ac.ja...@shaw.ca added the comment:
Um, nevermind.
I completely missed cwd=os.path.split(sys.argv[0])[0] so the shell
command wasn't operating in the same relative path as the script.
And that never mattered on Unix because we always ran from commandline,
not IDLE, so the shell
New submission from Alex James ac.ja...@shaw.ca:
When calling p=subprocess.Popen(findstr string filename, stdout=PIPE)
both p.stdout.read() and p.communicate()[0] are returning None even when
the shell process has output (ie string was found in filename).
Further, redirecting stdout to a file
Philip Jenvey pjen...@users.sourceforge.net added the comment:
Exactly what command line are you passing to subprocess? Does stderr
contain anything?
--
nosy: +pjenvey
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6107