Sanic: Debug breakpoints in PyCharm stops working after upgrading to 0.8 or later

Created on 12 Sep 2018  路  8Comments  路  Source: sanic-org/sanic

Hi there,

I am developing sanic application using JetBrains PyCharm (version 2018.2.3).
The breakpoint debugging function there was working fine on sanic 0.7.0, but after I upgraded to 0.8 or later all the breakpoints can never get hit any more.

Most helpful comment

hi @lakaf any solution for this case?

Yeah as vltr mentioned this is related to auto_reload, you could set auto_reload to False in sanic's run call and this will fix this issue for now.

All 8 comments

hi @lakaf any solution for this case?

A discussion regarding auto_reload support and better IDE integration is ongoing in the community forums. The title refers to Windows, but everything is being overhauled to work seamlessly on the three major platforms (Linux, Windows and mac OS).

hi @lakaf any solution for this case?

Yeah as vltr mentioned this is related to auto_reload, you could set auto_reload to False in sanic's run call and this will fix this issue for now.

thanks @vltr & @lakaf 馃憤

Still open, can we fix it?

Currently the main process runs auto_reload and child processes do everything else, if auto reloader is enabled. I suppose this would require refactoring so that the main process does serving and the reloader is a child. This should be fine on POSIX platforms but I wonder if that can work on Windows, i.e. whether killing the main process would there kill all the children incl. the reloader (not sure how if Windows automatically kills child processes when the parent is killed; POSIX does not).

Just do it as follows: Edit configrations -> Parameters : --debug=True

image
this is working

Was this page helpful?
0 / 5 - 0 ratings