我使用bpython进行交互式Python会话,并且由于我更新了我的系统,我有以下问题:
在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也是如此。
那么,为什么sys.stdout在bpython3中没有属性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发布于 2015-02-25 18:12:54
这是一个在0.13版本中修复的错误。
用pip3 install -U bpython升级应该更新到最新的稳定版本,其中包括修复。
https://stackoverflow.com/questions/28714581
复制相似问题