Fix content._open for Python 2

main
Fabien C. Y. Benureau 8 years ago committed by Olivier Mangin
parent ce4b66e9b4
commit 66a91b3c0c

@ -1,3 +1,4 @@
import sys
import os import os
import io import io
import shutil import shutil
@ -47,12 +48,11 @@ def system_path(path):
def _open(path, mode): def _open(path, mode):
if 'b' in mode: if 'b' in mode or sys.version_info < (3,):
return open(system_path(path), mode) return open(system_path(path), mode)
else: else:
return open(system_path(path), mode, encoding='utf-8') return open(system_path(path), mode, encoding='utf-8')
def check_file(path, fail=True): def check_file(path, fail=True):
syspath = system_path(path) syspath = system_path(path)
return (_check_system_path_exists(syspath, fail=fail) return (_check_system_path_exists(syspath, fail=fail)

Loading…
Cancel
Save