Hilfe bei PY
Archiviert 2 years ago
M
Maxi
Copy Paster!
```py
if os.path.exists(os.getcwd() + "/config.json"):
with open("./config.json") as f:
configData = json.load(f)
else:
configTemplate = {"bannedWords": []}
with open(os.getcwd() + "/config.json", "w+") as f:
json.dump(configTemplate, f)
bannedWords = configData["bannedWords"]```
```py
Traceback (most recent call last):
File "/home/container/main.py", line 57, in <module>
bannedWords = configData["bannedWords"]
KeyError: 'bannedWords'```
weiß wer, wo das Problem liegt?
