Python print statements don't seem to do anything when deployed to server
In this code, when I deploy to railway it runs in a docker container. The issue is that "Starting Bot with Mojo" will print, but nothing I print inside the main function, which is python will work. Any idea why this could be? Is the docker container suppressing output somehow?
Whenever I run locally, everything prints fine
1 Reply
And in vanilla Python, I had to run my code from the dockerfile using
Python -u main.py
so it would run in unbuffered mode.
In mojo all I seem to have is mojo main.mojo
which leads to Python not having the -u flag
I fixed it, for anyone else with a similar issue, all I had to do is set ENV PYTHONUNBUFFERED=1
in my dockerfile