1

I am using bpython for interactive Python sessions and since I updated my system I have the following problem:

In bpython3:

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

However, in Python3:

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

The same for IPython3.

So why does sys.stdout not have the attribute flush in bpython3? I searched for the source code of the sys module, but couldn't find it. Nor could I find a sysmodule.c file or something like that. Doesn't bpython use the same code for this module as the other CLIs?

$ 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
5
  • does sys.__stdout__.flush work? Commented Feb 25, 2015 at 9:13
  • This indeed does work in bpython3, @PadraicCunningham Commented Feb 25, 2015 at 9:15
  • 1
    seems to be a bug that was fixed in version 0.13 docs.bpython-interpreter.org/… pip3 install -U bpython should fix the issue Commented Feb 25, 2015 at 9:24
  • 1
    Great, thank you. It fixed the issue. For completeness, the commit where this bug was fixed: Github Commented Feb 25, 2015 at 9:39
  • @J.F.Sebastian, sure, done. Commented Feb 25, 2015 at 18:13

1 Answer 1

4

It is a bug that was fixed in version 0.13.

Upgrading with pip3 install -U bpython should update to the latest stable release which includes the fix.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.