用 docker 又加左 python scheduler 但又無 print 唔出野

但 call 其他野 print 又無啦啦彈翻晒出黎? 放心你個 schedulrr 同個 program 都無事

solution:

put this in docker-compose

PYTHONUNBUFFERED=1

ChatGPT ans:

If you’re using the apscheduler library in your FastAPI app running in a Docker container, and you’re not seeing print messages in the container logs, it’s possible that the messages are being buffered by the apscheduler library or the Python interpreter, and are not being immediately flushed to the Docker logs.

One way to force the print messages to be immediately flushed to the Docker logs is to set the PYTHONUNBUFFERED environment variable to 1 when running the container. This will disable output buffering in the Python interpreter, and ensure that print messages are immediately written to the Docker logs.