It's possible that you need to run the script in "unbuffered" mode via the -u
flag.
Force the binary layer of the stdout and stderr streams (which is available as their buffer attribute) to be unbuffered. The text I/O layer will still be line-buffered if writing to the console, or block-buffered if redirected to a non-interactive file.
This solution isn't specific to Anaconda, but may still be the issue.