This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2011年06月24日 22:45 by tebeka, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg138998 - (view) | Author: Miki Tebeka (tebeka) * | Date: 2011年06月24日 22:45 | |
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.
|
|||
| msg139000 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2011年06月24日 23:15 | |
That's correct. The write method is for writing to stderr, and by implication is called only for errors. Not, I think, the most obvious name that could have been chosen for the method, but it does seem to be doing what it is documented to do in your example. |
|||
| msg139003 - (view) | Author: Miki Tebeka (tebeka) * | Date: 2011年06月24日 23:53 | |
I'm trying to read/write data from a socket. Does this mean I need to roll up my own Interpreter? (e.g. no way to override writing to stdout?) Since this is the expected behaviour, will close this one. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:18 | admin | set | github: 56611 |
| 2011年06月25日 04:49:07 | r.david.murray | set | status: open -> closed |
| 2011年06月24日 23:53:09 | tebeka | set | status: closed -> open messages: + msg139003 |
| 2011年06月24日 23:15:52 | r.david.murray | set | status: open -> closed nosy: + r.david.murray messages: + msg139000 resolution: not a bug stage: resolved |
| 2011年06月24日 22:45:07 | tebeka | create | |