[dataimport/test] feed binary data to ucsvreader
authorJulien Cristau <julien.cristau@logilab.fr>
Wed, 21 Oct 2015 20:19:51 +0200
changeset 10858 1a3e56e346d2
parent 10857 aa490912d9da
child 10859 375a8232e61c
[dataimport/test] feed binary data to ucsvreader
dataimport/test/test_massive_store.py
--- a/dataimport/test/test_massive_store.py	Wed Oct 21 20:19:11 2015 +0200
+++ b/dataimport/test/test_massive_store.py	Wed Oct 21 20:19:51 2015 +0200
@@ -49,13 +49,13 @@
     def push_geonames_data(self, dumpname, store):
         # Push timezones
         cnx = store._cnx
-        for code, gmt, dst, raw_offset in ucsvreader(open(osp.join(HERE, 'data/timeZones.txt')),
+        for code, gmt, dst, raw_offset in ucsvreader(open(osp.join(HERE, 'data/timeZones.txt'), 'rb'),
                                                      delimiter='\t'):
             cnx.create_entity('TimeZone', code=code, gmt=float(gmt),
                                     dst=float(dst), raw_offset=float(raw_offset))
         timezone_code = dict(cnx.execute('Any C, X WHERE X is TimeZone, X code C'))
         # Push data
-        for ind, infos in enumerate(ucsvreader(open(dumpname),
+        for ind, infos in enumerate(ucsvreader(open(dumpname, 'rb'),
                                                separator='\t',
                                                ignore_errors=True)):
             latitude = self.cast(float, infos[4])