python - sys.stdout 在 bpython 中没有刷新属性

标签 python python-3.x sys bpython

我使用 bpython 进行交互式 Python session ,自从我更新了系统后,我遇到了以下问题:

在 bpython3 中:

>>> import sys
>>> sys.stdout.flush
Traceback (most recent call last):
  File "<input>", line 1, in <module>
AttributeError: 'FakeStream' object has no attribute 'flush'

但是,在Python3中:

>>> import sys
>>> sys.stdout.flush
<built-in method flush of _io.TextIOWrapper object at 0x7fab6b7fb708>

IPython3 也是如此。

那么为什么bpython3中sys.stdout没有属性flush呢?我搜索了sys模块的源代码,但没有找到。我也找不到 sysmodule.c 文件或类似的文件。 bpython 是否对该模块使用与其他 CLI 相同的代码?

$ bpython3 --version
bpython version 0.12 on top of Python 3.4.2
(C) 2008-2012 Bob Farrell, Andreas Stuehrk et al. See AUTHORS for detail.

$ python3 --version
Python 3.4.2

最佳答案

这是一个错误,已在版本 0.13 中修复。

使用 pip3 install -U bpython 升级应该更新到包含修复程序的最新稳定版本。

关于python - sys.stdout 在 bpython 中没有刷新属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28714581/

相关文章:

python - RandomizedSearchCV 的 best_params 未按预期显示输出

python - Flask系统找不到指定的路径: '130.127.5.9'

python-3.x - 使用 PySNMP 的 snmpwalk

Python 命名约定——namedtuples

python - Python 系统调用失败

python - 如何准确识别 O(nlogn)?

python - “模块”对象没有属性 'isna'

python - Python 中的 *tuple 和 **dict 是什么意思?

python - 为什么我不能连续两次在 sys.stdin 中执行循环? (Python)

python - 为什么python系统路径中一个目录是另一个目录的子目录?