Aaron
Aaron

Reputation: 2772

Start app from within python

I'm trying to start an application using Python. I've seen that some people use startfile but I also read that it only works with Windows. I'm using Mac systems and hoping for it to work with them. Thanks, Aaron

Upvotes: 0

Views: 701

Answers (3)

Wolph
Wolph

Reputation: 80031

Python has the subprocess module for that, you can read about it here: http://docs.python.org/library/subprocess.html

In it's simplest form:

subprocess.call(['your_command', 'params'])

Upvotes: 4

Justin Ethier
Justin Ethier

Reputation: 134177

Try using os.system - the docs say it is supported on UNIX and Windows, but since OSX is UNIX-based I would expect it to work on that platform as well.

Upvotes: 0

danben
danben

Reputation: 83250

You can use os.system("/path/to/myapp").

See http://docs.python.org/library/os.html#os.system for documentation.

If you want more control over the process being executed, check out the subprocess module instead.

Upvotes: 1

Related Questions