Skip to content

faulthandler stdlib module requires fileno on stdout #628

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
goetzc opened this issue Jul 30, 2016 · 7 comments
Closed

faulthandler stdlib module requires fileno on stdout #628

goetzc opened this issue Jul 30, 2016 · 7 comments

Comments

@goetzc
Copy link

goetzc commented Jul 30, 2016

Like issue #622, this one for 'fileno'.

bpython version 0.15 on top of Python 3.5.2 /usr/bin/python
>>> import pyqtgraph.examples
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    import pyqtgraph.examples
  File "/usr/lib/python3.5/site-packages/pyqtgraph/examples/__init__.py", line 1, in <module>
    from .__main__ import run
  File "/usr/lib/python3.5/site-packages/pyqtgraph/examples/__main__.py", line 9, in <module>
    from . import initExample
  File "/usr/lib/python3.5/site-packages/pyqtgraph/examples/initExample.py", line 40, in <module>
    faulthandler.enable()
AttributeError: 'FakeOutput' object has no attribute 'fileno'
@thomasballinger thomasballinger changed the title AttributeError: 'FakeOutput' object has no attribute 'fileno' faulthandler stdlib module requires fileno on stdout Aug 5, 2016
@thomasballinger
Copy link
Member

It looks like this is due to

import faulthandler
faulthandler.enable()

Someone should look into what faulthandler and see what it wanted to do with fileno to see what we should do about it.

  • maybe we should give it the fileno of real stdout
  • maybe we should give it a new fileno it could write to that bpython could listen on

@Kashyap12
Copy link

hi @thomasballinger , I am new to open source, would love to contribute

@thomasballinger
Copy link
Member

@Kashyap12, great to hear, and welcome! Would you like to take a look at this issue? You can contact me at me@ballingt.com or on freenode in #bpython if you want to talk in depth about how to get started or you have questions, or you're welcome to ask them here; @goetzc can mute this thread if it gets long ;)

The first thing you'll want to do is to try out bpython; it'll be helpful context for this issue. You can either pip install it, which would work well enough to start working on this issue, or you can follow these instructions to get a version of the source code that's easy to change on your machine.

There are a few tasks I can think of for this issue:

  • Reproducing the problem by installing pygtgraph and bpython and getting this error again
  • Looking at the source code for faulthandler to figure out why it needs with a fileno on stdout
  • Figuring out what behavior was expected here: what does running this code in the regular Python interpreter do?
  • Trying out adding in a fileno method to stdout that returns the real stdout fileno and seeing how that works

Because faulthandler is part of the standard library, we should definitely try to find a solution that makes this work. I have some ideas (main one: making a new pipe that user Python code like this can write to that we'd combine with regular stdout.write output) but not enough information to know if that approach is necessary.

@Kashyap12
Copy link

Hi @goetzc @thomasballinger , I tried to reproduce the same issue on my bpython set up, i.e.
bpython version 0.16 on top of Python 2.7.6 /usr/bin/python , I pip installed pyqtgraph and then ran the below command on bpython :
import pyqtgraph.examples

I got no error :)

@goetzc
Copy link
Author

goetzc commented Nov 24, 2016

FWIW, with bpython upgraded to 0.16 (and maintaining Python at 3.5.2) I don't get the error :)

@Kashyap12
Copy link

@goetzc so is this issue closed?

@thomasballinger
Copy link
Member

Oh great! It looks like this was fixed by #616.

Thanks for digging into this more @Kashyap12, and thanks @goetzc for reporting and testing again!

@Kashyap12, let me know if you're interested contributing more and would like suggestions for issues. bitesize would be a good place to start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants