We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 257c8a9 commit f74d551Copy full SHA for f74d551
jsonDB.py
@@ -1,5 +1,6 @@
1
import re
2
import json
3
+import os
4
from collections.abc import MutableMapping
5
6
@@ -12,6 +13,10 @@ def __init__(self, filename='data.json'):
12
13
14
:param filename: The path to the JSON file used for data storage. Defaults to 'data.json'.
15
"""
16
+ if not os.path.isabs(filename):
17
+ # If the filename is not an absolute path, set it to the directory of the script file
18
+ script_dir = os.path.dirname(os.path.realpath(__file__))
19
+ filename = os.path.join(script_dir, filename)
20
self.filename = filename
21
self._data = self.load_data()
22
0 commit comments