'I'm having an issue with reading JSON from a file

I was interested in making a discord bot an im following a tutorial (https://www.youtube.com/watch?v=-WlLazqQO3I)

I've barely learnt python so i only understand a bit of this code, so i need help fixing the problem.

code: https://pastebin.com/BZJ84VKu

m = {}

@client.event
async def on_ready():
    global m
    with open(YOURFILENAME, "r") as j:
        m = json.load(j)
        j.close()
    if len(m) == 0:
        m = {}
        for member in client.get_guild(YOURGUILDSID).members:
            m[str(member.id)] = {"xp": 0, "messageCountdown": 0}
    print("ready")
    while True:
        try:
            for member in client.get_guild(YOURGUILDSID).members:
                m[str(member.id)]["messageCountdown"] -= 1
        except:
            pass
            await asyncio.sleep(1)

https://pastebin.com/FnSMHEWN (error)

bot still works but when i try "!xp" a different error comes



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source