Python, subprocess, filepath white spaces and famous 'C:/Program' is not recognized as an internal or external command

Viewed 12241

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.

4 Answers
Related