Issue1723
Created on 2011-03-23.20:33:59 by jasonsmith, last changed 2015-04-19.22:44:30 by zyasoft.
msg6451 (view) |
Author: Jason Smith (jasonsmith) |
Date: 2011-03-23.20:33:59 |
|
From interactive mode:
>>> import sys
>>> sys.stdout.write("Hello.")
>>> sys.stderr.write("Hello.")
Hello.>>>
The first write should print 'Hello.' to console, but prints nothing.
I also noticed it looks like the print command is printing to stderr, not to stdout (at least it looks like this from another program I have with colored output).
|
msg6452 (view) |
Author: Jason Smith (jasonsmith) |
Date: 2011-03-23.20:36:15 |
|
This bug should be against 2.5.2 final. I don't see it in the list. On Ubuntu 10.10.
|
msg6453 (view) |
Author: Jason Smith (jasonsmith) |
Date: 2011-03-23.20:58:06 |
|
The behavior is as expected when using the -u flag.
|
msg6454 (view) |
Author: Jason Smith (jasonsmith) |
Date: 2011-03-23.22:16:52 |
|
It works if you follow the command by sys.stdout.flush(). The difference between Python and Jython behavior appears to be autoflush.
|
msg6456 (view) |
Author: Philip Jenvey (pjenvey) |
Date: 2011-03-24.20:51:44 |
|
IIRC our problem is our JLine console reader doesn't actually output everything (like the >>> prompt) via sys.stdout. If you disable it and use the bare minimum console I believe we'd match CPython's behavior
So on CPython you're seeing autoflush like behavior because the prompt is immediately printed afterwards and a flush is done to ensure the prompt shows up
Otherwise you'd see similar behavior in cpython if you did:
>>> sys.stdout.write('hello'); time.sleep(2)
Anyway I see this as a very minor implementation detail, but it would be nice to fix this at some point. Though it may be problematic to fix (see #695383 for a somewhat related problem)
|
msg9900 (view) |
Author: Jim Baker (zyasoft) |
Date: 2015-04-19.22:44:30 |
|
So we are writing this output out immediately, per msg6451, however, it does interact poorly with the console prompt being redisplayed by JLine2:
>>> sys.stdout.write("Hello.")
Hello.>>> sys.stderr.write("Hello.")
>>> o.>>>
where as CPython 2.7 does the following:
>>> import sys
>>> sys.stdout.write("Hello.")
Hello.>>> sys.stderr.write("Hello.")
Hello.>>>
|
|
Date |
User |
Action |
Args |
2015-04-19 22:44:30 | zyasoft | set | nosy:
+ zyasoft messages:
+ msg9900 |
2013-02-25 22:03:01 | amak | set | keywords:
+ console nosy:
+ amak |
2013-02-20 00:08:55 | fwierzbicki | set | nosy:
+ fwierzbicki resolution: remind versions:
+ Jython 2.5, - 2.5.2rc |
2011-03-24 20:51:45 | pjenvey | set | priority: low nosy:
+ pjenvey messages:
+ msg6456 components:
+ Core, - Any |
2011-03-23 22:16:52 | jasonsmith | set | messages:
+ msg6454 |
2011-03-23 20:58:06 | jasonsmith | set | messages:
+ msg6453 |
2011-03-23 20:36:15 | jasonsmith | set | messages:
+ msg6452 |
2011-03-23 20:33:59 | jasonsmith | create | |
|