You can also call them via subprocess module, but.įor Python 2.7 and newer, simply use subprocess.check_call() Windows: os.system('start ' + filename) where properly speaking filename should be escaped, too.MacOS/X: os.system('open ' + shlex.quote(filename)).Maybe see also python, windows : parsing command lines with shlex
There is shlex.quote for Unix-like systems, but nothing really standard for Windows. A:\abc\def\a.txt), or else these need to be escaped. You can call them via os.system, which works, but.Įscaping: os.system only works with filenames that don't have any spaces or other shell metacharacters in the pathname (e.g. Here are considerations on which package to use: To call them from Python, you can either use subprocess module or os.system(). Open and start are command-interpreter things for Mac OS/X and Windows respectively, to do this.