简体   繁体   English

使用日志记录时,Python print()/ sys.stdout.write()不可见

[英]Python print()/sys.stdout.write() not visible when using logging

I'm using logging extensively in my program. 我在程序中广泛使用日志记录。 But now I want to write to stdout without using the logging module, but the output does not show up. 但是现在我想在不使用日志记录模块的情况下写入stdout,但是输出不会显示。

Neither: 无论是:

sys.stdout.write( "BOE!" )

Nor 也不

print( "WAH!" )

is working. 正在工作。 Can someone enlighten me? 有人可以启发我吗?

Its possible that your Python output is being buffered. 您的Python输出可能正在被缓冲。 Have a look at these two StackOverflow QAs: 看一下这两个StackOverflow QA:

  1. Disable output buffering 禁用输出缓冲
  2. How to flush output of Python print? 如何刷新Python打印输出?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM