New submission from Jason <ja...@theograys.com>: Description: When BROWSER is set, webbrowser.get fails because register_standard_browsers throws an error.
Work around: You can still use `webbroswer._browsers[key][1].open(url)` to open a browser. Operating system: macOS High Sierra v10.13.6 Reproduction 1: ``` ➜ BROWSER=lynx python3 Python 3.7.0 (default, Jul 23 2018, 20:22:55) [Clang 9.1.0 (clang-902.0.39.2)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import webbrowser >>> webbrowser.get() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/webbrowser.py", line 42, in get register_standard_browsers() File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/webbrowser.py", line 567, in register_standard_browsers cmd = _synthesize(cmdline, -1) File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/webbrowser.py", line 116, in _synthesize register(browser, None, controller, update_tryorder) TypeError: register() takes from 2 to 3 positional arguments but 4 were given ``` Reproduction 2: ``` ➜ BROWSER=lynx python3 Python 3.7.0 (default, Jul 23 2018, 20:22:55) [Clang 9.1.0 (clang-902.0.39.2)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import webbrowser >>> webbrowser.register_standard_browsers() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/webbrowser.py", line 567, in register_standard_browsers cmd = _synthesize(cmdline, -1) File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/webbrowser.py", line 116, in _synthesize register(browser, None, controller, update_tryorder) TypeError: register() takes from 2 to 3 positional arguments but 4 were given >>> webbrowser.lynx Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: module 'webbrowser' has no attribute 'lynx' >>> webbrowser._browsers {'macosx': [None, <webbrowser.MacOSXOSAScript object at 0x10df412e8>], 'chrome': [None, <webbrowser.MacOSXOSAScript object at 0x10df41358>], 'firefox': [None, <webbrowser.MacOSXOSAScript object at 0x10df485c0>], 'safari': [None, <webbrowser.MacOSXOSAScript object at 0x10df48b70>], 'lynx': [None, <webbrowser.GenericBrowser object at 0x10e014198>]} >>> webbrowser._browsers['lynx'].open('http://google.com') Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'list' object has no attribute 'open' >>> webbrowser._browsers['lynx'][1].open('http://google.com') # This works True ``` ---------- components: macOS messages: 322439 nosy: ned.deily, ograycode, ronaldoussoren priority: normal severity: normal status: open title: When BROWSER is set on Mac webbrowser.register_standard_browsers doesn't work type: crash versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34238> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com