1
0
mirror of https://github.com/Ahp06/SUMO_Emissions.git synced 2024-11-21 19:16:30 +00:00

Check whether logdir exists before creating it

This commit is contained in:
Thibaud Gasser 2018-12-07 16:27:12 +01:00
parent 00646d0135
commit 9bfc30d31d

View File

@ -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))