[oauth] catch exception from 'webbrowser.get()' (#3947)

It raises an exception instead of returning None
when no runnable browser is available.
This commit is contained in:
Mike Fährmann
2023-04-23 15:00:09 +02:00
parent b81ce381f0
commit a05120412a

View File

@@ -71,8 +71,11 @@ class OAuthBase(Extractor):
browser = self.config("browser", True)
if browser:
import webbrowser
browser = webbrowser.get()
try:
import webbrowser
browser = webbrowser.get()
except Exception:
browser = None
if browser and browser.open(url):
name = getattr(browser, "name", "Browser")