From 8efbfa771e341b1aac91a098fac7d7fb89e261b5 Mon Sep 17 00:00:00 2001 From: Paul Varner Date: Thu, 13 Feb 2014 16:07:26 -0600 Subject: Open CONTENTS files as utf-8 to prevent UnicodeDecodeError. --- pym/gentoolkit/revdep_rebuild/assign.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'pym') diff --git a/pym/gentoolkit/revdep_rebuild/assign.py b/pym/gentoolkit/revdep_rebuild/assign.py index 2df6532..22565e8 100644 --- a/pym/gentoolkit/revdep_rebuild/assign.py +++ b/pym/gentoolkit/revdep_rebuild/assign.py @@ -7,6 +7,7 @@ Functions used for determining the package the broken lib belongs to. from __future__ import print_function import os +import io import re import time current_milli_time = lambda: int(round(time.time() * 1000)) @@ -39,7 +40,7 @@ def assign_packages(broken, logger, settings): f = pkgpath + '/CONTENTS' if os.path.exists(f): try: - with open(f, 'r') as cnt: + with io.open(f, 'r', encoding='utf_8') as cnt: for line in cnt.readlines(): m = re.match('^obj (/[^ ]+)', line) if m is not None: -- cgit v1.2.3