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
Make webbrowser support Chrome on Mac OS X #68640
Comments
This doesn't work on Python 3.4 on a Mac with Yosemite and Chrome installed: import webbrowser
webbrowser.get("chrome") This patch makes it work:
|
I must add that it doesn't work on Windows 7, Python 3.4.3, either. I do have chrome.exe on the %PATH% and executing 'chrome' in Windows Command Prompt opens up the Chrome browser nicely, but it doesn't work so nicely by doing this: import webbrowser
webbrowser.get("chrome") I get this error message:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Python 3.4\lib\webbrowser.py", line 51, in get
raise Error("could not locate runnable browser")
webbrowser.Error: could not locate runnable browser |
Boštjan Mejak the windows issue has been addressed in bpo-8232 and recently patched for 3.5. http://bugs.python.org/issue8232 |
Well... I created a patch based on Ned's code :) This now works in the default branch Python 3.7.0a0 (default:f2204eaba685+, Oct 5 2016, 20:43:44)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import webbrowser
>>> webbrowser.get("chrome")
<webbrowser.MacOSXOSAScript object at 0x10adc7398>
>>> webbrowser.open_new("https://www.python.org")
True Please review :) |
The patch looks good to me. (The test coverage for chrome browser can be improved. But that seems a like a different change than the current one). |
OK, this seems to work for me. I'm, applying this to 3.5, 3.6 and 3.7 (default). |
New changeset bd0f502c5eea by Guido van Rossum in branch '3.5': New changeset 64a38f9aee21 by Guido van Rossum in branch '3.6': |
New changeset 4e2cce65e522 by Guido van Rossum in branch 'default': |
I applied this to 3.5, 3.6 and 3.7. I'm not sure we should also apply this to 2.7 -- optinions? Bug or feature? |
The documentation seems to indicate that chrome MacOS is supposed to work in 2.7, which makes this a bug. https://docs.python.org/2.7/library/webbrowser.html?highlight=webbrowser#module-webbrowser But... it could also be a documentation bug. |
Applying on 2.7 seems alright. Bug fix. |
OK will do. |
New changeset bc8a4b121aec by Guido van Rossum in branch '2.7': |
Thanks everyone! Applied to 2.7, so closing as fixed now. |
New changeset 0c8270cbdc62 by Brett Cannon in branch 'default': |
I have Windows 10, 64-bit, and Python 3.6.1, 64-bit, and the code still does not work! >>> import webbrowser
>>> webbrowser.get("chrome")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Python 3.6\lib\webbrowser.py", line 51, in get
raise Error("could not locate runnable browser")
webbrowser.Error: could not locate runnable browser Note: Yes, my Google Chrome browser was running when this command was executed. |
Hi Boštjan Mejak, this ticket addresses the change for MacOS. |
Misc/NEWS
so that it is managed by towncrier #552Note: 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: