What will be printed in "Manage app"

I’m using the following code in my application:

mitmdump_process = subprocess.Popen(['mitmdump', '-s', 'addons.py', '-p', '8080'], stdout=sys.stdout, stderr=sys.stderr, env=env)

When I run this code in my local IDE, it prints logs to the console. However, when I deploy my app on Streamlit Cloud, I am unable to view these logs in the left black console of the browser.

I have a few specific concerns:

  1. How can I terminate the subprocess? I tried the following approach, which didn’t produce any errors but affected the starting of my subprocess:
output = subprocess.check_output(['lsof', '-i', ':8081'], universal_newlines=True)
lines = output.strip().split('\n')[1:]
for line in lines:
    fields = line.split()
    if len(fields) >= 2:
        pid = fields[1]
os.kill(pid, signal.SIGKILL)

To view the logs, I used the following code:

with open('outtt.txt', 'w') as outfile:
    mitmdump_process = subprocess.Popen(['mitmdump', '-s', 'addons.py', '-p', '8080'], stdout=outfile, stderr=sys.stderr, env=env

I will really appreciate it if u can help me !!!

2.When encountering issues while deploying to Streamlit Cloud, do you have any other convenient methods for debugging? Because I’m using a Windows system locally, my usual workflow involves making changes and then checking the results on the web page. I don’t know how access the server console or files, making troubleshooting difficult.

Hi @szyab

To terminal a process, you can append .kill() to your process variable, please see the following StackOverflow solution for ideas:

Hope this helps!

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.