From c5899bf5318b356d841981f18b1794c41d173e9e Mon Sep 17 00:00:00 2001 From: Kento HASEGAWA Date: Mon, 26 Aug 2019 19:35:34 +0900 Subject: [PATCH] Avoid confliction on temporary file names --- kwmr_solver.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kwmr_solver.py b/kwmr_solver.py index 72cef3c..07ccb5d 100644 --- a/kwmr_solver.py +++ b/kwmr_solver.py @@ -2,6 +2,7 @@ import argparse import os import random import subprocess +import uuid proc = None stop_flag = False @@ -28,7 +29,8 @@ def solve(params): basedir = os.path.abspath(os.path.dirname(__file__)) - solution_filepath = f'{basedir}/a.txt' + aid = str(uuid.uuid4()) + solution_filepath = f'{basedir}/A{aid}.txt' if os.path.exists(solution_filepath): os.remove(solution_filepath) -- 2.22.0