Shouldn't the following code open a web browser?
import webbrowser
url = 'www.yahoo.com'
webbrowser.open(url)
Shouldn't the following code open a web browser?
import webbrowser
url = 'www.yahoo.com'
webbrowser.open(url)
The URL needs to start with a protocol (usually http:// or https://), otherwise nothing happens (although True is returned).
Note that "http", "https" and "file" open in the built-in browser, which seems fairly useless if you are building a stand-alone app. You have to use "safari-" at the start of the protocol to open in Safari.
Wish there was an option for webbrowser.open to leave it for the OS to open, regardless of the URL.
@mikael - thank you for the additional information regarding the Safari URL scheme. I understand your opinion about the use of the built in browser and I agree. I normally would create my own browser or launch in Safari as you mentioned.
However, actually I have found it quite nice to have the webbrowser module if your stand alone app needs to display documentation, certain media, etc.