summaryrefslogtreecommitdiff
path: root/yaksh/code_evaluator.py
diff options
context:
space:
mode:
authorPrabhu Ramachandran2016-09-08 16:25:41 +0530
committerGitHub2016-09-08 16:25:41 +0530
commitbcf46d1462c35e9c8df2509a31ac3200383976fc (patch)
tree10426f74b6c578e53e5002f0314bb484a04b41c4 /yaksh/code_evaluator.py
parentdc4437c52ee1266af9a69d091952d9f6b19ca584 (diff)
parent06daf67b7a579c113d17eacd4bfb0651ab169be4 (diff)
downloadonline_test-bcf46d1462c35e9c8df2509a31ac3200383976fc.tar.gz
online_test-bcf46d1462c35e9c8df2509a31ac3200383976fc.tar.bz2
online_test-bcf46d1462c35e9c8df2509a31ac3200383976fc.zip
Merge pull request #131 from adityacp/fix_quiz_UI
Fix quiz templates
Diffstat (limited to 'yaksh/code_evaluator.py')
-rw-r--r--yaksh/code_evaluator.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/yaksh/code_evaluator.py b/yaksh/code_evaluator.py
index 2fb429f..e139b55 100644
--- a/yaksh/code_evaluator.py
+++ b/yaksh/code_evaluator.py
@@ -108,9 +108,17 @@ class CodeEvaluator(object):
except TimeoutException:
err = self.timeout_msg
+ except OSError:
+ msg = traceback.format_exc(limit=0)
+ err = "Error: {0}".format(msg)
except Exception:
- err = "Error: {0}".format(traceback.format_exc(limit=0))
-
+ exc_type, exc_value, exc_tb = sys.exc_info()
+ tb_list = traceback.format_exception(exc_type, exc_value, exc_tb)
+ if len(tb_list) > 2:
+ del tb_list[1:3]
+ else:
+ pass
+ err = "Error: {0}".format("".join(tb_list))
finally:
# Set back any original signal handler.
set_original_signal_handler(prev_handler)