From f3599ded03e885bde0d4ed772e0845aae1378fc6 Mon Sep 17 00:00:00 2001 From: Ryan Gardner Date: Tue, 26 Dec 2017 12:06:38 +0000 Subject: [PATCH] roll back to 1st commit --- bootstrap.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/bootstrap.py b/bootstrap.py index cfeffb13..655a41a8 100644 --- a/bootstrap.py +++ b/bootstrap.py @@ -4,18 +4,19 @@ import os import subprocess if not os.path.exists("bootstrap"): - os.mkdir("bootstrap") + os.mkdir("bootstrap") contents = sys.stdin.read() subs = re.findall("\{.*?\}", contents, re.DOTALL) -with open("./bootstrap/index.html", "w") as html_file: - html_file.write("") - for block_number,sub in enumerate(subs): +html_file = open("./bootstrap/index.html", "w") +html_file.write("") +for block_number,sub in enumerate(subs): block_number = str(block_number) block_file_name = "".join(("./bootstrap/block", block_number, ".json")) - with open(block_file_name, "w") as block_file: - block_file.write(sub) - with open(block_file_name, "r") as block_file: - qr_file_name = "".join(("./bootstrap/block", block_number, ".png")) - html_file.write("".join((""))) - subprocess.call(["qrencode", "-o", qr_file_name], stdin=block_file) - html_file.write("") + block_file = open(block_file_name, "w") + block_file.write(sub) + block_file.close() + block_file = open(block_file_name, "r") + qr_file_name = "".join(("./bootstrap/block", block_number, ".png")) + html_file.write("".join((""))) + subprocess.call(["qrencode", "-o", qr_file_name], stdin=block_file) +html_file.write("")