create folder if not exist

This commit is contained in:
dechert 2021-06-16 19:32:58 +02:00
parent 53f40ef725
commit 8fec12133b
2 changed files with 9 additions and 1 deletions

View File

@ -7,7 +7,7 @@ import shutil
# return True
# return False
NUMBER_OF_ANSWERS = 5
BASE_FODLER = "test_data"
# BASE_FODLER = "test_data"
class QuestionAndAnswers:
@ -29,6 +29,10 @@ def convert(csv_path, output_pdf=False):
def write_markdown_file(csv_path):
# csv_path = "quiz-example.csv"
OUTPUT_FODLER = "output"
if not os.path.exists(OUTPUT_FODLER):
os.makedirs(OUTPUT_FODLER)
markdown_filename = "slide-deck.md"
markdown_path = os.path.join(OUTPUT_FODLER, markdown_filename)

View File

@ -51,6 +51,10 @@ def upload_image():
from werkzeug.utils import secure_filename
filename = secure_filename(csv_file.filename)
output_file_path = os.path.join(UPLOAD_FODLER, filename)
if not os.path.exists(UPLOAD_FODLER):
os.makedirs(UPLOAD_FODLER)
csv_file.save(output_file_path)
# run converter