@@ -584,7 +584,7 @@ def _validate(self, *args, **kwargs):
584584 try :
585585 # TODO: we have lots the location by replacing it with a text
586586 location = add_unc (location )
587- with io .open (location , encoding = 'utf-8' ) as txt :
587+ with io .open (location , encoding = 'utf-8' , errors = 'replace' ) as txt :
588588 text = txt .read ()
589589 self .value [path ] = text
590590 except Exception as e :
@@ -1207,7 +1207,7 @@ def dump(self, location, lic_dict=None):
12071207 if on_windows :
12081208 about_file_path = add_unc (about_file_path )
12091209
1210- with io .open (about_file_path , mode = 'w' , encoding = 'utf-8' ) as dumped :
1210+ with io .open (about_file_path , mode = 'w' , encoding = 'utf-8' , errors = 'replace' ) as dumped :
12111211 dumped .write (genereated_tk_version )
12121212 dumped .write (self .dumps (lic_dict ))
12131213
@@ -1218,7 +1218,7 @@ def dump_android_notice(self, path, context):
12181218 if on_windows :
12191219 path = add_unc (path )
12201220
1221- with io .open (path , mode = 'w' , encoding = 'utf-8' ) as dumped :
1221+ with io .open (path , mode = 'w' , encoding = 'utf-8' , errors = 'replace' ) as dumped :
12221222 dumped .write (context )
12231223
12241224 def android_module_license (self , about_parent_path ):
@@ -1285,7 +1285,7 @@ def dump_lic(self, location, license_dict):
12851285 license_name , license_filename , license_context , license_url = license_dict [lic_key ]
12861286 license_info = (lic_key , license_name , license_filename , license_context , license_url )
12871287 license_key_name_context_url .append (license_info )
1288- with io .open (license_path , mode = 'w' , encoding = 'utf-8' , newline = '\n ' ) as lic :
1288+ with io .open (license_path , mode = 'w' , encoding = 'utf-8' , newline = '\n ' , errors = 'replace' ) as lic :
12891289 lic .write (license_context )
12901290 except Exception as e :
12911291 # TODO: it should return error if exception caught
@@ -1526,7 +1526,7 @@ def save_as_json(location, about_dicts):
15261526 output_file .write (json .dumps (data , indent = 2 ))
15271527
15281528def save_as_csv (location , about_dicts , field_names ):
1529- with io .open (location , mode = 'w' , encoding = 'utf-8' , newline = '' ) as output_file :
1529+ with io .open (location , mode = 'w' , encoding = 'utf-8' , newline = '' , errors = 'replace' ) as output_file :
15301530 writer = csv .DictWriter (output_file , field_names )
15311531 writer .writeheader ()
15321532 csv_formatted_list = util .format_about_dict_output (about_dicts )
0 commit comments