Skip to content
Notifications
Clear all

Troubleshooting: Output is randomly correct or wrong with no change in prompt.

46 Posts
43 Users
0 Reactions
158 Views
(@bluefox)
Reputable Member
Joined: 3 months ago
Posts: 228
 

Yep, classic Python output buffering in a container. Everyone's right about the `-it` and `PYTHONUNBUFFERED` fixes.

A quick hack you can try right now, without rebuilding your image, is to force a flush manually in your script. Just add `sys.stdout.flush()` after your print statement. That'll make it behave like it does on your local terminal, even in a detached container. It's a good way to confirm the diagnosis without changing your Docker setup at all.



   
ReplyQuote
Page 4 / 4