How do I run a program using Python?
3 answers
In general, you can do this using subprocess.call
>>> from subprocess import call
>>> call(r"C:\Program Files\Mozilla Firefox\Firefox.exe")
But if all you want to do is open the page in the browser you can do:
>>> import webbrowser
>>> webbrowser.open('http://stackoverflow.com/')
True
See http://docs.python.org/library/subprocess.html and http://docs.python.org/library/webbrowser.html .
+13
a source to share
You open the file to read its contents, try the subprocess module instead
http://docs.python.org/library/subprocess.html
import subprocess
subprocess.Popen([r"C:\Program Files\Mozilla Firefox\Firefox.exe"])
+7
a source to share