Python-3.2 coroutine: AttributeError: ‘generator’ object has no attribute ‘next’

You’re getting thrown off by the error message; type-wise, Python doesn’t make a distinction – you can .send to anything that uses yield, even if it doesn’t do anything with the sent value internally.

In 3.x, there is no longer a .next method attached to these; instead, use the built-in free function next:

next(matcher)

Leave a Comment