-
-
Save 4ft35t/ab6ff12f61a040235343 to your computer and use it in GitHub Desktop.
Revisions
-
4ft35t revised this gist
Jun 25, 2018 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,7 @@ original: http://code.activestate.com/recipes/65287/ Put this in python module dir, on mac: /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 or /usr/local/lib/python3.*/site-packages Run your script this way: >> python -m autopdb /path/script.py @@ -25,7 +26,7 @@ def info(type, value, tb): import traceback, pdb # we are NOT in interactive mode, print the exception... traceback.print_exception(type, value, tb) print() # ...then start the debugger in post-mortem mode. pdb.pm() -
4ft35t revised this gist
Jun 25, 2018 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -31,4 +31,5 @@ def info(type, value, tb): sys.excepthook = info # execfile(sys.argv[1]) # py2 exec(open(sys.argv[1], 'rb').read()) # py3 -
notsobad renamed this gist
Oct 23, 2014 . 1 changed file with 11 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,13 @@ ''' original: http://code.activestate.com/recipes/65287/ Put this in python module dir, on mac: /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 Run your script this way: >> python -m autopdb /path/script.py ''' import bdb import sys @@ -25,3 +30,5 @@ def info(type, value, tb): pdb.pm() sys.excepthook = info execfile(sys.argv[1]) -
rctay revised this gist
Aug 1, 2012 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -3,13 +3,15 @@ # # place in lib/python2.x/sitecustomize.py import bdb import sys def info(type, value, tb): if hasattr(sys, 'ps1') \ or not sys.stdin.isatty() \ or not sys.stdout.isatty() \ or not sys.stderr.isatty() \ or issubclass(type, bdb.BdbQuit) \ or issubclass(type, SyntaxError): # we are in interactive mode or we don't have a tty-like # device, so we call the default hook -
rctay revised this gist
Jul 24, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ # original: http://code.activestate.com/recipes/65287/ # # place in lib/python2.x/sitecustomize.py import sys def info(type, value, tb): -
rctay revised this gist
Jul 24, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ def info(type, value, tb): or not sys.stdin.isatty() \ or not sys.stdout.isatty() \ or not sys.stderr.isatty() \ or issubclass(type, SyntaxError): # we are in interactive mode or we don't have a tty-like # device, so we call the default hook sys.__excepthook__(type, value, tb) -
rctay revised this gist
Jul 24, 2012 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,8 @@ def info(type, value, tb): if hasattr(sys, 'ps1') \ or not sys.stdin.isatty() \ or not sys.stdout.isatty() \ or not sys.stderr.isatty() \ or type == SyntaxError: # we are in interactive mode or we don't have a tty-like # device, so we call the default hook sys.__excepthook__(type, value, tb) -
rctay revised this gist
Jul 24, 2012 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,10 @@ import sys def info(type, value, tb): if hasattr(sys, 'ps1') \ or not sys.stdin.isatty() \ or not sys.stdout.isatty() \ or not sys.stderr.isatty(): # we are in interactive mode or we don't have a tty-like # device, so we call the default hook sys.__excepthook__(type, value, tb) -
rctay revised this gist
Jul 24, 2012 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,7 @@ # original: http://code.activestate.com/recipes/65287/ # # code snippet, to be included in 'sitecustomize.py' import sys def info(type, value, tb): -
rctay created this gist
Jul 24, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ # # original: http://code.activestate.com/recipes/65287/ # import sys def info(type, value, tb): if hasattr(sys, 'ps1') or not sys.stderr.isatty(): # we are in interactive mode or we don't have a tty-like # device, so we call the default hook sys.__excepthook__(type, value, tb) else: import traceback, pdb # we are NOT in interactive mode, print the exception... traceback.print_exception(type, value, tb) print # ...then start the debugger in post-mortem mode. pdb.pm() sys.excepthook = info