How to detect that Python code is being executed through the debugger?

后端 未结 8 1929
清酒与你
清酒与你 2020-12-24 12:20

Is there a simple way to detect, within Python code, that this code is being executed through the Python debugger?

I have a small Python application that uses Java c

8条回答
  •  一个人的身影
    2020-12-24 13:09

    Other alternative if you're using Pydev that also works in a multithreading is:

    try:
        import pydevd
        DEBUGGING = True
    except ImportError:
        DEBUGGING = False
    

提交回复
热议问题