-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Webbrowser Module Cannot Find xdg-settings on OSX #85920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The following code does not work on many OSX installations of Python via homebrew:
And throws the following error stack trace: File "/usr/local/opt/python@3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8/webbrowser.py", line 26, in register The only workaround right now is to modify webbrowser.py via the instructions here: jupyter/notebook#3746 (comment). Thank you for resolving. |
It is far from clear what's going on here. In particular, it not clear to my why check_output(['xdg-settings', ...]) would ever raise NotADirectoryError.
|
That does seem very odd but the issue clearly has been seen by multiple users. Since it shouldn't cause any negative effects, I'm in favor of just adding NotADirectoryError to the try/except list as suggested in the workaround and make the problem go away. |
I've created a PR that ignores this exception. |
Is it possible that your PATH contains a non-directory? Because it can give results a NotADirectoryError: >>> subprocess.check_output(['xdg-settings', 'get', 'default-web-browser'], env={'PATH': '/etc/hosts'})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/serhiy/py/cpython/Lib/subprocess.py", line 429, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/home/serhiy/py/cpython/Lib/subprocess.py", line 510, in run
with Popen(*popenargs, **kwargs) as process:
File "/home/serhiy/py/cpython/Lib/subprocess.py", line 962, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/home/serhiy/py/cpython/Lib/subprocess.py", line 1840, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
NotADirectoryError: [Errno 20] Not a directory: 'xdg-settings' Reopened because I afraid that there may be a severe configuration error hidden by silencing NotADirectoryError. Could you please show os.environ['PATH'] on your computer? |
Ignoring $ PATH=/etc/hosts ls
zsh: command not found: ls IMHO ignoring I'm therefore reclining the issue. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: