1
1
import copy
2
2
import csv
3
3
import ctypes
4
+ from io import open
4
5
import logging
5
6
import time
6
7
from os import listdir
@@ -222,7 +223,7 @@ def _create_indices(self, node_file):
222
223
# type: (str) -> None
223
224
LOGGER .info ('Creating indices. (Existing indices will be ignored)' )
224
225
225
- with open (node_file , 'r' ) as node_csv :
226
+ with open (node_file , 'r' , encoding = 'utf8' ) as node_csv :
226
227
for node_record in csv .DictReader (node_csv ):
227
228
label = node_record [NODE_LABEL_KEY ]
228
229
if label not in self .labels :
@@ -250,7 +251,7 @@ def _publish_node(self, node_file, tx):
250
251
:return:
251
252
"""
252
253
253
- with open (node_file , 'r' ) as node_csv :
254
+ with open (node_file , 'r' , encoding = 'utf8' ) as node_csv :
254
255
for count , node_record in enumerate (csv .DictReader (node_csv )):
255
256
stmt = self .create_node_merge_statement (node_record = node_record )
256
257
tx = self ._execute_statement (stmt , tx )
@@ -306,7 +307,7 @@ def _publish_relation(self, relation_file, tx):
306
307
LOGGER .info ('Pre-processing relation with {}' .format (self ._relation_preprocessor ))
307
308
308
309
count = 0
309
- with open (relation_file , 'r' ) as relation_csv :
310
+ with open (relation_file , 'r' , encoding = 'utf8' ) as relation_csv :
310
311
for rel_record in csv .DictReader (relation_csv ):
311
312
stmt , params = self ._relation_preprocessor .preprocess_cypher (
312
313
start_label = rel_record [RELATION_START_LABEL ],
@@ -322,7 +323,7 @@ def _publish_relation(self, relation_file, tx):
322
323
323
324
LOGGER .info ('Executed pre-processing Cypher statement {} times' .format (count ))
324
325
325
- with open (relation_file , 'r' ) as relation_csv :
326
+ with open (relation_file , 'r' , encoding = 'utf8' ) as relation_csv :
326
327
for count , rel_record in enumerate (csv .DictReader (relation_csv )):
327
328
stmt = self .create_relationship_merge_statement (rel_record = rel_record )
328
329
tx = self ._execute_statement (stmt , tx ,
0 commit comments