Skip to content

Instantly share code, notes, and snippets.

@thomasballinger
Created August 12, 2014 19:39
Show Gist options
  • Save thomasballinger/28e249db937db2c6d91f to your computer and use it in GitHub Desktop.
Save thomasballinger/28e249db937db2c6d91f to your computer and use it in GitHub Desktop.
from curtsies.fmtfuncs import *
import code
import traceback
class Interp(code.InteractiveInterpreter):
def showtraceback(self):
output_lines = []
lines = ['asdf', 'asdfa.py', 'asdfasdf']
for line in lines:
if '.py' in line:
output_lines.append(blue(line))
else:
output_lines.append(yellow(line))
for line in output_lines:
self.write(str(line))
self.write('\n')
i = Interp()
i.runsource('asdf')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment