Solved Ranger file manager(sysutils/py-ranger) on FreeBSD

Hi,

There are 2 functions that do not seem to work correctly in sysutils/py-ranger:

1. Preview images - www/w3m is installed and preview image is set to True, but I get "Errno 2 No such file or directory"

2. The free space on SSD is totally wrong, it shows 669G instead of 90G.

Do you know how to fix them, esp. point 1)?

Thanks.

Edit: FreebsdFreeBSD 10.2 amd64
 
Have you tried w3m http://nongnu.org/ranger/screenshots/ on terminal? On my system it uses graphics/ImageMagick to show the screenshots when you select one of the png files using the cursor keys and pressing the enter key. w3m http://nongnu.org/ranger/screenshots/vcs.png is also worth to try because no selection is required.
 
Yes w3m does show the image using graphics/ImageMagic but I do not see how it is relevant. I think the problem lies whether "w3mimgdisplay" is installed or not. I have found reference to /usr/libexec/w3m/w3mimgdisplay in other (Linux) distros - but there is no such file in /usr/local/libexec/w3m directory.
 
Thanks, after installing www/w3m-img the file is available /usr/local/libexec/w3m/w3mimgdisplay, but something is still not OK: "Failed to execute w3mimgdisplay". I use Xterm with 24bit depth - same setting works on Debian.
 
No, apart from the 2 issues it is working fine. Probably the preview image failure is not even ranger-related.
 
No, apart from the 2 issues it is working fine.
On my system it is not the case. I have also recompiled everything which depends on ncurses. I have tried the newest ranger, too. The result is similar. I think I will write some little python test script using the curses library.
Probably the preview image failure is not even ranger-related.
I think so, too.

I have two additional questions. Are you using vt(4) and UTF8? Have you installed devel/py-ncurses? This port is not a dependency, but I have been just stumbled over it. And it seems not to help for me.
 
Probably the preview image failure is not even ranger-related.

It's probably the terminal emulator. Image previews are really only certain to work in xterm and urxvt (I've tested the latter, and it works fine). Been that way for as long as I can remember. It seems to only work sporadically with anything built against VTE, which would include GNOME Terminal, Konsole, Terminator, Termite, Xfce terminal...
 
Dear mzperx,
can you please run the code below? On a Debian system the result is as expected. On my system it is strange. The result is printed to the terminal somewhere for three seconds.
Code:
#!/usr/local/bin/python

# The output should be (5,6) and (1,1)
# Here it is (highnumer, 0) and (otherhighnumber, 0)

import time
import curses

stdscr = curses.initscr()
curses.noecho()
curses.cbreak()
stdscr.keypad(1)
stdscr.refresh()
win = stdscr.derwin(10, 10, 5, 6)
win2 = win.derwin(1, 1, 1, 1)
win.refresh()
win2.refresh()

print win.getparyx()
print win2.getparyx()
time.sleep(3)

curses.nocbreak()
stdscr.keypad(0)
curses.echo()
curses.endwin()
For me this corresponds to the crash when running ranger -d.
 
Okay, so here is my feedback:
- UTF-8 is set in .login_conf
- Yes py27-ncurses-0.3_2 is installed
- To leave no stone unturned: i installed X11/rxvt-unicode, but with same error "Failed to execute..."
- chrbr's code runs successfully with expected result (5, 6) and (1, 1)

Such a pity because it is a very nice feature, especially to select photos from a directory to be developed. Option B is to copy the whole directory and delete the unwanted images with graphics/viewnior
 
Ok, I will try on a different setup to get rid of the crash and to find the root cause. Regarding the file manager misc/vifm seems to be close to sysutils/py-ranger from the features point of view. I have tried that tempoary. x11-fm/worker is a different manager which does support image preview. May be one of those is a backup solution for you.
 
Dear mzperx,
I have had some library issue on this computer, but I am still not sure about the root cause. But now sysutils/py-ranger works. I could see the error "Errno 2 No such file or directory". But after installing www/w3m-img also image preview works. What happens if you just enter w3m some_image.jpg in a terminal?
 
Hello chrbr,

Code:
w3m image.jpg
will launch graphics/ImageMagick and show the image. Can I also have a question: I have found how to use w3mimgdisplay in terminal:
Code:
echo -e '0;1;0;0;200;160;;;;;image.jpg\n4;\n3;' | /usr/local/libexec/w3m/w3mimgdisplay
I assume that works for you? Also, can you run:
Code:
/usr/local/libexec/w3m/w3mimgdisplay --help

Nothing happens for me. Thanks.
 
Dear mzperx,
all three code blocks work similar with the same output on my system. I have copied hopefully relevant lines from my ~/.config/ranger/rc.conf which allows image preview. I have disabled the preview script to make sure that it is not relevant. May be this helps.
Code:
set column_ratios 1,3,4
set hidden_filter ^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$
set show_hidden false
set confirm_on_delete multiple
set preview_script ~/.config/ranger/scope.sh
set use_preview_script false
set automatically_count_files true
set open_all_images true
set preview_images true
set preview_images_method w3m
set unicode_ellipsis false
set show_hidden_bookmarks true
set colorscheme default
set preview_files true
set preview_directories true
set collapse_preview true
 
