Commit 8531dfe231e839298a48045f52fa0690eec8a9fa
1 parent
e3e4041f
Exists in
master
and in
1 other branch
Moving file removal to try block (thanks krishna).
Showing
1 changed file
with
3 additions
and
2 deletions
Show diff stats
src/web/survey.py
... | ... | @@ -99,12 +99,13 @@ class Save: |
99 | 99 | prediction_file.seek(0) |
100 | 100 | prediction_file.close() |
101 | 101 | evaluation_file.close() |
102 | + os.remove(os.path.join(strategy_dir,"prediction")) | |
102 | 103 | except: |
103 | 104 | error_msg = "Could not write evaluation to file." |
104 | 105 | logging.critical(error_msg) |
105 | - return render.error([error_msg], "/survey/","START") | |
106 | + if not os.path.exists(os.path.join(strategy_dir,"evaluation")): | |
107 | + return render.error([error_msg], "/survey/","START") | |
106 | 108 | finally: |
107 | - os.remove(os.path.join(strategy_dir,"prediction")) | |
108 | 109 | with open(os.path.join(strategy_dir,"end"),'w') as end: |
109 | 110 | end_time = datetime.datetime.now().strftime("%Y%m%d%H%M%S") |
110 | 111 | end.write(end_time) | ... | ... |