Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ USING_PDB=1 pdb yourprog.py
- import os
- if os.environ.get('USING_PDB'):
- # debugging actions
- pass
- import inspect
- def isdebugging():
- for frame in inspect.stack():
- if frame[1].endswith("pydevd.py"):
- return True
- return False
- import sys
- if 'pydevd' in sys.modules:
- print "Debugger"
- else:
- print "commandline"
- __debug__
- This constant is true if Python was not started with an -O option.
- if __debug__:
- print 'Python started without optimization'
Add Comment
Please, Sign In to add comment