From 8531dfe231e839298a48045f52fa0690eec8a9fa Mon Sep 17 00:00:00 2001 From: Tássia Camões Araújo Date: Tue, 27 Sep 2011 13:23:17 +0000 Subject: [PATCH] Moving file removal to try block (thanks krishna). --- src/web/survey.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/web/survey.py b/src/web/survey.py index f7467cd..808184e 100755 --- a/src/web/survey.py +++ b/src/web/survey.py @@ -99,12 +99,13 @@ class Save: prediction_file.seek(0) prediction_file.close() evaluation_file.close() + os.remove(os.path.join(strategy_dir,"prediction")) except: error_msg = "Could not write evaluation to file." logging.critical(error_msg) - return render.error([error_msg], "/survey/","START") + if not os.path.exists(os.path.join(strategy_dir,"evaluation")): + return render.error([error_msg], "/survey/","START") finally: - os.remove(os.path.join(strategy_dir,"prediction")) with open(os.path.join(strategy_dir,"end"),'w') as end: end_time = datetime.datetime.now().strftime("%Y%m%d%H%M%S") end.write(end_time) -- libgit2 0.21.2