Enclosing a full file path inside the "" quotes does not make it work.
cmd = "C:\Program Files (x86)\iTunes\iTunes.exe"
subprocess.popen throws an error of not being able to find an executable if there is a white space in a file-path to be executed.
A while ago I was able to find a solution which involved a use of some weird symbols or their combination... Unfortunately I can't locate a code with that example. I would appreciate if someone would point me in a right direction. Thanks in advance.
Backslashes in strings trigger escape characters. Since Windows fully supports the use of the forward slash as a path separator, just do that:
cmd = "C:/Program Files (x86)/iTunes/iTunes.exe"
No need to fiddle around with \\
or raw strings. ;)
Either use:
cmd = '"C:\\Program Files (x86)\\iTunes\\iTunes.exe"'
or
cmd = r'"C:\Program Files (x86)\iTunesr\iTunes.exe"'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With