X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=compile.py;h=0e7d237f84aaf871c87b530e0bdb927a1ed4d273;hb=7d68d5474e9354699b05637a8645a0b749e52c81;hp=4d2dbe257fe1d88fdc3e2951cc9f6307410b2e4f;hpb=ab78acc683cf497b1b910e85fbbb77703401da6d;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FBIP39.git
diff --git a/compile.py b/compile.py
index 4d2dbe2..0e7d237 100644
--- a/compile.py
+++ b/compile.py
@@ -1,48 +1,49 @@
import os
import re
import datetime
+from io import open
# This script generates the bip39-standalone.html file.
# It removes script and style tags and replaces with the file content.
-f = open('src/index.html')
+f = open('src/index.html', "r", encoding="utf-8")
page = f.read()
f.close()
# Script tags
-scriptsFinder = re.compile("""""")
+scriptsFinder = re.compile("""""")
scripts = scriptsFinder.findall(page)
for script in scripts:
filename = os.path.join("src", script)
- s = open(filename)
+ s = open(filename, "r", encoding="utf-8")
scriptContent = "" % s.read()
s.close()
- scriptTag = """""" % script
+ scriptTag = """""" % script
page = page.replace(scriptTag, scriptContent)
# Style tags
-stylesFinder = re.compile("""""")
+stylesFinder = re.compile("""""")
styles = stylesFinder.findall(page)
for style in styles:
filename = os.path.join("src", style)
- s = open(filename)
+ s = open(filename, "r", encoding="utf-8")
styleContent = "" % s.read()
s.close()
- styleTag = """""" % style
+ styleTag = """""" % style
page = page.replace(styleTag, styleContent)
# Write the standalone file
-f = open('bip39-standalone.html', 'w')
+f = open('bip39-standalone.html', 'w', encoding="utf-8")
f.write(page)
f.close()
-print "%s - DONE" % datetime.datetime.now()
+print("%s - DONE" % datetime.datetime.now())