summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lepus.uberspace.de>2015-12-05 06:07:05 +0100
committerhut <hut@lepus.uberspace.de>2015-12-05 06:07:05 +0100
commite5a7e82afda443c41b5647ae639df569537d2384 (patch)
treecd3c56277d100f2b592c3d3ea180c872b09bc1b8
parent3b6ecb1501ab41e4df0fe0c0882be83435f21445 (diff)
downloadranger-e5a7e82afda443c41b5647ae639df569537d2384.tar.gz
container.tags: handle more py3 encoding errors
-rw-r--r--ranger/container/tags.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/ranger/container/tags.py b/ranger/container/tags.py
index 098ae9e3..555ef8b0 100644
--- a/ranger/container/tags.py
+++ b/ranger/container/tags.py
@@ -5,6 +5,7 @@
 
 from os.path import isdir, exists, dirname, abspath, realpath, expanduser
 import string
+import sys
 
 ALLOWED_KEYS = string.ascii_letters + string.digits + string.punctuation
 
@@ -69,7 +70,10 @@ class Tags(object):
 
     def sync(self):
         try:
-            f = open(self._filename, 'r')
+            if sys.version_info[0] >= 3:
+                f = open(self._filename, 'r', errors='replace')
+            else:
+                f = open(self._filename, 'r')
         except OSError:
             pass
         else: