Merge pull request #89 from Ryan526/main

Fix: Ensure Directory Exists Before File Write Operation in db.py
This commit is contained in:
Anton Osika
2023-06-17 11:00:23 +02:00
committed by GitHub

View File

@@ -15,6 +15,8 @@ class DB:
return f.read() return f.read()
def __setitem__(self, key, val): def __setitem__(self, key, val):
os.makedirs(self.path, exist_ok=True)
with open(self.path / key, 'w', encoding='utf-8') as f: with open(self.path / key, 'w', encoding='utf-8') as f:
f.write(val) f.write(val)