wecs.repl module¶
-
class
wecs.repl.Interpreter(*args)¶ Bases:
code.InteractiveConsole-
runline(line)¶
-
showsyntaxerror(filename=None)¶ Display the syntax error that just occurred.
This doesn’t display a stack trace because there isn’t one.
If a filename is given, it is stuffed in the exception instead of what was there before (because Python’s parser always uses “<string>” when reading from a string).
The output is written by self.write(), below.
-
runcode(code)¶ Execute a code object.
When an exception occurs, self.showtraceback() is called to display a traceback. All exceptions are caught except SystemExit, which is reraised.
A note about KeyboardInterrupt: this exception may occur elsewhere in this code, and may not always be caught. The caller should be prepared to deal with it.
-
showtraceback()¶ Display the exception that just occurred.
We remove the first stack item because it is our own code.
The output is written by self.write(), below.
-
write(output_string)¶ Write a string.
The base implementation writes to sys.stderr; a subclass may replace this with a different implementation.
-