ipython: Tab-completion raises exception

Not sure whether this is an issue with IPython 5.0.0 or pyramid_ipython 0.1, but tab-completion raises an exception when trying to tab-complete the transaction module.

  1. pip install -U ipython pyramid_ipython transaction
  2. pshell development.ini
  3. import tran<TAB>
   In [5]: import tranException in thread Thread-127:
   Traceback (most recent call last):
   File "/usr/lib64/python2.7/threading.py", line 813, in __bootstrap_inner
       self.run()
   File "/usr/lib64/python2.7/threading.py", line 766, in run
       self.__target(_self.__args, *_self.__kwargs)
   File "/usr/lib/python2.7/site-packages/prompt_toolkit/interface.py", line 835, in run
       completions = list(buffer.completer.get_completions(document, complete_event))
   File "/usr/lib/python2.7/site-packages/IPython/terminal/ptutils.py", line 24, in get_completions
       cursor_pos=document.cursor_position_col
   File "/usr/lib/python2.7/site-packages/IPython/core/completer.py", line 84, in comp
       text, matches =  complete(_args, *_kwargs)
   File "/usr/lib/python2.7/site-packages/IPython/core/completer.py", line 1186, in complete
       custom_res = self.dispatch_custom_completer(text)
   File "/usr/lib/python2.7/site-packages/IPython/core/completer.py", line 1110, in dispatch_custom_completer
       res = c(event)
   File "/usr/lib/python2.7/site-packages/IPython/core/completerlib.py", line 253, in module_completer
       return module_completion(event.line)
   File "/usr/lib/python2.7/site-packages/IPython/core/completerlib.py", line 229, in module_completion
       return get_root_modules()
   File "/usr/lib/python2.7/site-packages/IPython/core/completerlib.py", line 119, in get_root_modules
       rootmodules_cache = ip.db.get('rootmodules_cache', {})
   AttributeError: 'NoneType' object has no attribute 'db'

@mmerickel

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 3
  • Comments: 18 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Using .instance() creates an instance and sets it as the global shell instance, which the completion machinery uses. Instantiating it directly does not register it as a global shell instance.

Discovered in my code that

This code snippet fails.

shell = InteractiveShellEmbed(config=config, banner1='')
shell()

This code snippet works.

shell = InteractiveShellEmbed.instance(config=config, banner1='')
shell()

There is something being done differently with the instance method call.

@takluyver we’re hitting this as well (on 5.1), and are unable to switch to embed or start_ipython since we’re using set_custom_exc to handle specific exceptions during the input loop.

Any ideas about a possible workaround?