New submission from Michael Lazar:

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

----------
components: Library (Lib)
messages: 301294
nosy: michael-lazar
priority: normal
severity: normal
status: open
title: webbrowser BROWSER with MacOSXOSAScript type
type: behavior
versions: Python 2.7, Python 3.6, Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue31348>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to