Pyinstaller flush input

北城余情 提交于 2019-12-11 16:44:37

问题


I've a python program which works fine within the Pycharm environment.

I tried compiling it with Pyinstalle to a onefile executable. It works fine, but I see no output till I select it. I actually casually discovered this using ctrl+A.

I tried adding flush=True to print, but with no results.

The program starts with a simple print and even that first one won't show up.

Any ideas?

EDIT: It also seems like that this "buffering" stops execution, but I'm not completely sure of that.


回答1:


Using

sys.stdout.flush()

Instead of

print("", flush=True)

solved the problem for me.



来源:https://stackoverflow.com/questions/50563758/pyinstaller-flush-input

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!