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

try to trash a file get crash #2571

Closed
WingDust opened this issue Feb 20, 2022 · 4 comments
Closed

try to trash a file get crash #2571

WingDust opened this issue Feb 20, 2022 · 4 comments

Comments

@WingDust
Copy link

Runtime Environment

  • Operating system and version: Linux 5.16.9-arch1-1 + i3
  • Terminal emulator and version: alacritty
  • Python version: 3.10.2
  • Ranger version/commit: ranger version: ranger 1.9.3 Python version: 3.10.2 (main, Jan 15 2022, 19:56:27) [GCC 11.1.0]
  • Locale: zh_CN.UTF-8

Current Behavior

try to trash a file get crash
and info show

Current file: '/run/media/1/z.zip'
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/ranger/core/main.py", line 201, in main
    fm.loop()
  File "/usr/lib/python3.10/site-packages/ranger/core/fm.py", line 383, in loop
    ui.handle_input()
  File "/usr/lib/python3.10/site-packages/ranger/gui/ui.py", line 266, in handle_input
    self.handle_key(key)
  File "/usr/lib/python3.10/site-packages/ranger/gui/ui.py", line 196, in handle_key
    elif not DisplayableContainer.press(self, key):
  File "/usr/lib/python3.10/site-packages/ranger/gui/displayable.py", line 275, in press
    focused_obj.press(key)
  File "/usr/lib/python3.10/site-packages/ranger/gui/widgets/console.py", line 188, in press
    self.type_key(key)
  File "/usr/lib/python3.10/site-packages/ranger/gui/widgets/console.py", line 214, in type_key
    self._answer_question(answer)
  File "/usr/lib/python3.10/site-packages/ranger/gui/widgets/console.py", line 197, in _answer_question
    callback(answer)
 File "/usr/lib/python3.10/site-packages/ranger/config/commands.py", line 759, in _question_callback
    self.fm.execute_file(files, label='trash')
  File "/usr/lib/python3.10/site-packages/ranger/core/actions.py", line 459, in execute_file
    filenames = [f.path for f in files]
  File "/usr/lib/python3.10/site-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

Expected Behavior

trash a file right

Context

Possible Solutions

Steps to reproduce

Traceback


@sarmong
Copy link

sarmong commented Feb 21, 2022

This has been fixed a year ago in #1871.

However, since ranger didn't see a release since 2019 this is still a problem for many users.

And yes, I can download master version with Homebrew, but I don't want to use unstable version of the program.

So, it would be nice if someone could point to a solution to this problem by modifying config files. (I assume it is in commands.py)

@da-the-dev
Copy link

da-the-dev commented Feb 21, 2022

This has been fixed a year ago in #1871.

However, since ranger didn't see a release since 2019 this is still a problem for many users.

And yes, I can download master version with Homebrew, but I don't want to use unstable version of the program.

So, it would be nice if someone could point to a solution to this problem by modifying config files. (I assume it is in commands.py)

I think you can re-implement the trash function properly in a plugin and use it with the lastest release of ranger. Take a look at example plugins, you can overwrite functions https://github.com/ranger/ranger/blob/master/examples/

@WingDust
Copy link
Author

May be some offend, I think use trash-cli replace origin trash feature may be better.

@toonn
Copy link
Member

toonn commented Mar 20, 2022

Ranger already uses trash-cli if it's available. This problem is in a different part of the trash code and happens whether or not trash-cli is installed. Closing as it's been fixed on master. We're doing our best to make ranger ready for a new release. Master is pretty stable though, since merges don't happen that often and problems on master tend to get fixed fast.

@toonn toonn closed this as completed Mar 20, 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

4 participants