@@ -153,7 +153,7 @@ def init(
153153 bootstrap_output_path = os .path .join (
154154 bootstrap_log_dir , f"adaptor-runtime-background-bootstrap-output-{ bootstrap_id } .log"
155155 )
156- output_log_file = open (bootstrap_output_path , mode = "w+" )
156+ output_log_file = open (bootstrap_output_path , mode = "w+" , encoding = "utf-8" )
157157 try :
158158 process = subprocess .Popen (
159159 args ,
@@ -194,7 +194,7 @@ def init(
194194 if process .stderr :
195195 process .stderr .close ()
196196
197- with open (bootstrap_output_path , mode = "r" ) as f :
197+ with open (bootstrap_output_path , mode = "r" , encoding = "utf-8" ) as f :
198198 bootstrap_output = f .readlines ()
199199 _logger .info ("========== BEGIN BOOTSTRAP OUTPUT CONTENTS ==========" )
200200 for line in bootstrap_output :
@@ -203,7 +203,7 @@ def init(
203203
204204 _logger .info (f"Checking for bootstrap logs at '{ bootstrap_log_path } '" )
205205 try :
206- with open (bootstrap_log_path , mode = "r" ) as f :
206+ with open (bootstrap_log_path , mode = "r" , encoding = "utf-8" ) as f :
207207 bootstrap_logs = f .readlines ()
208208 except Exception as e :
209209 _logger .error (f"Failed to get bootstrap logs at '{ bootstrap_log_path } ': { e } " )
@@ -442,7 +442,8 @@ def _wait_for_connection_file(
442442
443443 def file_is_openable () -> bool :
444444 try :
445- open (filepath , mode = "r" ).close ()
445+ with open (filepath , mode = "r" , encoding = "utf-8" ):
446+ pass
446447 except IOError :
447448 # File is not available yet
448449 return False
0 commit comments