I am new to python. Any ideas why this does not work:
C:\Python27>python
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.>>> import os>>> cmdBuilder = os.path.join("C:\\","Program Files","InstallShield","2011 SAB",
"System","IsCmdBld.exe")>>> os.system(cmdBuilder)
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
1>>>
The executable does actually exist. It seems to be getting caught up on the space between Program and Files
Thanks
asked Apr 13, 2011 at 17:23
user489041
28.4k56 gold badges143 silver badges207 bronze badges
-
1Try "progra~1" instead of "Program Files".GreenMatt– GreenMatt2011年04月13日 17:27:03 +00:00Commented Apr 13, 2011 at 17:27
2 Answers 2
Try wrapping the executable in quotes:
>>> os.system('"'+cmdBuilder+'"')
answered Apr 13, 2011 at 17:26
yan
21k3 gold badges41 silver badges48 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
Because parts of the path contain whitespaces.
See also
http://help.wugnet.com/windows2/Program-space-batch-file-ftopict489742.html
answered Apr 13, 2011 at 17:26
user2665694
Comments
lang-py