[dataimport] fix count_lines function (closes #14407650) 3.20
authorDavid Douard <david.douard@logilab.fr>
Tue, 19 Jul 2016 12:47:28 +0200
branch3.20
changeset 11400 5a366414d904
parent 11399 5149a4d4cf54
child 11401 0b4fd993e9d7
[dataimport] fix count_lines function (closes #14407650) ensure i allways exists whatever f content is
dataimport.py
--- a/dataimport.py	Tue Jul 19 13:50:56 2016 +0200
+++ b/dataimport.py	Tue Jul 19 12:47:28 2016 +0200
@@ -95,6 +95,7 @@
     else:
         f = stream_or_filename
         f.seek(0)
+    i = 0  # useful is f is an empty file
     for i, line in enumerate(f):
         pass
     f.seek(0)