summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authornfnty <git@nfnty.se>2017-02-14 23:26:55 +0100
committernfnty <git@nfnty.se>2017-02-14 23:26:55 +0100
commit874ef5c0125176f8a4ddef161477c0971372ebfd (patch)
treeb3143db30c76670f51e390e4ca58883765464275 /ranger
parent50b6711b7832d52212844bd08d785007640a89ea (diff)
downloadranger-874ef5c0125176f8a4ddef161477c0971372ebfd.tar.gz
ext.img_display.Iterm2ImageDisplayer.draw: Fix `TypeError`
Fixes #807
Diffstat (limited to 'ranger')
-rw-r--r--ranger/ext/img_display.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py
index d8d0b20b..a6099236 100644
--- a/ranger/ext/img_display.py
+++ b/ranger/ext/img_display.py
@@ -210,7 +210,11 @@ class ITerm2ImageDisplayer(ImageDisplayer, FileManagerAware):
 
     def draw(self, path, start_x, start_y, width, height):
         curses.putp(curses.tigetstr("sc"))
-        sys.stdout.write(curses.tparm(curses.tigetstr("cup"), start_y, start_x))
+        tparm = curses.tparm(curses.tigetstr("cup"), start_y, start_x)
+        if sys.version_info[0] < 3:
+            sys.stdout.write(tparm)
+        else:
+            sys.stdout.buffer.write(tparm)
         sys.stdout.write(self._generate_iterm2_input(path, width, height))
         curses.putp(curses.tigetstr("rc"))
         sys.stdout.flush()