Question

I have Chrome configured as my default browser, on Mountain Lion.

At the end of my Python 2.7.4 program I have the following:

import webbrowser
webbrowser.open('http://example.com')

Sometimes instead of opening the tab as the documentation suggests will happen this command will focus Google Chrome, without opening the URL in a new tab.

I'm not even sure where to start debugging this (there are no errors on the Python side, at least). I'd appreciate some ideas about where to start looking.

Was it helpful?

Solution

It looks like there's Chrome specific code in the webbrowser 2.7 source code:

http://hg.python.org/cpython/file/2.7/Lib/webbrowser.py

However when I opened the Python file on my computer, it was running an earlier version of the webbrowser.py source code, without the Chrome specific flags.

I updated the source code on my system with the latest code (from the website) and it's running in Chrome without any problems.

It's also been fixed in Python 3.3, I am assured.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top