This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: webbrowser BROWSER with MacOSXOSAScript type
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.7, Python 3.6, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: michael-lazar
Priority: normal Keywords:

Created on 2017-09-05 02:34 by michael-lazar, last changed 2022-04-11 14:58 by admin.

Messages (1)
msg301294 - (view) Author: Michael Lazar (michael-lazar) * Date: 2017-09-05 02:34
Hello,

I have found that [1] is an open issue, but I have discovered what appears to be a completely separate bug than the one described in that ticket. The issue is that there is no way to specify a MacOSXOSAScript browser using the BROWSER variable. The _synthesize() command fails at the "if not shutil.which(cmd)" line, because OSAScript browsers are not commands in the system path. As a result, the value specified by BROWSER will get re-mapped to a GenericBrowser type, which is useless for most people on macOS.

Here's an example:

$ BROWSER=firefox python3
Python 3.6.1 (default, Apr  4 2017, 09:36:47)
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import webbrowser
>>> for name in webbrowser._tryorder:
...     print('%s: %s' % (name, webbrowser._browsers[name.lower()]))
...
firefox: [None, <webbrowser.GenericBrowser object at 0x100f35198>]
MacOSX: [None, <webbrowser.MacOSXOSAScript object at 0x100f35748>]
chrome: [None, <webbrowser.MacOSXOSAScript object at 0x100f76f28>]
firefox: [None, <webbrowser.GenericBrowser object at 0x100f35198>]
safari: [None, <webbrowser.MacOSXOSAScript object at 0x100f76ef0>]
links: [None, <webbrowser.GenericBrowser object at 0x100e67b70>]
elinks: [None, <webbrowser.Elinks object at 0x100f17fd0>]
lynx: [None, <webbrowser.GenericBrowser object at 0x100f76048>]
w3m: [None, <webbrowser.GenericBrowser object at 0x100f76588>]

Note that on macOS, firefox is defined in the webbrowser module as

    register("firefox", None, MacOSXOSAScript('firefox'), -1)


[1] http://bugs.python.org/issue24955
History
Date User Action Args
2022-04-11 14:58:51adminsetgithub: 75529
2017-09-05 02:34:57michael-lazarcreate