codecs.backslashreplace_errors()

codecs.backslashreplace_errors(exception) Implements the 'backslashreplace' error handling (for text encodings only): malformed data is replaced by a backslashed escape sequence.

codecs.Codec.decode()

Codec.decode(input[, errors]) Decodes the object input and returns a tuple (output object, length consumed). For instance, for a text encoding, decoding converts a bytes object encoded using a particular character set encoding to a string object. For text encodings and bytes-to-bytes codecs, input must be a bytes object or one which provides the read-only buffer interface – for example, buffer objects and memory mapped files. The errors argument defines the error handling to apply. It defaul

codecs.CodecInfo

class codecs.CodecInfo(encode, decode, streamreader=None, streamwriter=None, incrementalencoder=None, incrementaldecoder=None, name=None) Codec details when looking up the codec registry. The constructor arguments are stored in attributes of the same name: name The name of the encoding. encode decode The stateless encoding and decoding functions. These must be functions or methods which have the same interface as the encode() and decode() methods of Codec instances (see Codec Inte

code.InteractiveInterpreter.showsyntaxerror()

InteractiveInterpreter.showsyntaxerror(filename=None) Display the syntax error that just occurred. This does not display a stack trace because there isn’t one for syntax errors. If filename is given, it is stuffed into the exception instead of the default filename provided by Python’s parser, because it always uses '<string>' when reading from a string. The output is written by the write() method.

code.InteractiveInterpreter.runsource()

InteractiveInterpreter.runsource(source, filename="", symbol="single") Compile and run some source in the interpreter. Arguments are the same as for compile_command(); the default for filename is '<input>', and for symbol is 'single'. One several things can happen: The input is incorrect; compile_command() raised an exception (SyntaxError or OverflowError). A syntax traceback will be printed by calling the showsyntaxerror() method. runsource() returns False. The input is incomplete, an

code.InteractiveInterpreter.showtraceback()

InteractiveInterpreter.showtraceback() Display the exception that just occurred. We remove the first stack item because it is within the interpreter object implementation. The output is written by the write() method. Changed in version 3.5: The full chained traceback is displayed instead of just the primary traceback.

code.InteractiveInterpreter.write()

InteractiveInterpreter.write(data) Write a string to the standard error stream (sys.stderr). Derived classes should override this to provide the appropriate output handling as needed.

code.InteractiveConsole.resetbuffer()

InteractiveConsole.resetbuffer() Remove any unhandled source text from the input buffer.

code.InteractiveConsole

class code.InteractiveConsole(locals=None, filename="") Closely emulate the behavior of the interactive Python interpreter. This class builds on InteractiveInterpreter and adds prompting using the familiar sys.ps1 and sys.ps2, and input buffering.

code.InteractiveInterpreter

class code.InteractiveInterpreter(locals=None) This class deals with parsing and interpreter state (the user’s namespace); it does not deal with input buffering or prompting or input file naming (the filename is always passed in explicitly). The optional locals argument specifies the dictionary in which code will be executed; it defaults to a newly created dictionary with key '__name__' set to '__console__' and key '__doc__' set to None.