I'm trying to debug a Tornado coroutine that, under the hood, uses an asyncio implementation.
As debugger I'm using ipdb
, so in my code I've inserted import ipdb; ipdb.setTrace()
The code is:
@coroutine
def get(self, user_id, _user):
user = yield self.create_user(user_id)
import ipdb; ipdb.set_trace();
...
The problem is that the debugger, instead of enter in debug mode returns
File "/usr/lib/python3.6/asyncio/base_events.py", line 425, in run_forever
raise RuntimeError('This event loop is already running')
Any idea how to fix it? Do you use another approach to debug asyncio process?
The code is executed as python main.py