In a small bit of test code I trigger (I think) the changed behavior of aiter between Python 3.5 and 3.6. The code is this below, with the error. This is my very first use of aiofiles (and almost my first use of asyncio) so I'm happy to accept that I could be doing something wrong. :wink:
async def query_feed(src, queue):
print('Starting read from {}'.format(src))
# The file-handle itself can be non-blocking and asynchronous
async with aiofiles.open(src) as fh:
async for line in fh:
await asyncio.sleep(2)
await queue.put(line.strip())
# print() is synchronous and completes atomically w/o control switch
print("From feed:\t", line.strip())
DeprecationWarning: 'AsyncTextIOWrapper' implements legacy __aiter__ protocol; __aiter__ should return an asynchronous iterator, not awaitable
In a small bit of test code I trigger (I think) the changed behavior of aiter between Python 3.5 and 3.6. The code is this below, with the error. This is my very first use of
aiofiles
(and almost my first use ofasyncio
) so I'm happy to accept that I could be doing something wrong. :wink: