I have no clue what is wrong. If all else fails, use os.system() instead of
os.popen(). Pipes tend not to always work in windows.
--
http://mail.python.org/mailman/listinfo/python-list
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
It appears os.popen() doesn't like full windows paths with spaces (e.g.
"c:/program files") so I'm going to use the subprocess module.
--
http://mail.python.org/mailman/listinfo/python-list
Justin Ezequiel wrote:
> > import os
> > a = os.popen('"c:\Program Files\Grisoft\AVG Free\avgscan.exe"
> > "c:\program files\temp1\test1.txt"')
> > print a.read()
> >
>
> use raw strings
>
> e.g., instead of '"c:...\avgscan...'
> use r'"c:...\avgscan...'
>
> http://www.ferg.org/projects/python_gotc
> import os
> a = os.popen('"c:\Program Files\Grisoft\AVG Free\avgscan.exe"
> "c:\program files\temp1\test1.txt"')
> print a.read()
>
use raw strings
e.g., instead of '"c:...\avgscan...'
use r'"c:...\avgscan...'
http://www.ferg.org/projects/python_gotchas.html#contents_item_2
--
http://mail.py
At Thursday 11/1/2007 06:42, nic wrote:
a = os.popen('"c:\Program Files\Grisoft\AVG Free\avgscan.exe"
"c:\program files\temp1\test1.txt"')
Your string contains backquotes, and they have to be escaped.
Either use a raw string: os.popen(r'"c:\Program...) or double all
backquotes: os.popen('"c:\
On my system (WinXP) typing the following line into command
prompt(cmd.exe) successfully scans the file test1.txt:
"c:\Program Files\Grisoft\AVG Free\avgscan.exe" "c:\program
files\temp1\test1.txt"
Yet the python script:
import os
a = os.popen('"c:\Program Files\Grisoft\AVG Free\avgscan.exe"
"c:\p