Created
March 14, 2014 17:27
-
-
Save teepark/9552594 to your computer and use it in GitHub Desktop.
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
python_run() { | |
$@ 2>.pythonrunerr | |
if [ $? -ne 0 ]; then | |
sed -nri -e '/^\s*File/N' -e 's/^\s*?File "(.*?)", line (.*?),.*\n(.*)$/\1:\2:\3/p' .pythonrunerr | |
vim -q .pythonrunerr -c cope | |
else | |
cat .pythonrunerr >&2 | |
fi | |
rm .pythonrunerr | |
} |
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
$ python_run ./test.py |
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
#!/usr/bin/env python | |
import os, sys | |
def a(): | |
b() | |
def b(): | |
c() | |
def c(): | |
d() | |
def d(): | |
e() #NameError | |
def main(env, argv): | |
a() | |
return 0 | |
if __name__ == '__main__': | |
exit(main(os.environ, sys.argv)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment