eset / ipyida

IPython console integration for IDA Pro

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IDAPythonStdOut Error on Mac

ExiaHan opened this issue · comments

Hello, sorry for disturbing.

I met a problem which seems a little like #3 which should be fixed before. Could you please to have a look about my issue? Thanks.

Below is my environment info and the callstack.

CPU: Intel
OS: Mac OS 11.5
IDA Pro Version: 7.5
Python: Python 3.8.11 installed via pyenv install
Callstack:

/Applications/IDA Pro 7.5/ida64.app/Contents/MacOS/plugins/ipyida_plugin_stub.py: 'IDAPythonStdOut' object has no attribute 'fileno'
Traceback (most recent call last):
  File "/Applications/IDA Pro 7.5/ida64.app/Contents/MacOS/python/3/ida_idaapi.py", line 604, in IDAPython_ExecScript
    exec(code, g)
  File "/Applications/IDA Pro 7.5/ida64.app/Contents/MacOS/plugins/ipyida_plugin_stub.py", line 10, in <module>
    from ipyida.ida_plugin import PLUGIN_ENTRY, IPyIDAPlugIn
  File "/Users/xxx/.pyenv/versions/3.8.11/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ipyida/ida_plugin.py", line 61, in <module>
    _kernel.start()
  File "/Users/xxx/.pyenv/versions/3.8.11/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ipyida/kernel.py", line 87, in start
    app.initialize()
  File "/Users/xxx/.pyenv/versions/3.8.11/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/traitlets/config/application.py", line 87, in inner
    return method(app, *args, **kwargs)
  File "/Users/xxx/.pyenv/versions/3.8.11/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ipykernel/kernelapp.py", line 629, in initialize
    self.init_io()
  File "/Users/xxx/.pyenv/versions/3.8.11/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ipykernel/kernelapp.py", line 416, in init_io
    sys.stdout = outstream_factory(self.session, self.iopub_thread,
  File "/Users/xxx/.pyenv/versions/3.8.11/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ipykernel/iostream.py", line 379, in __init__
    self._setup_stream_redirects(name)
  File "/Users/xxx/.pyenv/versions/3.8.11/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ipykernel/iostream.py", line 397, in _setup_stream_redirects
    fno = getattr(sys, name).fileno()
AttributeError: 'IDAPythonStdOut' object has no attribute 'fileno'

Hi @ExiaHan !

You are not disturbing at all thanks for reporting the bug!

I was able to reproduce and it seems there are changes in ipykernel breaking IPyIDA because of the "fake" sys.stdout provided by IDAPython. Possibly this change: ipython/ipykernel@ae2f441

This change was introduce in ipykernel 6.0.0, so downgrading to version 5 should remediate this while I properly fix compatibility in IPyIDA. In your pyenv you can use pip install -U 'ipykernel < 6' to downgrade to a version compatible eith IPyIDA.

Hi @ExiaHan !

You are not disturbing at all thanks for reporting the bug!

I was able to reproduce and it seems there are changes in ipykernel breaking IPyIDA because of the "fake" sys.stdout provided by IDAPython. Possibly this change: ipython/ipykernel@ae2f441

This change was introduce in ipykernel 6.0.0, so downgrading to version 5 should remediate this while I properly fix compatibility in IPyIDA. In your pyenv you can use pip install -U 'ipykernel < 6' to downgrade to a version compatible eith IPyIDA.

Hi @marc-etienne ,
Thanks for your replying.
After I tried to down-grade ipykernel to 5.2.1 the issue is solved.

Thanks again for your kindly help. :)

I released v1.7 which should be compatible with ipykernel 6. The new upstream feature works: stuff like os.system("echo TEST") now outputs in the console if ipykernel is up-to-date.