You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While I love context managers, the stack isn't always the the place to perform clean up.
open can be used without async with. How can I use aiofiles.open without it?
import asyncio
import aiofiles
async def test():
f = aiofiles.open('filename.txt', mode='w')
try:
#await f.write('123') # 'AiofilesContextManager' object has no attribute 'write'
await f.send('123') # TypeError: can't send non-None value to a just-started generator
finally:
f.close()
asyncio.run(test())
The text was updated successfully, but these errors were encountered:
While I love context managers, the stack isn't always the the place to perform clean up.
open can be used without
async with
. How can I useaiofiles.open
without it?The text was updated successfully, but these errors were encountered: