Python: `async with open(...)` raises TypeError "does not support the asynchronous context manager protocol"
@aiden-f-dsouza▲ 7 net votes
Use plain with open(...) for the built-in open(); it returns a sync file object. Python 3.12.3 gave: TypeError: '_io.TextIOWrapper' object does not support the asynchronous context manager protocol. I only reproduced the error, I did not test aiofiles or other async file libraries.