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 crashes when deleting to Trash #1798

Closed
w2kpro opened this issue Dec 30, 2019 · 14 comments · Fixed by #1871
Closed

Ranger crashes when deleting to Trash #1798

w2kpro opened this issue Dec 30, 2019 · 14 comments · Fixed by #1871
Labels
Milestone

Comments

@w2kpro
Copy link

w2kpro commented Dec 30, 2019

OS: Linuxmint 19.3
Python: 3.6.9
Ranger: v1.9.2
trash-cli: 0.12.9.14-2.1

When deleting a highlighted file to trash, I get the following error:
"object has no attribute 'path'"

When deleting a (one) selected file to trash, I am asked to confirm delete, and after inputing 'y' ranger crashes.

ranger version: ranger-master
Python version: 3.6.9 (default, Nov 7 2019, 10:44:02) [GCC 8.3.0]
Locale: en_GB.UTF-8
Current file: '/home/standard_user/file.txt'

Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/ranger/core/main.py", line 201, in main
fm.loop()
File "/usr/local/lib/python3.6/dist-packages/ranger/core/fm.py", line 383, in loop
ui.handle_input()
File "/usr/local/lib/python3.6/dist-packages/ranger/gui/ui.py", line 279, in handle_input
self.handle_key(key)
File "/usr/local/lib/python3.6/dist-packages/ranger/gui/ui.py", line 209, in handle_key
elif not DisplayableContainer.press(self, key):
File "/usr/local/lib/python3.6/dist-packages/ranger/gui/displayable.py", line 271, in press
focused_obj.press(key)
File "/usr/local/lib/python3.6/dist-packages/ranger/gui/widgets/console.py", line 188, in press
self.type_key(key)
File "/usr/local/lib/python3.6/dist-packages/ranger/gui/widgets/console.py", line 214, in type_key
self._answer_question(answer)
File "/usr/local/lib/python3.6/dist-packages/ranger/gui/widgets/console.py", line 197, in _answer_question
callback(answer)
File "/usr/local/lib/python3.6/dist-packages/ranger/config/commands.py", line 757, in _question_callback
self.fm.execute_file(files, label='trash')
File "/usr/local/lib/python3.6/dist-packages/ranger/core/actions.py", line 458, in execute_file
filenames = [f.path for f in files]
File "/usr/local/lib/python3.6/dist-packages/ranger/core/actions.py", line 458, in
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

Thank you for contributing to ranger by opening this issue.
Please check through this list, so you can be as helpful as possible:

1. Was this issue already reported?  Please do a quick search.
2. Maybe the problem is solved in the current master branch already?
   Simply clone ranger's git repository and run ./ranger.py to find out.
3. Provide all the relevant information, as outlined in this template.
   Feel free to remove any sections you don't need.

-->

Runtime Environment

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

Current Behavior

Expected Behavior

Context

Possible Solutions

Steps to reproduce

Traceback


@toonn
Copy link
Member

toonn commented Dec 30, 2019

How did you invoke the trash command?

@magnetophon
Copy link

magnetophon commented Jan 7, 2020

I'm having the same issue with 1.9.3.
This is what I did: nothing marked, put cursor on file, hit dT, hit enter, confirm with y -> crash

@w2kpro
Copy link
Author

w2kpro commented Jan 8, 2020

Just compiled v1.9.3 and get the same crash as above. Also, "open_with" key 'r', no longer works!

@toonn toonn added the bug label Jan 8, 2020
@toonn
Copy link
Member

toonn commented Jan 8, 2020

@w2kpro, this is a confirmed bug yes. Wasn't labeled because of oversight. However, I can't reproduce your problem with the r keybinding. Please open a separate issue on that if you can reproduce it when running ranger --clean.

@iharsuvorau
Copy link

Crashes while trying to trash a directory. Steps to reproduce:

  • mark a dir with space
  • d
  • T
  • enter
  • y
ranger version: ranger 1.9.3
Python version: 2.7.16 (default, Nov  9 2019, 05:55:08) [GCC 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.32.4) (-macos10.15-objc-s
Locale: None.None
Current file: '/Users/ihar/projects/bahna cms/devel/editor/testdata/fooSite/content/en/wetland/ru/bolota'

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

@xuelvming
Copy link

Yep, Got the same issue here in mac , installed through homebrew

brew info ranger
ranger: stable 1.9.3, HEAD
File browser
https://ranger.github.io
/usr/local/Cellar/ranger/1.9.3 (187 files, 1.4MB) *
  Built from source on 2020-02-16 at 19:38:42
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/ranger.rb
==> Options
--HEAD
	Install HEAD version
==> Analytics
install: 2,645 (30 days), 8,257 (90 days), 20,879 (365 days)
install-on-request: 2,552 (30 days), 7,956 (90 days), 20,366 (365 days)
build-error: 0 (30 days)

@Augists
Copy link

Augists commented May 14, 2020

So why closed?
It only occurs on mac?
I have to throw away my dT...:(
There IS a bug

@toonn
Copy link
Member

toonn commented May 14, 2020

@Augists, I closed your issue because this one is the same problem. No need to track it in multiple threads, just gets confusing.

@salkin-mada
Copy link

have it here too it seems

ranger version: ranger 1.9.3
Python version: 3.8.5 (default, Jul 27 2020, 08:42:51) [GCC 10.1.0]
Locale: en_DK.UTF-8
Current file: '/home/salkin/Downloads/FNET-master.zip'

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

@magnetophon
Copy link

magnetophon commented Aug 17, 2020

@salkin-mada Please read the comment before yours

@salkin-mada
Copy link

salkin-mada commented Aug 18, 2020

Hi @magnetophon I did. Maybe I am mistaking but the comment just says someones other issue was closed and it references that #2050 was closed in favor of this issue #1798 ?
Also just now i see there is a Pull related #1871

@toonn
Copy link
Member

toonn commented Aug 18, 2020

Yep, to be clear, THIS is the open/active issue.

@magnetophon
Copy link

@salkin-mada Hmm, I didn't read properly, yet told you to read... Sorry.

@AXGKl
Copy link

AXGKl commented Mar 23, 2021

until fixed here a hack which works for me:

File "/usr/lib/python3.8/site-packages/ranger/core/actions.py", line 459, in <listcomp>
    filenames = [f.path for f in files]

change the line to

   filenames = [f if isinstance(f, str) else f.path for f in files]

Use at your own risk though, no guarantees.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants