Am using discord.py which requires using async-await functions. I want to dump and load data using pickle and JSON modules. but when trying that I get this error
AttributeError: __enter__
d:\Users\-------\visual studio projects\------------\main.py:65: RuntimeWarning:
coroutine 'Command.__call__' was never awaited
I believe this happened because am opening the file inside and async-await function. so I tried an alternative way to open the files with async functions with aiofiles:
async with aiofiles.open("owners.pkl", mode="rb") as file:
owner_dict = pickle.load(file)
but the problem is that pickle and json does work inside async functions.
Is there any alternative way to open, load, and dump with JSON or pickle inside async-await functions ???