PyCharm 输出错误消息散布在控制台输出中.如何解决这个问题? [英] PyCharm output error messages interspersed with console output. How to fix this?

查看:44
本文介绍了PyCharm 输出错误消息散布在控制台输出中.如何解决这个问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行 PyCharm 社区版 4.0.4

I'm running PyCharm Community Edition 4.0.4

有谁知道为什么控制台输出后不显示错误消息?

Does anyone know why the error messages don't display after the console output?

谢谢

C:\Python27\python.exe "F:/Google Drive/code/python_scripts/leetcode/lc_127_word_ladder.py"
Traceback (most recent call last):
START
  File "F:/Google Drive/code/python_scripts/leetcode/lc_127_word_ladder.py", line 68, in <module>

    print sol.ladderLength('talk', 'tail', set)
Graph:
  File "F:/Google Drive/code/python_scripts/leetcode/lc_127_word_ladder.py", line 54, in ladderLength
hall ['fall']
    for item in graph[node[0]]:
fall ['hall']
KeyError: 'talk'
End Graph:

Visited =  {'talk': 0}


Node =  ['talk', 0]
Queue Before =  deque([])

Process finished with exit code 1

如果你注意到了,打印语句如 STARTGraph:hall ['fall'],直到 Queue Before = deque([]) 都发生在我代码的功能部分.错误消息应该在所有这些之后出现.

If you'll notice, print statements such as START, Graph:, hall ['fall'], up to Queue Before = deque([]) all happen within the functioning part of my code. The Error messages should appear after all this.

推荐答案

这是由 PyCharm 混合来自 stdout 和 stderr 的打印语句引起的.如果您将以下行添加到 idea.properties 文件中,则会有一个修复:

This is caused by PyCharm mixing print statements from stdout and stderr. There's a fix if you add the following line to your idea.properties file:

output.reader.blocking.mode=true

通过帮助进入idea.properties |编辑自定义属性.

Get to idea.properties via Help | Edit Custom Properties.

这篇关于PyCharm 输出错误消息散布在控制台输出中.如何解决这个问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