-
-
Notifications
You must be signed in to change notification settings - Fork 29.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webbrowser.get("firefox") does not work on Mac with installed Firefox #51441
Comments
I have Firefox and Safari installed on my Mac. Safari is the default. I wanted to try out Crunchy (http://code.google.com/p/crunchy/). It's It starts the web browser with the following.
On my Mac, webbrowser.get("firefox") fails, so this ends up opening in Thing is, I have Firefox installed, so it should work. But the Mac code in The following bit of code works well enough to get crunchy to work class MacOSXFirefox(BaseBrowser):
def open(self, url, new=0, autoraise=True):
subprocess.check_call(["/usr/bin/open", "-b",
"org.mozilla.firefox", url])
but I don't know enough about the Mac nor about webbrowser to know if I'm Attached is the full diff. |
Firefox doesn't seem to support a full scripting api, which makes opening tabs and windows harder. I've committed an alternate version of your patch in r80698: This uses osascript to open the url instead of the open command. I've also added a registration for "safari". The main reason to use osascript instead of just open is that it might be possible to add support for opening new tabs or windows later on by adjusting the script. |
I've ported the change to 3.2 as well. |
bpo-8238 notes the problem with autoraise and new on windows. I believe when I looked at that issue that I confirmed that the syntax webbrowser uses on Linux to support those options works on windows with the current firefox, even though I couldn't find them documented anywhere. If I'm remembering correctly, then I would expect them to work on Mac, as well. Webbrowser needs to be refactored so that browser specific support is not not required to be also platform specific. |
R. David Murray: the issue you refer to isn't the one you intend to link to, it is related to proxy settings and doesn't contain a patch related to firefox. |
BTW. The firebox-bin binary in Firefox.app/Contents/MacOS does not support the command-line arguments that Firefox on Linux supports. That is, the following command does not work: /Applications/Firefox.app/Contents/MacOS/firefox-bin -remote 'openURL("http://www.apple.com/",new-tab)' This will start the firefox binary, but that complains that firefox is already running (because I already had FF open) This means that it won't be possible to have one Firefox support class that works the same on all platforms. |
16:05:57 l0nwlf-MBP:/Applications/Firefox.app/Contents/MacOS$ ./firefox-bin 'http://www.google.com' Also,
>>> import webbrowser
>>> url = 'http://www.google.com'
>>> c = webbrowser.get('safari')
>>> c.open(url)
True
Opens two instances of safari, one with home-page and another with url mentioned. Initially safari was not running and firefox is my default browser. Incase safari is running it opens only one instance with url(google homepage) opened. |
I'm closing this issue:
|
I searched for proxy+firefox on roundup and the only two issue I got was bpo-8238 and bpo-1160328. None of them seems related to webbrowser. |
Sorry, I have no idea where that issue number came from. The correct issue is bpo-812089. I just retested, and despite -remote being currently undocumented, it works on my windows VM with a current (3.6) version of firefox, and that the actions (eg: new-window) work as well. I don't currently have an OS X machine to test on, although that may change this week. |
I tested on OSX with a current version of FF and it didn't work. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: