pdb.set_trace causes breakpoints to stop working

Answered

EDIT: NM I was in a forked process which is why the breakpoint wasn't taking

When running a process with the debugger I had a lingering `pdb` import and `pdb.set_trace()` call which caused the following warning to appear in console
```
PYDEV DEBUGGER WARNING:
sys.settrace() should not be used when the debugger is being used.
This may cause the debugger to stop working correctly.
If this is needed, please check: 
http://pydev.blogspot.com/2007/06/why-cant-pydev-debugger-work-with.html
to see how to restore the debug tracing back correctly.
Call Location:
File "/usr/lib/python2.7/bdb.py", line 225, in set_trace
sys.settrace(self.trace_dispatch)
```

I removing the pdb import and set_trace call line and I noticed none of my breakpoints would activate even when the code was clearly being called. Seems to be an issue with bdp and pdb both using the sys.settrace call, but I cant figure out how to get breakpoints in pycharm to continue working again.

 

PyCharm 2017.3 (Professional Edition)
Build #PY-173.3727.137, built on November 28, 2017
JRE: 1.8.0_152-release-1024-b6 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.13.3

0
1 comment

Hi! Yes, PyCharm's debugger can't work if your code uses pydevd.settrace(). Could you please provide a code sample to reproduce the problem after removing settrace call?

0

Please sign in to leave a comment.