summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2020-11-08 09:46:55 (GMT)
committerGitHub <noreply@github.com>2020-11-08 09:46:55 (GMT)
commit23831a7a90956e38b7d70304bb6afe30d37936de (patch)
treebf6b44fcd0786ccb770d677fdfd92f10fb506cd3
parent41761933c1c30bb6003b65eef1ba23a83db4eae4 (diff)
downloadcpython-23831a7a90956e38b7d70304bb6afe30d37936de.zip
cpython-23831a7a90956e38b7d70304bb6afe30d37936de.tar.gz
cpython-23831a7a90956e38b7d70304bb6afe30d37936de.tar.bz2
bpo-41754: Ignore NotADirectoryError in invocation of xdg-settings (GH-23075)
It is not clear why this can happen, but several users have mentioned getting this exception on macOS.
-rwxr-xr-xLib/webbrowser.py2
-rw-r--r--Misc/NEWS.d/next/Library/2020-11-01-15-07-20.bpo-41754.DraSZh.rst1
2 files changed, 2 insertions, 1 deletions
diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py
index cea9130..6023c1e 100755
--- a/Lib/webbrowser.py
+++ b/Lib/webbrowser.py
@@ -550,7 +550,7 @@ def register_standard_browsers():
cmd = "xdg-settings get default-web-browser".split()
raw_result = subprocess.check_output(cmd, stderr=subprocess.DEVNULL)
result = raw_result.decode().strip()
- except (FileNotFoundError, subprocess.CalledProcessError, PermissionError) :
+ except (FileNotFoundError, subprocess.CalledProcessError, PermissionError, NotADirectoryError) :
pass
else:
global _os_preferred_browser
diff --git a/Misc/NEWS.d/next/Library/2020-11-01-15-07-20.bpo-41754.DraSZh.rst b/Misc/NEWS.d/next/Library/2020-11-01-15-07-20.bpo-41754.DraSZh.rst
new file mode 100644
index 0000000..181c2d9
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-11-01-15-07-20.bpo-41754.DraSZh.rst
@@ -0,0 +1 @@
+webbrowser: Ignore *NotADirectoryError* when calling ``xdg-settings``.