From 575da538337da6afb23cc159870853b6457797d3 Mon Sep 17 00:00:00 2001 From: adityacp Date: Fri, 13 Apr 2018 12:17:29 +0530 Subject: Change in python test, grader and request handler - Add try except in grader to get exceptions for python stdio and python assertion evaluation - Add additional tests - Add condition in request handler to avoid error if codemirror is not instantiated --- yaksh/grader.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'yaksh/grader.py') diff --git a/yaksh/grader.py b/yaksh/grader.py index 9bc4e5c..2a246b8 100644 --- a/yaksh/grader.py +++ b/yaksh/grader.py @@ -151,7 +151,10 @@ class Grader(object): except Exception as e: exc_type, exc_value, exc_tb = sys.exc_info() tb_list = traceback.format_exception(exc_type, exc_value, exc_tb) - line_no = e.lineno + try: + line_no = e.lineno + except AttributeError: + line_no = traceback.extract_tb(exc_tb)[-1][1] if len(tb_list) > 2: del tb_list[1:3] error.append( -- cgit