Reputation: 35
When I try to call the function 'check', it couldn't be called and run into an error.
RuntimeWarning: coroutine 'Acc.check' was never awaited
import json, random
# -- Functions --
async def read():
with open("data.json", "r") as f:
data = json.load(f)
# -- Commands --
class Acc:
async def check():
data = await read()
user = data.keys()
if str(user) not in data:
numbers = "012345689"
user = "".join(random.sample(numbers, 8))
data[str(user)] = {}
with open("data.json", "w") as f:
json.dump(data, f, indent=4)
Acc.check()
Upvotes: 0
Views: 144