[kupfer] quickview: adjust coding style, use 'rb'



commit 20076f7a3b3a355a62458461c5e166edb0fc7027
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Mon Mar 21 18:05:22 2011 +0100

    quickview: adjust coding style, use 'rb'

 kupfer/plugin/quickview.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/kupfer/plugin/quickview.py b/kupfer/plugin/quickview.py
index 7bfacef..1c173d9 100644
--- a/kupfer/plugin/quickview.py
+++ b/kupfer/plugin/quickview.py
@@ -40,11 +40,12 @@ def load_image_max_size(filename, w, h):
 	pl = gtk.gdk.PixbufLoader()
 	pl.connect("size-prepared", _set_size, w, h)
 	try:
-		with open(filename, "r") as f:
+		with open(filename, "rb") as f:
 			shutil.copyfileobj(f, pl)
-		pl.close()
 	except (glib.GError, EnvironmentError) as exc:
 		raise OperationError(exc)
+	finally:
+		pl.close()
 	return pl.get_pixbuf()
 
 def window_key_press(window, event, filepath):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]