@@ -104,7 +104,7 @@ def get_search_service():
104104
105105def initialize_data_file (file_path , header ):
106106 if not os .path .isfile (file_path ):
107- with open (file_path , "w" , newline = "" ) as file_obj :
107+ with open (file_path , "w" , encoding = "utf-8" , newline = "\n " ) as file_obj :
108108 writer = csv .DictWriter (
109109 file_obj , fieldnames = header , dialect = "unix"
110110 )
@@ -127,7 +127,7 @@ def get_last_completed_plan_index():
127127 last_completed_plan_index = 0
128128 for file_path in [FILE1_COUNT , FILE2_LANGUAGE , FILE3_COUNTRY ]:
129129 try :
130- with open (file_path , "r" , newline = " " ) as file_obj :
130+ with open (file_path , "r" , encoding = "utf-8 " ) as file_obj :
131131 reader = csv .DictReader (file_obj , dialect = "unix" )
132132 for row in reader :
133133 pass # skip through to last row
@@ -147,7 +147,7 @@ def get_last_completed_plan_index():
147147def load_plan ():
148148 plan = []
149149 file_path = shared .path_join (PATHS ["data" ], "gcs_query_plan.csv" )
150- with open (file_path , "r" , newline = " " ) as file_obj :
150+ with open (file_path , "r" , encoding = "utf-8 " ) as file_obj :
151151 plan = list (csv .DictReader (file_obj , dialect = "unix" ))
152152 return plan
153153
@@ -181,7 +181,7 @@ def append_data(args, plan_row, index, count):
181181 "TOOL_IDENTIFIER" : plan_row ["TOOL_IDENTIFIER" ],
182182 "COUNT" : count ,
183183 }
184- with open (file_path , "a" , newline = "" ) as file_obj :
184+ with open (file_path , "a" , encoding = "utf-8" , newline = "\n " ) as file_obj :
185185 writer = csv .DictWriter (
186186 file_obj , fieldnames = fieldnames , dialect = "unix"
187187 )
0 commit comments