Skip to content
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

Ranger crashed when asked to Trash a directory #2644

Closed
1024-Kibibytes opened this issue Jun 13, 2022 · 3 comments
Closed

Ranger crashed when asked to Trash a directory #2644

1024-Kibibytes opened this issue Jun 13, 2022 · 3 comments

Comments

@1024-Kibibytes
Copy link

Runtime Environment

  • Operating system and version:
  • Terminal emulator and version:
  • Python version:
  • Ranger version/commit:
  • Locale:

Debian testing on WSL 2
ranger version: ranger 1.9.3
Python version: 3.10.5 (main, Jun 8 2022, 09:26:22) [GCC 11.3.0]
Locale: en_US.UTF-8

Current Behavior

Ranger crashes

Expected Behavior

Trashing the directory or an error message if it can't trash the directory.

Context

I tried to trash a file. I'm not 100% sure I have the trash set up on this installation, but an error message would be better than Ranger crashing.

Possible Solutions

Trash the directory or put an error message if Ranger can't trash it.

Steps to reproduce

  1. Start Ranger
  2. Click on a Directory
  3. Press the d key.
  4. Press the T key.
  5. See :trash. press the Enter key.
  6. See Ranger ask for confirmation. Press the Y key.
  7. See Ranger crash and ask for the Traceback below.

Traceback

 ranger
ranger version: ranger 1.9.3
Python version: 3.10.5 (main, Jun  8 2022, 09:26:22) [GCC 11.3.0]
Locale: en_US.UTF-8
Current file: '/home/paul/nvim-linux64'

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/ranger/core/main.py", line 201, in main
    fm.loop()
  File "/usr/lib/python3/dist-packages/ranger/core/fm.py", line 383, in loop
    ui.handle_input()
  File "/usr/lib/python3/dist-packages/ranger/gui/ui.py", line 266, in handle_input
    self.handle_key(key)
  File "/usr/lib/python3/dist-packages/ranger/gui/ui.py", line 196, in handle_key
    elif not DisplayableContainer.press(self, key):
  File "/usr/lib/python3/dist-packages/ranger/gui/displayable.py", line 275, in press
    focused_obj.press(key)
  File "/usr/lib/python3/dist-packages/ranger/gui/widgets/console.py", line 188, in press
    self.type_key(key)
  File "/usr/lib/python3/dist-packages/ranger/gui/widgets/console.py", line 214, in type_key
    self._answer_question(answer)
  File "/usr/lib/python3/dist-packages/ranger/gui/widgets/console.py", line 197, in _answer_question
    callback(answer)
  File "/usr/lib/python3/dist-packages/ranger/config/commands.py", line 759, in _question_callback
    self.fm.execute_file(files, label='trash')
  File "/usr/lib/python3/dist-packages/ranger/core/actions.py", line 459, in execute_file
    filenames = [f.path for f in files]
  File "/usr/lib/python3/dist-packages/ranger/core/actions.py", line 459, in <listcomp>
    filenames = [f.path for f in files]
AttributeError: 'str' object has no attribute 'path'

ranger crashed. Please report this traceback at:
https://github.com/ranger/ranger/issues
@1024-Kibibytes
Copy link
Author

I've since installed trash-cli and get the same result. If I try to trash a file instead of a directory, I get "'str' object has no attribute 'path'".

@BeCracked
Copy link

Same thing happened to me on arch. Under other circumstances (I can't fully recall which) ranger spouted out the same error but without crashing.
If I can reproduce it I will post here again.

@toonn
Copy link
Member

toonn commented Nov 18, 2022

Fixed in #1871.

@toonn toonn closed this as completed Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants