ranger / ranger

A VIM-inspired filemanager for the console
https://ranger.fm
GNU General Public License v3.0
15.39k stars 884 forks source link

Ranger crashes when over non-text-files #1136

Open simeonschaub opened 6 years ago

simeonschaub commented 6 years ago

Runtime Environment

Current Behavior

Ranger crashes when in my Home-Directory and moving the cursor over a *.AppImage file. But also seems to occur when moving it over images, music files, odt-documents, but not pdf or txt files.

Expected Behavior

Context

Possible Solutions

Might have something to do with the preview feature.

Steps to reproduce

  1. Open ranger in any directory
  2. Move selection over any file that's not pdf, plain text or an executable
  3. ranger crashes immediately

Traceback

ranger version: ranger-master 1.9.1
Python version: 3.6.4 (default, Jan  5 2018, 02:35:40) [GCC 7.2.1 20171224]
Locale: en_US.UTF-8
Current file: '/home/simeon/etcher-1.3.1-x86_64.AppImage'

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/ranger/core/main.py", line 196, in main
    fm.loop()
  File "/usr/lib/python3.6/site-packages/ranger/core/fm.py", line 390, in loop
    ui.redraw()
  File "/usr/lib/python3.6/site-packages/ranger/gui/ui.py", line 338, in redraw
    self.draw()
  File "/usr/lib/python3.6/site-packages/ranger/gui/ui.py", line 365, in draw
    DisplayableContainer.draw(self)
  File "/usr/lib/python3.6/site-packages/ranger/gui/displayable.py", line 256, in draw
    displayable.draw()
  File "/usr/lib/python3.6/site-packages/ranger/gui/widgets/view_miller.py", line 100, in draw
    DisplayableContainer.draw(self)
  File "/usr/lib/python3.6/site-packages/ranger/gui/displayable.py", line 256, in draw
    displayable.draw()
  File "/usr/lib/python3.6/site-packages/ranger/gui/widgets/browsercolumn.py", line 176, in draw
    self._draw_file()
  File "/usr/lib/python3.6/site-packages/ranger/gui/widgets/browsercolumn.py", line 203, in _draw_file
    Pager.draw(self)
  File "/usr/lib/python3.6/site-packages/ranger/gui/widgets/pager.py", line 101, in draw
    self._draw_line(i, line)
  File "/usr/lib/python3.6/site-packages/ranger/gui/widgets/pager.py", line 132, in _draw_line
    self.addstr(chunk)
  File "/usr/lib/python3.6/site-packages/ranger/gui/curses_shortcuts.py", line 37, in addstr
    self.win.addstr(*args)
ValueError: embedded null character
mxovd commented 6 years ago

This seems like a duplicate of this issue. It has already been fixed but it's not released yet https://github.com/ranger/ranger/issues/1079

Basically, since python 3.5, a certain TypeError is now a ValueError. (https://bugs.python.org/issue22215) Either install the git version from the AUR or add "ValueError" to line 38 of this file:

/usr/lib/python3.6/site-packages/ranger/gui/curses_shortcuts.py

except (curses.error, TypeError, ValueError):