]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-41754: Ignore NotADirectoryError in invocation of xdg-settings (GH-23075) (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 8 Nov 2020 12:06:17 +0000 (04:06 -0800)
committerGitHub <noreply@github.com>
Sun, 8 Nov 2020 12:06:17 +0000 (13:06 +0100)
It is not clear why this can happen, but several users have mentioned
getting this exception on macOS.
(cherry picked from commit 23831a7a90956e38b7d70304bb6afe30d37936de)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Lib/webbrowser.py
Misc/NEWS.d/next/Library/2020-11-01-15-07-20.bpo-41754.DraSZh.rst [new file with mode: 0644]

index cea91308ce1b30f324d3a71b921c81a3749e8f6e..6023c1e13841d2b21937bb285127df69ab2bd4c2 100755 (executable)
@@ -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 (file)
index 0000000..181c2d9
--- /dev/null
@@ -0,0 +1 @@
+webbrowser: Ignore *NotADirectoryError* when calling ``xdg-settings``.