Coding Global Background
Coding Global

Hilfe bei PY

Archiviert 3 years ago
35 Nachrichten
2 Mitglieder
Erstellt 3 years ago
Aktualisiert 3 years ago
In Discord öffnen
M
Maxi
Script Kiddie!
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"]


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?

Antworten (35)