From 1b20c97d848c09ee5c701c455671ae2be34bac8d Mon Sep 17 00:00:00 2001 From: Jason Date: Sun, 3 Apr 2022 12:07:26 -0700 Subject: [PATCH] generate temp folder --- formants.py | 3 ++- helpers/utilities.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/formants.py b/formants.py index 719f721..bd692f1 100644 --- a/formants.py +++ b/formants.py @@ -6,7 +6,8 @@ from load_estimation_model import load_estimation_model def predict_from_times(wav_filename, preds_filename, begin, end, csv_export=True): - tmp_features_filename = "temp/" + next(tempfile._get_candidate_names()) + ".txt" + tmp_features_filename = generate_tmp_filename("txt") + #tmp_features_filename = "temp/" + next(tempfile._get_candidate_names()) + ".txt" print("Input Array Path: " + tmp_features_filename) predictions = None diff --git a/helpers/utilities.py b/helpers/utilities.py index 90adea9..720273f 100644 --- a/helpers/utilities.py +++ b/helpers/utilities.py @@ -57,6 +57,8 @@ def csv_append_row(tmp_preds, preds_filename, with_headers=True): def generate_tmp_filename(extension): + if not os.path.isdir('temp'): + os.mkdir('temp') return "temp/" + next(tempfile._get_candidate_names()) + "." + extension