summaryrefslogtreecommitdiff
path: root/logilab
diff options
context:
space:
mode:
authorDenis Laxalde <denis.laxalde@logilab.fr>2017-07-04 09:24:36 +0200
committerDenis Laxalde <denis.laxalde@logilab.fr>2017-07-04 09:24:36 +0200
commit6a832d17a3555c652d5530625a40f73c69441720 (patch)
tree1e8aa87e32e53a77b2994c4e9b299d1ab6ba608d /logilab
parent57c1a89bc7ef582a85f291c976c932c59062a1ce (diff)
downloadlogilab-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.py3
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