diff options
author | adityacp | 2016-09-16 20:28:21 +0530 |
---|---|---|
committer | adityacp | 2016-09-16 20:28:21 +0530 |
commit | bfd75a4b87339c5037ad2d412e45ee12b223dd02 (patch) | |
tree | da62b336a5b5681c4b0878a72170ee8d9f0bf037 /yaksh/code_evaluator.py | |
parent | 2efd65cb2dd276e1560c8993e13d9db95e6c8ba0 (diff) | |
parent | 5b2a6fe665a3add0916a255e5436841b820146ee (diff) | |
download | online_test-bfd75a4b87339c5037ad2d412e45ee12b223dd02.tar.gz online_test-bfd75a4b87339c5037ad2d412e45ee12b223dd02.tar.bz2 online_test-bfd75a4b87339c5037ad2d412e45ee12b223dd02.zip |
changed course template to view demo course
Diffstat (limited to 'yaksh/code_evaluator.py')
-rw-r--r-- | yaksh/code_evaluator.py | 12 |
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) |