From e5a7e82afda443c41b5647ae639df569537d2384 Mon Sep 17 00:00:00 2001 From: hut Date: Sat, 5 Dec 2015 06:07:05 +0100 Subject: container.tags: handle more py3 encoding errors --- ranger/container/tags.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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: -- cgit 1.4.1-2-gfad0