diff options
author | Marion <marion.zepf@gmail.com> | 2013-08-02 09:59:50 (GMT) |
---|---|---|
committer | Marion <marion.zepf@gmail.com> | 2013-08-02 09:59:50 (GMT) |
commit | 1291fddc9e29932c6f021452a139f5c2d69e9b36 (patch) | |
tree | 7adaaa9bbe79ad8ff4e2a102c6629fc78e270129 /TurtleArt | |
parent | 9762cdd7b160ad3ac1a596114a7f0fc9e273837c (diff) |
when running exported code, print the traceback of errors to stderr
Diffstat (limited to 'TurtleArt')
-rw-r--r-- | TurtleArt/talogo.py | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/TurtleArt/talogo.py b/TurtleArt/talogo.py index d2a2748..fbff154 100644 --- a/TurtleArt/talogo.py +++ b/TurtleArt/talogo.py @@ -33,6 +33,8 @@ try: except ImportError: GRID_CELL_SIZE = 55 +import traceback + from tablock import (Block, media_blocks_dictionary) from taconstants import (TAB_LAYER, DEFAULT_SCALE) from tapalette import (block_names, value_blocks) @@ -516,9 +518,12 @@ class LogoCode: try: self.step.next() except ValueError: - debug_output('generator already executing', - self.tw.running_sugar) - self.tw.running_blocks = False + if self.tw.running_turtleart: + debug_output('generator already executing', + self.tw.running_sugar) + self.tw.running_blocks = False + else: + traceback.print_exc() return False else: return False @@ -535,11 +540,14 @@ class LogoCode: else: self.ireturn() except logoerror, e: - self.tw.showblocks() - self.tw.display_coordinates() - self.tw.showlabel('syntaxerror', str(e)) - self.tw.turtles.show_all() - self.tw.running_blocks = False + if self.tw.running_turtleart: + self.tw.showblocks() + self.tw.display_coordinates() + self.tw.showlabel('syntaxerror', str(e)) + self.tw.turtles.show_all() + self.tw.running_blocks = False + else: + traceback.print_exc() return False return True |