os.popen() not executing command on windows xp
Gabriel Genellina
gagsl-py at yahoo.com.ar
Thu Jan 11 19:11:30 EST 2007
At Thursday 11/1/2007 14:09, nic wrote:
>import os
>pstr = r'"c:\Program Files\Grisoft\AVG Free\avgscan.exe" "c:\program
>files\temp1\test1.txt"'
>a = os.popen(pstr)
>print a.read()
>
>I've confirmed the string I'm inputting to os.popen is EXACTLY the same
>as the one I can successfully execute manually in command prompt, so
>when I go:
>print pstr, it yields:
>"c:\Program Files\Grisoft\AVG Free\avgscan.exe" "c:\program
>files\temp1\test1.txt"
>
>The problem remains popen won't execute this line as it does when
>inputted manually to command prompt.
I have AVG so I tried this example. That's not the problem. popen
works ok, avgscan is executed. But the avgscan program does *not* use
stdout nor stderr to write to the console, so popen can't capture its output.
You can confirm this at the command prompt:
"c:\Program Files\Grisoft\AVG Free\avgscan.exe" "c:\program
files\temp1\test1.txt" >output.txt 2>&1
You will see the usual progress messages from avgscan *on screen*,
and when you type output.txt, it's empty. avgscan appears to write
directly to the console.
You may use the /REPORT option; avgscan /? for details.
--
Gabriel Genellina
Softlab SRL
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas
More information about the Python-list
mailing list