44 except SyntaxError, detail: |
44 except SyntaxError, detail: |
45 index = "0" |
45 index = "0" |
46 code = "" |
46 code = "" |
47 error = "" |
47 error = "" |
48 lines = traceback.format_exception_only(SyntaxError, detail) |
48 lines = traceback.format_exception_only(SyntaxError, detail) |
49 match = re.match('\s*File "(.+)", line (\d+)', |
49 match = re.match( |
|
50 '\s*File "(.+)", line (\d+)', |
50 lines[0].replace('<string>', '%s' % file)) |
51 lines[0].replace('<string>', '%s' % file)) |
51 if match is not None: |
52 if match is not None: |
52 fn, line = match.group(1, 2) |
53 fn, line = match.group(1, 2) |
53 if lines[1].startswith('SyntaxError:'): |
54 if lines[1].startswith('SyntaxError:'): |
54 error = re.match('SyntaxError: (.+)', lines[1]).group(1) |
55 error = re.match('SyntaxError: (.+)', lines[1]).group(1) |