diff --git a/codegen/GenerateCode.py b/codegen/GenerateCode.py index d4cb122d..121f123b 100644 --- a/codegen/GenerateCode.py +++ b/codegen/GenerateCode.py @@ -27,7 +27,7 @@ for class_ in description[ "classes" ]: githubObjectTemplate = django.template.loader.get_template( "GithubObject.py" ) for class_ in description[ "classes" ]: - with open( os.path.join( os.path.dirname( __file__ ), "..", "src", "github", class_[ "name" ] + ".py" ), "w" ) as f: + with open( os.path.join( os.path.dirname( __file__ ), "..", "src", "github", class_[ "name" ] + ".py" ), "wb" ) as f: f.write( "# WARNING: this file is generated automaticaly.\n" ) f.write( "# Do not modify it manually, your work would be lost.\n" ) f.write( "\n" ) @@ -45,7 +45,7 @@ for class_ in description[ "classes" ]: f.write( "\n".join( code ) + "\n" ) referenceOfClassesTemplate = django.template.loader.get_template( "ReferenceOfClasses.md" ) -with open( os.path.join( os.path.dirname( __file__ ), "..", "doc", "ReferenceOfClasses.md" ), "w" ) as f: +with open( os.path.join( os.path.dirname( __file__ ), "..", "doc", "ReferenceOfClasses.md" ), "wb" ) as f: rawCode = referenceOfClassesTemplate.render( django.template.Context( description ) ).split( "\n" ) code = list() for line in rawCode: diff --git a/codegen/JsonDescriptionOfGithubApiV3/normalize.py b/codegen/JsonDescriptionOfGithubApiV3/normalize.py index 782f5119..8b1ef6d1 100644 --- a/codegen/JsonDescriptionOfGithubApiV3/normalize.py +++ b/codegen/JsonDescriptionOfGithubApiV3/normalize.py @@ -367,7 +367,7 @@ class Description: return obj.ToJson() return json.JSONEncoder.default( self, obj ) - with open( os.path.join( os.path.dirname( __file__ ), fileName ), "w" ) as f: + with open( os.path.join( os.path.dirname( __file__ ), fileName ), "wb" ) as f: json.dump( self, f, indent = 4, cls = Encoder ) with open( os.path.join( os.path.dirname( __file__ ), "description.000.human_readable.json" ) ) as f: