Including a live terminal in the web app

Hello everyone,
My goal was to have the Streamlit web app run a Python file after pressing a button and to display its live terminal in the web app itself while the execution is happening. I am not certain if this is possible. I would appreciate any information that can point me in the right direction.

Hi @n_forcer

By a live terminal, which type of information are you looking to display in the app?

You could use Streamlit to run a Python file after clicking on a button and the output of which could then be read and displayed in the app.

Hope this helps.

Best regards,

Though it’s not optimized for a terminal, you might find this component helpful GitHub - okld/streamlit-ace: Ace editor component for Streamlit. since it adds syntax highlighting

1 Like

Hello @dataprofessor

I apologize for the confusion, you are right, I had been looking at outputs as some terminal commands.

Thank you for your response

1 Like

Hello @blackary
Thank you for the response and thank you for sharing the github repo. You have given an useful tool to explore around

1 Like

Hi @n_forcer

If you’re looking to run command lines from within a Streamlit app, you might want to check out this video that I created showing how to run R from the command line from within a Streamlit app. You can repurpose this to run other commands (via subprocess library using Popen).

Hope this helps!

Best regards,

1 Like

There is also pyscript to run python from the browser, if there is no need to run it from the server using subprocess.


import streamlit as st
from streamlit_ace import st_ace

"# Running `pyscript`"

"## Input"

code = st_ace(
    tab_size= 4,
    font_size=16, height=200

"## Output"

html = f"""
    <link rel="stylesheet" href="" />
    <script defer src=""></script>

st.components.v1.html(html, height=200, scrolling=True)


Hello everyone,
a quick question can i print the outputs, inside a console looking ui inside the streamlit web app