Running the following code snippet in the python interactor (or a linked Jupyter notebook) and then typing “interp_f” and hitting the Tab key reproducibly crashes Slicer.
from scipy.interpolate import RegularGridInterpolator
import numpy as np
data_kji = np.ones((10,20,30)) #arrayFromVolume(volNode)
data_ijk = np.transpose(data_kji, axes=(2,1,0)) # reverse dimension order from kji to ijk
iLen,jLen,kLen = data_ijk.shape
iVals = list(range(iLen))
jVals = list(range(jLen))
kVals = list(range(kLen))
interp_from_ijk = RegularGridInterpolator((iVals, jVals, kVals), data_ijk)
If I don’t use Tab completion, I can use the interpolator just fine, e.g.
interp_from_ijk([[5,5,5]])
works as expected with no crash.
This crash occurs even after a clean Slicer start. It also occurs without being linked to a Jupyter kernel.
Interesting. I cannot reproduce this with latest Slicer Preview Release on Windows - auto-complete for interp_f works without any problem. Maybe you could start with a new Slicer installation, installing Python packages one by one and see which one introduces the crash.
I have encountered a problem like this again. I have a very simple module I am developing (called “AirwayLandmarks”) which has a qt.QTableWidget() as a GUI element. I had defined a convenience lambda at the Python interactor prompt:
w = lambda : slicer.modules.AirwayLandmarksWidget
I did this just to save a little typing after reloading the module as I was developing it. That way instead of typing slicer.modules.AirwayLandmarksWidget I could just type w().
The QtableWidget is stored in slicer.modules.AirwayLandmarksWidget.fhTable, which I can also access via w().fhTable. If I try to tab-complete something after this, i.e. something like >>> w().fhTable.clearS
and hit the tab key, the normal autocomplete list appears with appropriate options
Using the extension wizard, I created a module with the default auto-created code, called AutoCompleteCrash. To the AutoCompleteCrash.py file I inserted the following 5 lines at line 81:
Then, after reloading the module, at the python interactor slicer.modules.AutoCompleteCrash.table.clearSelection() does not cause a crash, even when tab autocomplete is used partway through typing clearSelection(), but after w = lambda : slicer.modules.AutoCompleteCrashWidget, then w().table.clearSel followed by pressing the tab key crashes Slicer and the window closes.
Here are the last few lines of the log file of a crashed session:
Thank you for the more detailed information, it is very useful. Would you mind sharing your AutoCompleteCrash.py file(upload to https://gist.github.com/ and copy the link here)?
I just downloaded and installed the 2020-05-27 preview release, and I cannot reproduce this crash on the new release. I also can’t use the new release because it appears to not be compatible with extensions I rely on (SlicerJupyter, SegmentEditorExtraEffects, SlicerOpenCV), but at least this issue seems to have been resolved somehow, and I’ll look forward to when I can upgrade.
EDIT: It turns out the Extension Manager was incorrectly informing me that these extensions were not compatible, after a series of frustrating interactions with the Extension Manager (https://discourse.slicer.org/t/problematic-behavior-of-the-extension-manager/10986), it told me that actually these extensions ARE compatible with the version I just installed, and I was able to install them. I did not restart immediately, and when I reopened the Extension Manager, it again told me that none of the extensions were compatible. However, when I restarted Slicer, they were all installed, so I think things are good.