From 4c8de1a62b7f4107eaad666bc8625fa987e744a1 Mon Sep 17 00:00:00 2001 From: Jesse Adametz Date: Mon, 27 Jan 2020 22:18:58 -0800 Subject: [PATCH 1/2] Create output directory if it does not exist --- duree.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/duree.py b/duree.py index 4a0622d..4476f3c 100644 --- a/duree.py +++ b/duree.py @@ -13,7 +13,7 @@ NOTES: * A limit of 335000 seems to be around the maximum limit that KDP will take """ -import random, phrases +import os, random, phrases class Book(object): """docstring for Book.""" @@ -34,6 +34,9 @@ def generate(self): def gen_volume(self): """generate volume""" + if not os.path.exists("output"): + os.makedirs("output") + print("Created directory: output/") output_file = open("output/vol{0}.html".format(self.volume_num), "w") book = "" real_length = 0 From 2b8b642bc7b6f165ec38607f70cb6e04da68d111 Mon Sep 17 00:00:00 2001 From: Jesse Adametz Date: Mon, 27 Jan 2020 22:19:13 -0800 Subject: [PATCH 2/2] Fix gitignore of output --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 032492d..ea1472e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -output.html +output/