Today I have rebuild everything because I wanted to try ports-mgmt/poudriere. Now
Code:
echo -e '0;1;0;0;200;160;;;;;image.jpg\n4;\n3;' | /usr/local/libexec/w3m/w3mimgdisplay
gives no output anymore which is less than your result. Now I am not sure anymore how sysutils/ranger and www/w3m-img could work previously. The configuration files have not changed. I have the original situation in a full backup, just in case. Now I have the situation as you describe above "Failed to execute w3mimgdisplay".
 
To be honest: I am just a layman and it looks like to problem and especially the fix are beyond knowledge. I will follow this post but not able to add value anymore. Thanks for your help and suggestions though.
 
Dear mzperx,
may be I have tracked it down somehow. In ranger/ext/img_display.py a process is started to retrieve the size of the image. The result should be a list of two integers. If the result is different the error pops up. In my situation there was no result. ps shows a zombie after ranger tried to preview an image.
Regarding the testing there is the effect that the output of commands as echo -e '5;image.jpg\n' depends on the shell. At least tcsh(1) is different to sh(1). Therefore this kind of tests should be done using sh(1). For this special case bash(1) is similar to sh(1).

Please try the folloing command using sh(1) to check if the detection of the image size works.
Code:
echo -e '5;image.jpg\n' | /usr/local/libexec/w3m/w3mimgdisplay
Regaring my post above I have found out that the binary of w3mimgdisplay was the only difference. I will try to find out why. Please see below some information about the working binary. I am not sure the files on your system and on my system must be similar or not.
Code:
# ls -l /usr/local/libexec/w3m/w3mimgdisplay
-r-xr-xr-x  1 root  wheel  28304  6 Jan 10:12 /usr/local/libexec/w3m/w3mimgdisplay
# md5 /usr/local/libexec/w3m/w3mimgdisplay
MD5 (/usr/local/libexec/w3m/w3mimgdisplay) = 1e75684e43dd84aa5387392af3c777b5
 
I have found some issue in the logs using ports-mgmt/poudriere. The log file indicates an issue about graphics/gdk-pixbuf2 which I do not understand right now. I have extracted some lines including line numbers which might be of interest.
Code:
...
409 [pkg.esprimo.local] |  `-- Installing gdk-pixbuf2-2.32.1...
410 [pkg.esprimo.local] |  | `-- Installing jasper-1.900.1_15...
411 [pkg.esprimo.local] |  |  `-- Installing jpeg-turbo-1.4.2...
412 [pkg.esprimo.local] |  |  `-- Extracting jpeg-turbo-1.4.2: .......... done
413 [pkg.esprimo.local] |  | `-- Extracting jasper-1.900.1_15: .......... done
414 [pkg.esprimo.local] |  | `-- Installing libXt-1.1.5,1...
415 [pkg.esprimo.local] |  |  `-- Installing libSM-1.2.2_3,1...
416 [pkg.esprimo.local] |  |  | `-- Installing libICE-1.0.9_1,1...
417 [pkg.esprimo.local] |  |  | `-- Extracting libICE-1.0.9_1,1: .......... done
418 [pkg.esprimo.local] |  |  `-- Extracting libSM-1.2.2_3,1: .......... done
419 [pkg.esprimo.local] |  | `-- Extracting libXt-1.1.5,1: .......... done
420 [pkg.esprimo.local] |  | `-- Installing tiff-4.0.6...
421 [pkg.esprimo.local] |  |  `-- Installing jbigkit-2.1_1...
422 [pkg.esprimo.local] |  |  `-- Extracting jbigkit-2.1_1: .......... done
423 [pkg.esprimo.local] |  | `-- Extracting tiff-4.0.6: .......... done
424 [pkg.esprimo.local] |  `-- Extracting gdk-pixbuf2-2.32.1: .......... done
425 [pkg.esprimo.local] |  `-- Installing shared-mime-info-1.5...
426 [pkg.esprimo.local] |  `-- Extracting shared-mime-info-1.5: .......... done
427 [pkg.esprimo.local] `-- Extracting gtk-update-icon-cache-2.24.29: .... done
428 [pkg.esprimo.local] `-- Installing python-2.7_2,2...
429 [pkg.esprimo.local] |  `-- Installing python2-2_3...
430 [pkg.esprimo.local] |  `-- Extracting python2-2_3: ...... done
431 [pkg.esprimo.local] `-- Extracting python-2.7_2,2: ..... done
432 [pkg.esprimo.local] Extracting gtk2-2.24.29: .......... done
...
530 checking if color escape sequence for kterm/pxvt is enabled... yes
531 checking if ansi color escape sequence support is enabled... yes
532 checking if background color support is enabled... yes
533 checking if image is enabled... fb,x11
534 checking image library... gtk2
535 configure: WARNING: GdkPixbuf is not installed.  Install GdkPixbuf (version >= 2.0.0)
536 configure: WARNING: unable to build w3mimgdisplay with X11 support
537 configure: WARNING: unable to build w3mimgdisplay with FB support
538 checking if xface is enabled... yes
539 checking for uncompface... no
540 configure: WARNING: uncompface is not installed.
EDIT: I forgot to mention that graphics/gdk-pixbuf2 is installed on the system. The binary w3mimgdisplay taken from a different installation works as expected.
 
Back
Top