Skip to content

Commit

Permalink
fix: createdb
Browse files Browse the repository at this point in the history
  • Loading branch information
Okaneeee committed Oct 20, 2024
1 parent 56a141c commit 09280e4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/utils/dbManager.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
import json
import os, errno

DB = "./db/ids.json"

def mkdir_p(path):
try:
os.makedirs(path, exist_ok=True) # Python>3.2
except TypeError:
try:
os.makedirs(path)
except OSError as exc: # Python >2.5
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
else: raise

def __createDB():
"""Create a new database file"""
mkdir_p("./db")
with open(DB, "w") as f:
json.dump({}, f)

Expand Down

0 comments on commit 09280e4

Please sign in to comment.