1

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

alessandro308
  • 1,912
  • 2
  • 15
  • 27
  • I think IPython will try to run it's own event loop, since you're already running one that might be a problem. – yorodm Jan 13 '20 at 15:21

0 Answers0