webbrowser.open always opens up Safari on Lion

Anthony Nguyen anknguyen at gmail.com
Sun Feb 26 04:38:25 CET 2012


If Safari is your default browser, Python will open the address in Safari.

>From the Python docs:

webbrowser.open(url[, new=0[, autoraise=True]])

Display url using the default browser. If new is 0, the url is opened in
the same browser window if possible. If new is 1, a new browser window is
opened if possible. If new is 2, a new browser page (“tab”) is opened if
possible. If autoraise is True, the window is raised if possible (note that
under many window managers this will occur regardless of the setting of
this variable).

Note that on some platforms, trying to open a filename using this function,
may work and start the operating system’s associated program. However, this
is neither supported nor portable.




On Sat, Feb 25, 2012 at 8:33 PM, Leo <sdl.web at gmail.com> wrote:
>
> Hello,
>
> On Lion and with its stock python version 2.7.1 r271:86832,
> webbrowser.open('file://localhost/nonexistingfile') always opens up
> Safari. Is this a bug?
>
> Leo
> --
> http://mail.python.org/mailman/listinfo/python-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120225/8ae5cb0f/attachment.html>


More information about the Python-list mailing list