1

I've looked online in numerous spots and it looks like I'm not the only person having this error on a mac running OS10.11.15 using python 3.5.2 and running the code in IDLE.

The weird thing is it worked once and then didn't work after that. I've tried restarting the Mac, shutting IDLE down and then using all sorts of commands I've found in the documentation and through sites like this. When I use:

webbrowser._tryorder

I get:

['MacOSX', 'firefox', 'safari']

When Chrome is my default browser and has been for ages.

I use:

webbrowser.get('/Applications/Google Chrome.app') and this happens;

Traceback (most recent call last): File "", line 1, in webbrowser.get('/Applications/Google Chrome.app') File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/webbrowser.py", line 51, in get raise Error("could not locate runnable browser") webbrowser.Error: could not locate runnable browser

I then tried to regsiter the web browser Chrome using the list from the python docs and when I put the "update_tryorder=1" argument in, this happens;

webbrowser.register('chrome', None, update_tryorder = 1)
webbrowser._tryorder

['MacOSX', 'firefox', 'safari', 'chrome']

HELP !! I'm fairly new to Python and coding in general so won't even speculate as to what the issue is here. Thank you in advance !!

HNasser
  • 29
  • 4
  • 1
    http://stackoverflow.com/questions/1555283/webbrowser-getfirefox-on-a-mac-with-firefox-could-not-locate-runnable-brows?rq=1 – Scott Stainton Sep 05 '16 at 08:28
  • Thanks Scott although my issue was even sillier than that and I have now fixed it. My problem was not that the browser wasn't recognised it was that when you pass arguments to webbrowser.open() you need to include 'http://" before the website address. It took me an hour to figure that out. Very irritating. Hopefully this helps others. – HNasser Sep 05 '16 at 08:34

1 Answers1

0

The thread that Scott Stainton pointed out has the correct answer, you need to pass this command in with webbrowser.get

client = webbrowser.get("open -a /Applications/Firefox.app %s")

as MacOSX is using Launch Services to find the app.

easy_c0mpany80
  • 327
  • 1
  • 7
  • 18