From c21647d77e71467eac4669c63351ff9302b71478 Mon Sep 17 00:00:00 2001 From: FroDK Date: Thu, 25 Apr 2024 20:58:17 +0500 Subject: [PATCH] Fix: io.UnsupportedOperation: not readable (#489) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Андрей Васильев --- src/config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/config.py b/src/config.py index 8ab74f65..f37c5e42 100644 --- a/src/config.py +++ b/src/config.py @@ -14,8 +14,9 @@ def __new__(cls): def _load_config(self): # If the config file doesn't exist, copy from the sample if not os.path.exists("config.toml"): - with open("sample.config.toml", "r") as f_in, open("config.toml", "w") as f_out: + with open("sample.config.toml", "r") as f_in, open("config.toml", "w+") as f_out: f_out.write(f_in.read()) + f_out.seek(0) self.config = toml.load(f_out) else: # check if all the keys are present in the config file