Python – os.popen Does Not Work with Parameters Inside Quotes When Command is in Quotes
Wednesday, October 4th, 2006To be honest, all I really know is that this python code returns ” for me,
[Dbg]>>> print command
"C:\automated tasks\GoldMine_Replace\GoldMine_Replace.exe" -lg -pfd5 -r"3XDYQ2#PK
''
while running the same command at the DOS prompt returns good stuff.
C:\>"C:\automated tasks\GoldMine_Replace\GoldMine_Replace.exe" -lg -pfd5 -r"3XDYQ2#PK
Additionally this Python bug seems to imply that os.system and the os.popen's just don't work quite right on Windows.
But don't get frusterated. Just do a cheap workaround and move/rename your executable (put it in a batch file if you have to) so that you don't need to put the command in quotes. That means making it have no spaces in it's filepath. That's what worked for me. I just moved the executable GoldMine_Replace.exe to the C:\ directory.