[New-bugs-announce] [issue12402] Overriding code.InteractiveConsole.write does not work

Miki Tebeka report at bugs.python.org
Sat Jun 25 00:45:07 CEST 2011


New submission from Miki Tebeka <miki.tebeka at gmail.com>:

Consider the following code:
    import code

    class Console(code.InteractiveConsole):
        def write(self, data):
            print("DATA: {0}".format(data))

    c = Console()
    c.interact()

Then enter "1" at the prompt. The output will be 1 (and not DATA: 1).
If you create an error (such as 1/0), then the error lines will be prefixed by DATA.

----------
components: Library (Lib)
messages: 138998
nosy: tebeka
priority: normal
severity: normal
status: open
title: Overriding code.InteractiveConsole.write does not work
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12402>
_______________________________________


More information about the New-bugs-announce mailing list