docs: support python3 to generate docs (#801)
Co-authored-by: Bu Sun Kim <[email protected]>
diff --git a/describe.py b/describe.py
index e36db53..1887dc2 100755
--- a/describe.py
+++ b/describe.py
@@ -348,7 +348,10 @@
html = document_collection(resource, path, root_discovery, discovery)
f = open(os.path.join(FLAGS.dest, path + "html"), "w")
- f.write(html.encode("utf-8"))
+ if sys.version_info.major < 3:
+ html = html.encode("utf-8")
+
+ f.write(html)
f.close()
for name in dir(resource):
@@ -450,7 +453,10 @@
markdown.append("\n")
with open("docs/dyn/index.md", "w") as f:
- f.write("\n".join(markdown).encode("utf-8"))
+ markdown = "\n".join(markdown)
+ if sys.version_info.major < 3:
+ markdown = markdown.encode("utf-8")
+ f.write(markdown)
else:
sys.exit("Failed to load the discovery document.")