open-cogsci/rapunzel

Ignore console-color characters when capturing output

smathot opened this issue · 0 comments

Right now, if an error occurs, the resulting Exception is captured entirely, including the color-coding characters that only have a meaning in the console for syntax highlighting. Those characters should be stripped.

# % output
# �[0;36m  File �[0;32m"<ipython-input-22-7dd42fd7602c>"�[0;36m, line �[0;32m1�[0m
# �[0;31m    print('x)�[0m
# �[0m             ^�[0m
# �[0;31mSyntaxError�[0m�[0;31m:�[0m EOL while scanning string literal
# 
#