RuntimeError when using python debugger

@chriddyp I just got an example of how the debugger goes buggy when setting a trace in a callback. Decided to just move this to a new thread as it was getting unrelated.

Any idea what this could be based on the traceback below?

Btw, I’m using

dash                 1.11.0 
dash-core-components 1.9.1  
dash-gif-component   1.0.2  
dash-html-components 1.0.3  
dash-renderer        1.4.0  
dash-table           4.6.2  

Exception in thread Thread-193:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/mkupfer/Interactive-Tools/iece/venv/lib/python3.7/site-packages/IPython/terminal/debugger.py", line 102, in in_thre
ad
    line = self.pt_app.prompt()
  File "/Users/mkupfer/Interactive-Tools/iece/venv/lib/python3.7/site-packages/prompt_toolkit/shortcuts/prompt.py", line 994, in p
rompt
    return self.app.run(set_exception_handler=set_exception_handler)
  File "/Users/mkupfer/Interactive-Tools/iece/venv/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 81
2, in run
    self.run_async(pre_run=pre_run, set_exception_handler=set_exception_handler)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "/Users/mkupfer/Interactive-Tools/iece/venv/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 77
8, in run_async
    return await _run_async2()
  File "/Users/mkupfer/Interactive-Tools/iece/venv/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 76
6, in _run_async2
    await self.cancel_and_wait_for_background_tasks()
  File "/Users/mkupfer/Interactive-Tools/iece/venv/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 86
7, in cancel_and_wait_for_background_tasks
    await task
RuntimeError: Task <Task pending coro=<Application.run_async() running at /Users/mkupfer/Interactive-Tools/iece/venv/lib/python3.7
/site-packages/prompt_toolkit/application/application.py:778> cb=[_run_until_complete_cb() at /Library/Frameworks/Python.framework
/Versions/3.7/lib/python3.7/asyncio/base_events.py:158]> got Future <Task pending coro=<KeyProcessor._start_timeout.<locals>.wait$

Hm, not sure. I haven’t been on Python 3.7 for that long yet. That stack trace is mostly outside of the realm of Dash and into Flask, Werkzeug, IPython. You might try searching those repositories on github for issues? Keep us posted!

So good news: I find that with standard pdb debugger, I don’t run any issues.

The issue could be a number of things (ipython, ipdb, my ipython configuration). Probably also has to do with some idiosyncrasies in my callbacks as well since it’s always hit and miss when this bug comes up. I tried updating both ipdb and ipython, which now causes an infinite loop of the below traceback. I don’t really know what is going on here, so I’ll just stick with pdb until things stabilize.

    line = self.pt_app.prompt()
  File "~/venv/lib/python3.7/sit
e-packages/prompt_toolkit/shortcuts/prompt.py", line 738, in prompt
    return run_sync()
  File "~/venv/lib/python3.7/sit
e-packages/prompt_toolkit/shortcuts/prompt.py", line 727, in run_sync
    return self.app.run(inputhook=self.inputhook, pre_run=pre_run2)
  File "~/venv/lib/python3.7/sit
e-packages/prompt_toolkit/application/application.py", line 709, in run
    return run()
  File "~/lib/python3.7/sit
e-packages/prompt_toolkit/application/application.py", line 681, in run
    f = self.run_async(pre_run=pre_run)
  File "~/venv/lib/python3.7/sit
e-packages/prompt_toolkit/application/application.py", line 527, in run_asy
nc
    assert not self._is_running, 'Application is already running.'
AssertionError: Application is already running.