在这里的一个相关问答中,有人假设 emacs(23.2) 中的 python-shell 是块缓冲的,而不是行缓冲的。推荐的修复方法是将 sys.stdout.flush() 添加到我希望 stdio 将其内容刷新到 python-shell 的脚本中的位置。
有没有办法欺骗 python-shell(在 Windows 上的 emacs 23.2 中运行,而不是 Linux)进入 a) 认为它附加到 TTY 或 b) 使用行缓冲而不是块缓冲模式?我不明白为什么我可以在 IDLE 但不能在 emacs 中执行此操作。
我宁愿自定义 emacs,也不愿在我的脚本中添加 sys.stdout.flush()。叫我懒惰:-)。
谢谢,
麦克风