Skip to content

Commit

Permalink
fix(single-mode): should create race result dir
Browse files Browse the repository at this point in the history
fix #223
  • Loading branch information
NateScarlet committed Dec 17, 2021
1 parent 5ed87ab commit aedc0ae
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions auto_derby/single_mode/race/race_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,16 @@ def write(self) -> None:
)
prune(datetime.datetime.now() - datetime.timedelta(days=-90))

with open(g.result_path, "a", encoding="utf-8") as f:
json.dump(self.to_dict(), f, ensure_ascii=False)
f.write("\n")
def _do():
with open(g.result_path, "a", encoding="utf-8") as f:
json.dump(self.to_dict(), f, ensure_ascii=False)
f.write("\n")

try:
_do()
except FileNotFoundError:
os.makedirs(os.path.dirname(p))
_do()


def iterate() -> Iterator[RaceResult]:
Expand Down

0 comments on commit aedc0ae

Please sign in to comment.