Opened 7 years ago

Closed 6 years ago

#1802 closed defect (fixed)

Python shell: tab completion produces "KeyError: 'matches' " after failed import

Reported by: tic20@… Owned by: Conrad Huang
Priority: major Milestone:
Component: General Controls Version:
Keywords: Cc: pett, Tom Goddard
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

The following bug report has been submitted:
Platform:        Linux-3.10.0-957.5.1.el7.x86_64-x86_64-with-centos-7.6.1810-Core
ChimeraX Version: 0.9 (2019-03-25)
Description
- open shell
- attempt to import a non-existent package, e.g.

from chimerax import a
ImportError: cannot import name 'a' from 'chimerax' (unknown location)

After this, trying to tab-complete an import statement in the shell gives this traceback.

Log:
UCSF ChimeraX version: 0.9 (2019-03-25)  
© 2016-2019 Regents of the University of California. All rights reserved.  
How to cite UCSF ChimeraX  

> toolshed show Shell

/opt/UCSF/ChimeraX-daily/lib/python3.7/site-
packages/IPython/core/history.py:226: UserWarning: IPython History requires
SQLite, your history will not be saved  
warn("IPython History requires SQLite, your history will not be saved")  
Traceback (most recent call last):  
File "/opt/UCSF/ChimeraX-daily/lib/python3.7/site-
packages/qtconsole/base_frontend_mixin.py", line 138, in _dispatch  
handler(msg)  
File "/opt/UCSF/ChimeraX-daily/lib/python3.7/site-
packages/qtconsole/jupyter_widget.py", line 152, in _handle_complete_reply  
matches = content['matches']  
KeyError: 'matches'  
  
KeyError: 'matches'  
  
File "/opt/UCSF/ChimeraX-daily/lib/python3.7/site-
packages/qtconsole/jupyter_widget.py", line 152, in _handle_complete_reply  
matches = content['matches']  
  
See log for complete Python traceback.  
  




OpenGL version: 3.3.0 NVIDIA 415.27
OpenGL renderer: TITAN Xp/PCIe/SSE2
OpenGL vendor: NVIDIA Corporation

Change History (7)

comment:1 by Tristan Croll, 7 years ago

Platform: all
Project: ChimeraX

More: if I attempt to run *any* command after this I get ERROR: Execution aborted. On quitting ChimeraX, the following lines get written to stderr:

NOTE: ERROR:root:Invalid alias: The name clear can't be aliased because it is another magic command.
ERROR:root:Invalid alias: The name more can't be aliased because it is another magic command.
ERROR:root:Invalid alias: The name less can't be aliased because it is another magic command.
ERROR:root:Invalid alias: The name man can't be aliased because it is another magic command.

Pretty sure this has happened before, in an old ticket?

comment:2 by Tristan Croll, 7 years ago

See #1370 and #1386.

comment:3 by pett, 7 years ago

Cc: pett added
Component: UnassignedGeneral Controls
Owner: set to Conrad Huang
Status: newassigned
Summary: ChimeraX bug report submissionPython shell: tab completion produces "KeyError: 'matches' " after failed import

Last Saturday Conrad went to newer versions of ipykernel and ipython (4.9.0→5.1.0 and 6.5.0→7.4.0 respectively), which had fixes for the problems reported in #1370 and #1386, but apparently suffers from the problem reported in this ticket. As per https://github.com/jupyter/qtconsole/issues/318, this problem may be fixed in ipykernel 5.1.1, so we should try that as soon as it is available.

comment:4 by pett, 7 years ago

Cc: Tom Goddard added
Priority: normalmajor

comment:5 by Conrad Huang, 7 years ago

I've reverted back to 4.9.0/6.5.0 until 5.1.1 comes out.

comment:6 by Tom Goddard, 7 years ago

In the daily build from a few days ago, any error in the Python shell completely broke the shell, all subsequent statements giving "Execution error" as noted in ticket #1802.

comment:7 by Conrad Huang, 6 years ago

Resolution: fixed
Status: assignedclosed

ipykernel 5.1.1 was released and the problem appears fixed. Errors no longer completely breaks the shell and tab completion seems to work.

Note: See TracTickets for help on using tickets.