Skip to content

Commit 371c335

Browse files
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. (cherry picked from commit 23831a7) Co-authored-by: Ronald Oussoren <[email protected]>
1 parent 2e5bd4f commit 371c335

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Lib/webbrowser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ def register_standard_browsers():
550550
cmd = "xdg-settings get default-web-browser".split()
551551
raw_result = subprocess.check_output(cmd, stderr=subprocess.DEVNULL)
552552
result = raw_result.decode().strip()
553-
except (FileNotFoundError, subprocess.CalledProcessError, PermissionError) :
553+
except (FileNotFoundError, subprocess.CalledProcessError, PermissionError, NotADirectoryError) :
554554
pass
555555
else:
556556
global _os_preferred_browser
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
webbrowser: Ignore *NotADirectoryError* when calling ``xdg-settings``.

0 commit comments

Comments
 (0)