webbrowser.open always opens up Safari on Lion

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Feb 26 08:12:06 CET 2012


On Sun, 26 Feb 2012 14:23:43 +0800, Leo wrote:

> On 2012-02-26 11:36 +0800, Steven D'Aprano wrote:
>> What part of this do you think is the bug, and why? What part of the
>> behaviour actually experienced contradicts the documented behaviour of
>> webbrowser.open()?
>>
>> http://docs.python.org/library/webbrowser.html
> 
> If you have the default browser set to Chrome, it still opens up Safari.


That would only be a bug if it occurs with http:// URLs. The 
documentation clearly says:

    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.


Since you are providing a file:// URL, then the behaviour is unspecified, 
and no, it is not a bug. Arguably it is a bug that file:// URLs work at 
all.

However, I would guess that if you have a patch to fix this behaviour to 
something more reasonable (but what?) then it might be approved.

Feel free to raise a ticket on the bug tracker. Personally, I'd put it 
down as a feature request rather than a bug.



-- 
Steven



More information about the Python-list mailing list