Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upBpython displays logging on single line in Python 3.4 & 3.5 #658
Comments
|
Huh, interesting. Thanks for submitting @xlash. For anyone looking for things to investigate, here are some questions I'm wondering:
One guess: the log handler is batching things more in Python 3? |
|
try this:
|
|
I am very much interested , do help me if I am wrong. |
|
This is against the purpose of 1-liner log. On Python <3.5, it will gives this : CRITICAL:root:test CRITICAL:root:test CRITICAL:root:test CRITICAL:root:test CRITICAL:root:test CRITICAL:root:test CRITICAL:root:test CRITICAL:root:test CRITICAL:root:test (Notice the space in between). This is not a valid work around. |
|
StreamHandler in logging is actually performing two writes when emitting a record.
Whereas in python 2.7.13 it was in the same context as above:
So I think the issue is not related to logging but in the handling of two successive write:
I will continue to dive into bpython's code but I am new to it, so if anyone has a fix or a way to handle this... |
|
Thanks for taking a look @kingtong. Here's some context on the code around where bpython does this. bpython replaces
Each time a write to one of these occurs, we add that new data to our model of the terminal screen and repaint the current view of the REPL (React declarative view style). There's an attribute on the From a cursory look, I think Somewhere in this path that output takes to be written there's a heuristic for splitting stderr lines that isn't accurate. Another place to look for relevant code is in |
|
note to myself to look at this in #681 since I'll be poking at this logic anyway |
|
There's a logic in the The problem is, that it would need to be ran every time something writes to the stderr, not only once in a loop. This issue could be solved by doing it in Please wait, till I get home! I'm going to create a PR. Edit: I've just realized, when writing to stderr, it should not start a new line on every write. |
|
I'm still working on this, but my solution uses the |
|
Didn't need |
|
Fixed in 724f3b9 |
|
Great work @ata2001! |
The following is not displayed properly in Python 3.4.2, and 3.5.2. Is successfull on 2.7.12. Only happens in a loop scenario, but it's not a flushing timing.
This is working also correctly in the normal python interpreter.
Thanks for help.