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
|