From 66a91b3c0cc58b5ed7406783a616ba5153120bf2 Mon Sep 17 00:00:00 2001 From: "Fabien C. Y. Benureau" Date: Tue, 11 Jul 2017 02:17:48 +0200 Subject: [PATCH] Fix content._open for Python 2 --- pubs/content.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pubs/content.py b/pubs/content.py index 63c27aa..b776028 100644 --- a/pubs/content.py +++ b/pubs/content.py @@ -1,3 +1,4 @@ +import sys import os import io import shutil @@ -47,12 +48,11 @@ def system_path(path): def _open(path, mode): - if 'b' in mode: + if 'b' in mode or sys.version_info < (3,): return open(system_path(path), mode) else: return open(system_path(path), mode, encoding='utf-8') - def check_file(path, fail=True): syspath = system_path(path) return (_check_system_path_exists(syspath, fail=fail)