在PyCharm中运行bash脚本时请参阅stdout

时间:2022-06-11 00:05:21

I use a bash script to call several python scripts. I installed the bash plugin for PyCharm. I can run the script, but I don't see stdout during runtime, even though I see it after everything finished. How can I make that visible during runtime?

我使用bash脚本来调用几个python脚本。我为PyCharm安装了bash插件。我可以运行脚本,但是我没有在运行时看到stdout,即使我在完成所有内容后都看到它。如何在运行时将其显示出来?

1 个解决方案

#1


Without all of the required information, my guess would be that this is due to Python buffering its output, which is its default behavior. You can easily disable this by passing python the -u flag or by setting the PYTHONUNBUFFERED environment variable.

没有所有必需的信息,我的猜测是,这是由于Python缓冲其输出,这是它的默认行为。您可以通过传递python -u标志或通过设置PYTHONUNBUFFERED环境变量来轻松禁用它。

This is described in this SO answer.

这个SO答案中描述了这一点。

#1


Without all of the required information, my guess would be that this is due to Python buffering its output, which is its default behavior. You can easily disable this by passing python the -u flag or by setting the PYTHONUNBUFFERED environment variable.

没有所有必需的信息,我的猜测是,这是由于Python缓冲其输出,这是它的默认行为。您可以通过传递python -u标志或通过设置PYTHONUNBUFFERED环境变量来轻松禁用它。

This is described in this SO answer.

这个SO答案中描述了这一点。