Created
July 27, 2023 22:45
-
-
Save Syzygianinfern0/4198fb7b5af3ab2171bd77370a2befed to your computer and use it in GitHub Desktop.
Find out if python code is being executed by a debugger
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def is_being_debugged(): | |
return sys.gettrace() is not None | |
if is_being_debugged(): | |
print("The script is being debugged") | |
else: | |
print("The script is not being debugged") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment