alessandro
alessandro

Reputation: 3984

python: howto open firefox (osx)

I need to associate to a hyperlink the command to execute firefox. Seeing as I can do it in a terminal, I used

 os.system("/Applications/Firefox.app/Contents/MacOS/firefox"+' \"'+arg+'\" & 2> /dev/null')

but this doesnt work at all: I get a "Firefox is already running" window - while under Linux my url gets loaded in a new tab.

I tried the -remote switch, without effect

Any suggestions?

Upvotes: 2

Views: 2361

Answers (2)

jazz
jazz

Reputation: 2379

To be more specific, to choose Firefox, if it is not the standard browser on the OS:

>>> import webbrowser
>>> controller = webbrowser.get('Firefox')
>>> controller.open('http://www.google.com')
True

Upvotes: 4

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798744

webbrowser

Upvotes: 2

Related Questions