I'm trying to use os.system to invoke a program in C:/Program Files.
The space in that directory name is messing up every attempt. Here's my code:
cmd = 'C:Program Files\OpenSCAD\openscad.exe -o block0.stl block0.scad'
print cmd
os.system(cmd)
Space ruins things. I've tried about five versions of punctuation (including some recommended in other posts) listed here with the source punctuation, the resulting string as Python sees it, and the results from os.system.
How do you punctuate this to get it right?
cmd = 'C:Program Files\OpenSCAD\openscad.exe -o block0.stl block0.scad'
C:Program Files\OpenSCAD\openscad.exe -o block0.stl block0.scad
'C:Program' is not recognized as an internal or external command,
operable program or batch file.
cmd = 'C:"Program Files"\OpenSCAD\openscad.exe -o block0.stl block0.scad'
C:"Program Files"\OpenSCAD\openscad.exe -o block0.stl block0.scad
The system cannot find the path specified.
cmd = 'C:"Program Files\OpenSCAD\openscad.exe" -o block0.stl block0.scad'
C:"Program Files\OpenSCAD\openscad.exe" -o block0.stl block0.scad
The system cannot find the path specified.
cmd = 'C:\"Program Files\OpenSCAD\openscad.exe\" -o block0.stl block0.scad'
same thing
cmd = 'C:""Program Files\OpenSCAD\openscad.exe"" -o block0.stl block0.scad'
C:""Program Files\OpenSCAD\openscad.exe"" -o block0.stl block0.scad
'C:""Program' is not recognized as an internal or external command,
operable program or batch file.
cmd = r'C:Program Files\OpenSCAD\openscad.exe -o block0.stl block0.scad'
(recommended here)
C:Program Files\OpenSCAD\openscad.exe -o block0.stl block0.scad
'C:Program' is not recognized as an internal or external command,
operable program or batch file.