fail.py 824 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # NOTE NOTE - This module is designed to fail!
  2. #
  3. # The ONLY purpose for this script is testing/demoing the
  4. # Pythonwin debugger package.
  5. # It does nothing useful, and it even doesnt do that!
  6. import pywin.debugger, sys, time
  7. import traceback
  8. def a():
  9. a=1
  10. try:
  11. b()
  12. except:
  13. # Break into the debugger with the exception information.
  14. pywin.debugger.post_mortem(sys.exc_info()[2])
  15. a=1
  16. a=2
  17. a=3
  18. a=4
  19. pass
  20. def b():
  21. b=1
  22. pywin.debugger.set_trace()
  23. # After importing or running this module, you are likely to be
  24. # sitting at the next line. This is because we explicitely
  25. # broke into the debugger using the "set_trace() function
  26. # "pywin.debugger.brk()" is a shorter alias for this.
  27. c()
  28. pass
  29. def c():
  30. c=1
  31. d()
  32. def d():
  33. d=1
  34. e(d)
  35. raise ValueError("Hi")
  36. def e(arg):
  37. e=1
  38. time.sleep(1)
  39. return e
  40. a()