Show More
@@ -21,6 +21,7 b' import re' | |||
|
21 | 21 | import IPython |
|
22 | 22 | import sys |
|
23 | 23 | import codeop |
|
24 | import traceback | |
|
24 | 25 | |
|
25 | 26 | from frontendbase import FrontEndBase |
|
26 | 27 | from IPython.kernel.core.interpreter import Interpreter |
@@ -147,10 +148,18 b' class LineFrontEndBase(FrontEndBase):' | |||
|
147 | 148 | and not re.findall(r"\n[\t ]*\n[\t ]*$", string)): |
|
148 | 149 | return False |
|
149 | 150 | else: |
|
150 | # Add line returns here, to make sure that the statement is | |
|
151 |
|
|
|
152 | return codeop.compile_command(string.rstrip() + '\n\n', | |
|
153 | "<string>", "exec") | |
|
151 | self.capture_output() | |
|
152 | try: | |
|
153 | # Add line returns here, to make sure that the statement is | |
|
154 | # complete. | |
|
155 | is_complete = codeop.compile_command(string.rstrip() + '\n\n', | |
|
156 | "<string>", "exec") | |
|
157 | self.release_output() | |
|
158 | except Exception, e: | |
|
159 | # XXX: Hack: return True so that the | |
|
160 | # code gets executed and the error captured. | |
|
161 | is_complete = True | |
|
162 | return is_complete | |
|
154 | 163 | |
|
155 | 164 | |
|
156 | 165 | def write(self, string, refresh=True): |
@@ -324,6 +324,17 b' class WxController(ConsoleWidget, PrefilterFrontEnd):' | |||
|
324 | 324 | |
|
325 | 325 | |
|
326 | 326 | #-------------------------------------------------------------------------- |
|
327 | # FrontEndBase interface | |
|
328 | #-------------------------------------------------------------------------- | |
|
329 | ||
|
330 | def render_error(self, e): | |
|
331 | start_line = self.GetCurrentLine() | |
|
332 | self.write('\n' + e + '\n') | |
|
333 | for i in range(start_line, self.GetCurrentLine()): | |
|
334 | self._markers[i] = self.MarkerAdd(i, _ERROR_MARKER) | |
|
335 | ||
|
336 | ||
|
337 | #-------------------------------------------------------------------------- | |
|
327 | 338 | # ConsoleWidget interface |
|
328 | 339 | #-------------------------------------------------------------------------- |
|
329 | 340 |
General Comments 0
You need to be logged in to leave comments.
Login now