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 23831a7a90)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
This commit is contained in:
Miss Islington (bot) 2020-11-08 02:07:44 -08:00 committed by GitHub
parent 2e5bd4f677
commit 371c33567a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -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

View File

@ -0,0 +1 @@
webbrowser: Ignore *NotADirectoryError* when calling ``xdg-settings``.