Skip to content

Best way to capture and stream stdout #1065

@havok2063

Description

@havok2063

I'd like to capture stdout within my solara app and make it available to the frontend. In voila, I could do this using ipywidgets.Output.capture and add a traitlet for the mount_id. However in solara, with something similar, the page displays "Loading widget ...". Should this be turned into a reactive parameter?

import ipywidgets as widgets
import solara

output = widgets.Output()



def do_something():
    print('doing something')


@solara.component
@output.capture(clear_output=True)
def Page():
    print('this is a test page')
    with solara.Column():
        do_something()
        solara.Markdown("Test page")
        solara.display(output)


Page()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions