diff options
author | Denis Laxalde <denis.laxalde@logilab.fr> | 2017-07-04 09:24:36 +0200 |
---|---|---|
committer | Denis Laxalde <denis.laxalde@logilab.fr> | 2017-07-04 09:24:36 +0200 |
commit | 6a832d17a3555c652d5530625a40f73c69441720 (patch) | |
tree | 1e8aa87e32e53a77b2994c4e9b299d1ab6ba608d /logilab | |
parent | 57c1a89bc7ef582a85f291c976c932c59062a1ce (diff) | |
download | logilab-common-6a832d17a3555c652d5530625a40f73c69441720.tar.gz |
Use io.open() to avoid deprecation warning about 'U' mode
Use io.open() which has a consistent interface between Python 2 and Python 3.
In particular, `newline` parameter is meant to control "universal new lines"
and it is None by default so we don't need to specify it.
Diffstat (limited to 'logilab')
-rw-r--r-- | logilab/common/fileutils.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/logilab/common/fileutils.py b/logilab/common/fileutils.py index 366d23d..48828fb 100644 --- a/logilab/common/fileutils.py +++ b/logilab/common/fileutils.py @@ -28,6 +28,7 @@ from __future__ import print_function __docformat__ = "restructuredtext en" +import io import sys import shutil import mimetypes @@ -282,7 +283,7 @@ def lines(path, comments=None): :warning: at some point this function will probably return an iterator """ - stream = open(path, 'U') + stream = io.open(path) result = stream_lines(stream, comments) stream.close() return result |