From 9bfc30d31d67cc2b7d7b8ba0270660a69361f7ba Mon Sep 17 00:00:00 2001 From: Thibaud Date: Fri, 7 Dec 2018 16:27:12 +0100 Subject: [PATCH] Check whether logdir exists before creating it --- configurator/configurator.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configurator/configurator.py b/configurator/configurator.py index be54271..ca56a5f 100644 --- a/configurator/configurator.py +++ b/configurator/configurator.py @@ -30,7 +30,8 @@ def generate_scenario(out_path, name): shutil.copyfile(os.path.join(STATICDIR, 'simul.sumocfg'), os.path.join(out_path, f'{name}.sumocfg')) # Move log files logdir = os.path.join(out_path, 'log') - os.mkdir(logdir) + if not os.path.exists(logdir): + os.mkdir(logdir) for f in os.listdir(STATICDIR): if f.endswith('.log'): shutil.move(os.path.join(STATICDIR, f), os.path.join(logdir, f))