Cannot print the terminal output in Streamlit?

Hello @Charly_Wargnier,
So instead of appending the text, you want it to be overriden.

You could try something like this:

# Before
def new_write(b):
    if getattr(current_thread(), REPORT_CONTEXT_ATTR_NAME, None):
        buffer.write(b)
        output_func(buffer.getvalue())
    else:
        old_write(b)

# After
def new_write(b):
    if getattr(current_thread(), REPORT_CONTEXT_ATTR_NAME, None):
        buffer.write(b)
        output_func(b)  # Changed here
    else:
        old_write(b)
1 Like

Thanks Synode! I’ll have a proper look asap. :slight_smile:

Did you get a solution?

Hey Filip!

If you could send some kind of notification in a few hours when i will be near the PC, I will provied you with a solution I’ve managed to create using some of the code here, which works great, not exactly a console, but you are able to see the output if it’s comming from ‘logging’, and you can see it on the screen :slight_smile:

Best regards.

1 Like

This is my problem. I’m utilizing a library that prints this things in my Console output.

I would like to print the same messages in Streamlit page.

Can you help me?

Hello @BugzTheBunny ! I’m interested if you could provide a solution for the output coming from “logging” :slight_smile:

This code is great, thank you @synode for your work and @Charly_Wargnier for asking the question :slight_smile:

Have a nice day!

Hi guys, ive made a demo of the samples of the code here, you may view it in this repo:

@Ejoz @filipespacheco