I'm not able to start an executable from a variable path. I've tried:
os.system(destPath + '/BHC.exe')
os.system(destPath/BHC.exe)
the destPath is set correctly and the BHC.exe is in there.
How can I start the external program?
Use os.path.join to avoid any slash confusion:
os.system(os.path.join(destPath, 'BHC.exe'))
If that doesn't resolve the problem, further troubleshooting is best answered by running an outside program (executable) in python?
os.path.join did the right thing :)
print destPath + '/BHC.exe'?os.systembutsubprocess.callinstead 2) Useos.path.joininstead of manually joinining the file paths:import os, subprocess; subprocess.call([os.path.join(destPath, 'BHC.exe')]).os.systemuses Windows components likecmd.exewhich don't understand paths with forward slashes in them. Assumingdestpathdoesn't have any, try+ '\\BHC.exe'(or better yet do as @Erica suggests).os.systemunderstands forward slashes for absolute paths but not relative paths. We'll know what's going on when OP finally answers @Undo's question. Why people post questions and then ignore requests for more information is the puzzling part!