@@ -234,7 +234,7 @@ def build_operators():
234234
235235 # Write to operator file
236236 operator_file = os .path .join (category_path , scripting_name + ".py" )
237- with open (operator_file , "wb " ) as f :
237+ with open (operator_file , "w" , encoding = 'utf-8' , newline = " \u000A " ) as f :
238238 operator_str = scripting_name
239239 try :
240240 operator_str = build_operator (
@@ -246,7 +246,7 @@ def build_operators():
246246 specification_description ,
247247 )
248248 exec (operator_str , globals ())
249- f .write (operator_str . encode () )
249+ f .write (operator_str )
250250 succeeded += 1
251251 except SyntaxError as e :
252252 error_message = (
@@ -262,17 +262,17 @@ def build_operators():
262262
263263 # Create __init__.py files
264264 print (f"Generating __init__.py files..." )
265- with open (os .path .join (this_path , "__init__.py" ), "wb " ) as main_init :
265+ with open (os .path .join (this_path , "__init__.py" ), "w" , encoding = "utf-8" , newline = " \u000A " ) as main_init :
266266 for category in sorted (categories ):
267267 # Add category to main init file imports
268- main_init .write (f"from . import { category } \n " . encode () )
268+ main_init .write (f"from . import { category } \n " )
269269 # Create category init file
270270 category_operators = os .listdir (os .path .join (this_path , category .split ("." )[0 ]))
271- with open (os .path .join (this_path , category , "__init__.py" ), "wb " ) as category_init :
271+ with open (os .path .join (this_path , category , "__init__.py" ), "w" , encoding = "utf-8" , newline = " \u000A " ) as category_init :
272272 for category_operator in sorted (category_operators ):
273273 operator_name = category_operator .split ("." )[0 ]
274274 category_init .write (
275- f"from .{ operator_name } import { operator_name } \n " . encode ()
275+ f"from .{ operator_name } import { operator_name } \n "
276276 )
277277
278278 if succeeded == len (available_operators ) - hidden :
0 commit comments