joouha / ranger_tmux

Tmux integration for ranger
MIT License
37 stars 5 forks source link

Installation fails if ~/.config/ranger/plugins does not exist #1

Closed sashkachan closed 2 years ago

sashkachan commented 2 years ago

When following README and attempting to install, if ~/.config/ranger/plugins folder is missing, the install fails with the following error:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/opt/homebrew/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/opt/homebrew/lib/python3.9/site-packages/ranger_tmux/__main__.py", line 192, in <module>
    main()
  File "/opt/homebrew/lib/python3.9/site-packages/ranger_tmux/__main__.py", line 188, in main
    args.func(args)
  File "/opt/homebrew/lib/python3.9/site-packages/ranger_tmux/__main__.py", line 105, in install
    args.ranger_plugin_path.symlink_to(args.plugin_script_path)
  File "/opt/homebrew/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pathlib.py", line 1403, in symlink_to
    self._accessor.symlink(target, self, target_is_directory)
  File "/opt/homebrew/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pathlib.py", line 456, in symlink
    return os.symlink(a, b)
FileNotFoundError: [Errno 2] No such file or directory: '/opt/homebrew/lib/python3.9/site-packages/ranger_tmux/plugin.py' -> '/Users/sashka/.config/ranger/plugins/ranger_tmux.py'

The README does mention to clone into ranger plugin folder, but I think it may be better to allow for global pip module location install.

joouha commented 2 years ago

Thank you for reporting.

I've fixed this and made a new release. I'll also update the installation instructions, as I've uploaded this to PyPI, so you can now install it with pip install ranger-tmux.

I've also submitted a PR to ranger which would allow ranger to detect plugins installed with pip automatically, so hopefully soon there won't be a need for a manual installation step.

sohang3112 commented 1 year ago

@joouha I had the same issue while installing today in latest version 1.0.8 (I installed via pip install ranger-tmux). Creating directory ~/.config/ranger/plugins worked for now.