From 35e3865e5f6a4df1b3c860699c7c74c0384b165c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Wobst?= Date: Sun, 14 Jul 2013 07:18:50 +0000 Subject: [PATCH] internal files should be opened as bytes as well git-svn-id: http://svn.code.sf.net/p/pyx/code/branches/py3k/pyx@3387 a4f5e268-e194-4f32-bce1-d30804cbbcc5 --- pyx/config.py | 8 ++++---- pyx/text.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pyx/config.py b/pyx/config.py index d9c815e0..68db59cd 100644 --- a/pyx/config.py +++ b/pyx/config.py @@ -69,7 +69,7 @@ class internal_pkgutil: else: if data: # ignoring mode?! - return [lambda: io.StringIO(data.decode('utf-8'))] + return [lambda: io.BytesIO(data)] return [] class internal_open: @@ -201,7 +201,7 @@ class kpsewhich: break else: return [] - full_filename = full_filenames.decode('latin1').split("\n")[0].rstrip("\r") + full_filename = full_filenames.decode('ascii').split("\n")[0].rstrip("\r") # Detect Cygwin kpsewhich on Windows Python if os.name == 'nt' and full_filename.startswith('/'): @@ -246,8 +246,8 @@ locator_classes["locate"] = locate class _marker: pass config = configparser.ConfigParser() -config.readfp(locator_classes["internal"]().openers("pyxrc", [], [""], "r")[0]()) -config.read(os.path.expanduser("~/.pyxrc")) +config.read_string(locator_classes["internal"]().openers("pyxrc", [], [""], "r")[0]().read().decode("utf-8"), source="(internal pyxrc)") +config.read(os.path.expanduser("~/.pyxrc"), encoding="utf-8") def get(section, option, default=_marker): if default is _marker: diff --git a/pyx/text.py b/pyx/text.py index 2113794f..3c8cbc2a 100644 --- a/pyx/text.py +++ b/pyx/text.py @@ -958,7 +958,7 @@ class texrunner: if not self.lfs.endswith(".lfs"): self.lfs = "%s.lfs" % self.lfs lfsfile = config.open(self.lfs, [], "r") - lfsdef = lfsfile.read() + lfsdef = lfsfile.read().decode("ascii") lfsfile.close() self.execute(lfsdef, []) self.execute("\\normalsize%\n", []) -- 2.11.4.GIT