os.system to invoke an exe which lies in a dir whose name contains whitespace
Putting quotes around the path will work:
file = 'C:\\Exe\\First Version\\filename.exe'
os.system('"' + file + '"')
but a better solution is to use the subprocess
module instead:
import subprocess
file = 'C:\\Exe\\First Version\\filename.exe'
subprocess.call([file])
I used this:
import subprocess, shlex
mycmd='"C:\\Program Files\\7-Zip\\7z" x "D:\\my archive.7z" -o"D:\\extract folder" -aou'
subprocess.run(shlex.split(mycmd))
Try enclosing it with double quotes.
file = '"C:\\Exe\\First Version\\filename.exe"'
os.system(file)