Hi All,
import os
os.system("C:\Program Files\Winamp\Winamp.exe")
>>'C:\Program' is not recognized as an internal or external command.
Anybody has the solution. It must be simple but I am not able to get it :(
Shouldn't you be doing it like
import os
os.system("C:\\Program\ Files\\Winamp\\Winamp.exe")
?
ryuslash
Junior Poster in Training
57 posts since Jul 2009
Reputation Points: 32
Solved Threads: 13
Maybe
os.system("\"C:\Program Files\Winamp\Winamp.exe\"")
might be silly, but who knows...
ryuslash
Junior Poster in Training
57 posts since Jul 2009
Reputation Points: 32
Solved Threads: 13
It's not possible that you don't actually have Winamp in Program Files? You said that you tested with C:\Winamp\Winamp.exe which worked?
ryuslash
Junior Poster in Training
57 posts since Jul 2009
Reputation Points: 32
Solved Threads: 13
ryuslash
Junior Poster in Training
57 posts since Jul 2009
Reputation Points: 32
Solved Threads: 13
This problem has been around for a long time and not just with Python:
# the "Microsoft kludge", quoting a string within a string fixes the
# space-in-folder-name problem, tells the OS to use the whole string
# including spaces as a single command
# (make sure filename does not contain any spaces!)
os.system('"C:/Program Files/IrfanView/i_view32.exe" ' + filename)
Ene Uran
Posting Virtuoso
1,723 posts since Aug 2005
Reputation Points: 625
Solved Threads: 213
This is often referred to as the little-known "Microsoft kludge"
Ene Uran
Posting Virtuoso
1,723 posts since Aug 2005
Reputation Points: 625
Solved Threads: 213
Something only Microsoft could dream up. I understand that in the European version of Windows the space is avoided. The kludge itself is from a programmer within Microsoft.
Ene Uran
Posting Virtuoso
1,723 posts since Aug 2005
Reputation Points: 625
Solved Threads: 213