From 69c7c86a2e1eaa9cbc39c0c138688289942a34d7 Mon Sep 17 00:00:00 2001 From: Maria Elidaiana Date: Thu, 12 Apr 2018 11:27:44 -0500 Subject: [PATCH] fixing the logic of subdir creation in file_path --- destest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/destest.py b/destest.py index d71aab5..9ef6e09 100644 --- a/destest.py +++ b/destest.py @@ -67,8 +67,9 @@ def file_path( params, subdir, name, var=None, var2=None, var3=None, ftype='txt' raise IOError('Output directory already exists. Set output_exists to True to use existing output directory at your own peril.') else: if not os.path.exists(fpath): + os.mkdir(fpath) + if not os.path.exists(os.path.join(params['output'],params['param_file'][:params['param_file'].index('.')])) : os.mkdir(os.path.join(params['output'],params['param_file'][:params['param_file'].index('.')])) - os.mkdir(fpath) params['output_exists'] = True return os.path.join(fpath,name)