SyntaxError: 'yield from' inside async function
async def handle(request):
for m in (yield from request.post()):
print(m)
return web.Response()
Used python3.5 before, found pep525, install python3.6.5 and still receive this error.
You are using the new
async/awaitsyntax to define and execute co-routines, but have not made a full switch. You need to useawaithere:If you wanted to stick to the old, pre-Python 3.5 syntax, then mark your function as a coroutine with the
@asyncio.coroutinedecorator, drop theasynckeyword, and useyield frominstead ofawait:but this syntax is being phased out, and is not nearly as discoverable and readable as the new syntax. You should only use this form if you need to write code that is compatible with older Python versions.