Fix content._open for Python 2

This commit is contained in:
Fabien C. Y. Benureau 2017-07-11 02:17:48 +02:00 committed by Olivier Mangin
parent ce4b66e9b4
commit 66a91b3c0c

View File

@ -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)