How to detect that Python code is being executed through the debugger? -
Is there an easy way to find within the Python Code, that this code is being executed via Python Debugger ?
I have a small Python application that uses Java code (thanks to JPIP) when I debug the Python part, I also have to give debug option to an embedded JVM.
Python debuggers (as well as professor and coverage tools) when interesting incidents occur, callback Use the sys.settrace
function for (in the sys
module).
If you are using Python 2.6, you can call sys.gettrace ()
to get the current trace callback function. If it is not none
, then you can assume that you should go into debug parameters in JVM.
It is not clear how you can do this prior 2.6.
Comments
Post a Comment