Skip to content
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

ipython 7.10.1 and ipdb 0.12.3 #179

Closed
JBKahn opened this issue Dec 4, 2019 · 12 comments
Closed

ipython 7.10.1 and ipdb 0.12.3 #179

JBKahn opened this issue Dec 4, 2019 · 12 comments

Comments

@JBKahn
Copy link
Contributor

JBKahn commented Dec 4, 2019

I'm currently running into an issue with inputhook

In [1]: import ipdb; ipdb.set_trace()
<IPython.terminal.debugger.TerminalPdb object at 0x7fbca4678b50>
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-f3f8e0a2fcd8> in <module>
----> 1 import ipdb; ipdb.set_trace()

/usr/local/lib/python3.8/site-packages/ipdb/__main__.py in set_trace(frame, context)
     65     if frame is None:
     66         frame = sys._getframe().f_back
---> 67     p = _init_pdb(context).set_trace(frame)
     68     if p and hasattr(p, 'shell'):
     69         p.shell.restore_sys_module_state()

/usr/local/lib/python3.8/site-packages/ipdb/__main__.py in _init_pdb(context, commands)
     46 def _init_pdb(context=3, commands=[]):
     47     try:
---> 48         p = debugger_cls(context=context)
     49     except TypeError:
     50         p = debugger_cls()

/usr/local/lib/python3.8/site-packages/IPython/terminal/debugger.py in __init__(self, *args, **kwargs)
     28         Pdb.__init__(self, *args, **kwargs)
     29         self._ptcomp = None
---> 30         self.pt_init()
     31
     32     def pt_init(self):

/usr/local/lib/python3.8/site-packages/IPython/terminal/debugger.py in pt_init(self)
     68         if not PTK3:
     69             print(self)
---> 70             options['inputhook'] = self.inputhook
     71         self.pt_app = PromptSession(**options)
     72

AttributeError: 'TerminalPdb' object has no attribute 'inputhook'

I'm trying to investigate and I'll update with my own findings

@JBKahn JBKahn changed the title ipython 7.10, pytest and ipdb ipython 7.10 and ipdb Dec 4, 2019
@JBKahn
Copy link
Contributor Author

JBKahn commented Dec 4, 2019

I found if I add debugger_cls.inputhook = None before p = debugger_cls(context=context) that allows it to continue but I'm not sure what the actual fix is.

@JBKahn
Copy link
Contributor Author

JBKahn commented Dec 4, 2019

This doesn't seem to be a duplicate of ipython/ipython#11979 but is actually an issue with the ipdb code. In that the self or TerminalPdb is missing the attribute, nothing to do with the options it is passing down.

@JBKahn JBKahn changed the title ipython 7.10 and ipdb ipython 7.10.1 and ipdb 0.12.3 Dec 4, 2019
@JBKahn
Copy link
Contributor Author

JBKahn commented Dec 4, 2019

Ahhh I take it back, if you look at ipython/ipython#11979 it seems it introduced an accidental code change from self.shell.inputhook to self.inputhook

@JBKahn
Copy link
Contributor Author

JBKahn commented Dec 4, 2019

This seems like an Ipython issue so I'll close it out @gotcha

@JBKahn JBKahn closed this as completed Dec 4, 2019
@JBKahn
Copy link
Contributor Author

JBKahn commented Dec 4, 2019

I opened a PR here: ipython/ipython#12003

@szeitlin
Copy link

@JBKahn I ran into the same bug, so I tried adding your fix, but I'm still seeing a failure when I try to debug within a unit test. But now I'm getting `AttributeError: 'TerminalInteractiveShell' object has no attribute 'shell'. Do you know if there were a lot of other changes made recently to your working version, or if there will be an update released soon?

I'm on python 3.7, ipython 7.10.1, ipdb 0.12.3.

@JBKahn
Copy link
Contributor Author

JBKahn commented Dec 12, 2019

This I think @szeitlin ipython/ipython#12007

@JBKahn
Copy link
Contributor Author

JBKahn commented Dec 12, 2019

But other than that I'm not sure. I'm not currently using my fix since ipython hasn't released a new version yet. I just pinned to 7.9

@JBKahn
Copy link
Contributor Author

JBKahn commented Dec 12, 2019

Can you please post the entire error, I can try to help you debug

@szeitlin
Copy link

szeitlin commented Dec 12, 2019

File "/Users/samantha.zeitlin/[redacted]", line 72, in [method] import ipdb; ipdb.set_trace() File "/opt/anaconda3/envs/eda/lib/python3.7/site-packages/ipdb/__init__.py", line 7, in <module> from ipdb.__main__ import set_trace, post_mortem, pm, run # noqa File "/opt/anaconda3/envs/eda/lib/python3.7/site-packages/ipdb/__main__.py", line 29, in <module> ipapp.initialize(['--no-term-title']) File "</opt/anaconda3/envs/eda/lib/python3.7/site-packages/decorator.py:decorator-gen-113>", line 2, in initialize File "/opt/anaconda3/envs/eda/lib/python3.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error return method(app, *args, **kwargs) File "/opt/anaconda3/envs/eda/lib/python3.7/site-packages/IPython/terminal/ipapp.py", line 317, in initialize self.init_shell() File "/opt/anaconda3/envs/eda/lib/python3.7/site-packages/IPython/terminal/ipapp.py", line 333, in init_shell ipython_dir=self.ipython_dir, user_ns=self.user_ns) File "/opt/anaconda3/envs/eda/lib/python3.7/site-packages/traitlets/config/configurable.py", line 412, in instance inst = cls(*args, **kwargs) File "/opt/anaconda3/envs/eda/lib/python3.7/site-packages/IPython/terminal/interactiveshell.py", line 514, in __init__ self.init_prompt_toolkit_cli() File "/opt/anaconda3/envs/eda/lib/python3.7/site-packages/IPython/terminal/interactiveshell.py", line 325, in init_prompt_toolkit_cli **self._extra_prompt_options()) File "/opt/anaconda3/envs/eda/lib/python3.7/site-packages/IPython/terminal/interactiveshell.py", line 441, in _extra_prompt_options options['inputhook'] = self.shell.inputhook AttributeError: 'TerminalInteractiveShell' object has no attribute 'shell'

@szeitlin
Copy link

in the meantime I may try downgrading to 7.9 since I don't think I care too much about having the very latest version?

@JBKahn
Copy link
Contributor Author

JBKahn commented Dec 12, 2019

Try this: ipython/ipython#12007

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

No branches or pull requests

2 participants