michael-lazar / rtv

Browse Reddit from your terminal
MIT License
4.64k stars 274 forks source link

NotADirectoryError: [Errno 20] Not a directory: 'xdc-settings' #571

Closed phlind closed 6 years ago

phlind commented 6 years ago

When I run rtv I get the following error:

Traceback (most recent call last):
  File "/usr/local/bin/rtv", line 11, in <module>
    load_entry_point('rtv==1.23.0', 'console_scripts', 'rtv')()
  File "/usr/local/Cellar/rtv/1.23.0_1/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 476, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/Cellar/rtv/1.23.0_1/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2700, in load_entry_point
    return ep.load()
  File "/usr/local/Cellar/rtv/1.23.0_1/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2318, in load
    return self.resolve()
  File "/usr/local/Cellar/rtv/1.23.0_1/libexec/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2324, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/Cellar/rtv/1.23.0_1/libexec/lib/python3.7/site-packages/rtv/__main__.py", line 254, in <module>
    sys.exit(main())
  File "/usr/local/Cellar/rtv/1.23.0_1/libexec/lib/python3.7/site-packages/rtv/__main__.py", line 168, in main
    patch_webbrowser()
  File "/usr/local/Cellar/rtv/1.23.0_1/libexec/lib/python3.7/site-packages/rtv/objects.py", line 37, in patch_webbrowser
    webbrowser.register('surf', None, webbrowser.BackgroundBrowser('surf'))
  File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/webbrowser.py", line 26, in register
    register_standard_browsers()
  File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/webbrowser.py", line 531, in register_standard_browsers
    raw_result = subprocess.check_output(cmd, stderr=subprocess.DEVNULL)
  File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 376, in check_output
    **kwargs).stdout
  File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 453, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 756, in __init__
    restore_signals, start_new_session)
  File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1499, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
NotADirectoryError: [Errno 20] Not a directory: 'xdc-settings'

I installed it with homebrew.

michael-lazar commented 6 years ago

Thanks for the bug report. My initial guess is that it has something to do with python 3.7, since that version hasn't really been tested with RTV yet.

phlind commented 6 years ago

Is there maybe an option to run it with Python 3.6 then (when installing with pip or with brew)?

Edit: Nevermind, I just had to use 'pip' instead of 'pip3' of course.

michael-lazar commented 6 years ago

You could also do python3.6 -m pip install to point to a specific version of python. It definitely looks like a bug in python, the web browser library is expecting a "file not found" error, and it doesn't handle a "directory not found" error:

https://github.com/python/cpython/blob/3.7/Lib/webbrowser.py#L532

Interestingly this doesn't appear to be linked to python 3.7 It works for me with python 3.7 on macOS 10.13.4. You might have something else funky on your system that's causing this.

michael-lazar commented 6 years ago

@phlind do you have a file or directory named xdc-settings or xdg-settings in your $PATH?