From 932e9ade5a00708a7659d9a4074e1a4966fe3005 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Wed, 24 Feb 2021 13:46:23 +0100 Subject: [PATCH] sopel: Create ~/.sopel/ if it does not exist --- irctest/controllers/sopel.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/irctest/controllers/sopel.py b/irctest/controllers/sopel.py index 4d867ff..951e770 100644 --- a/irctest/controllers/sopel.py +++ b/irctest/controllers/sopel.py @@ -39,7 +39,9 @@ class SopelController(BaseClientController): pass def open_file(self, filename, mode="a"): - return open(os.path.join(os.path.expanduser("~/.sopel/"), filename), mode) + dir_path = os.path.expanduser("~/.sopel/") + os.makedirs(dir_path, exist_ok=True) + return open(os.path.join(dir_path, filename), mode) def create_config(self): with self.open_file(self.filename):