cool-RR / PySnooper

Never use print for debugging again
MIT License
16.31k stars 954 forks source link

Compatibility issue with Debugger in Visual Studio Code #232

Closed astr0gator closed 1 year ago

astr0gator commented 1 year ago

Thanks for the amazing tool. I use it every day.

I'm facing a possible compatibility issue when using Visual Studio Code. If I switch off pysnooper, default debugging works as intended.

The error I see while trying to debug with debugger (not with breakpoint()):

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 "/Users/.../venv/lib/python3.10/site-packages/pysnooper/tracer.py", line 355, in exit sys.settrace(stack.pop())

Any tips would be appreciated.

cool-RR commented 1 year ago

PySnooper uses the same mechanism as a debugger, so it can't be used together with a debugger. Making this work will require a change to cpython.

astr0gator commented 1 year ago

Thank you, I see now. Curious how people approach that then. Mine so far is using pysnooper + pdbr(if somebody came across this thread in the future).