# Reproducible Slicer crash on attempted tab completion, on Nightly 2020-01-08

**URL:** https://discourse.slicer.org/t/reproducible-slicer-crash-on-attempted-tab-completion-on-nightly-2020-01-08/10146
**Category:** Support
**Created:** [February 6, 2020, 11:32pm UTC](https://discourse.slicer.org/t/reproducible-slicer-crash-on-attempted-tab-completion-on-nightly-2020-01-08/10146 "2020-02-06T23:32:13Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)
#### Post date: [February 6, 2020, 11:32pm UTC](https://discourse.slicer.org/t/reproducible-slicer-crash-on-attempted-tab-completion-on-nightly-2020-01-08/10146/1 "2020-02-06T23:32:13Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [February 7, 2020, 3:07pm UTC](https://discourse.slicer.org/t/reproducible-slicer-crash-on-attempted-tab-completion-on-nightly-2020-01-08/10146/2 "2020-02-07T15:07:45Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)
#### Post date: [February 12, 2020, 5:34pm UTC](https://discourse.slicer.org/t/reproducible-slicer-crash-on-attempted-tab-completion-on-nightly-2020-01-08/10146/3 "2020-02-12T17:34:06Z")

</div>

I’ll try to remember to do this at some point in the future. At the moment, since there is an easy work-around, I am just going with that.

---

<div class="post-metadata">

### Author: ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)
#### Post date: [May 22, 2020, 11:55pm UTC](https://discourse.slicer.org/t/reproducible-slicer-crash-on-attempted-tab-completion-on-nightly-2020-01-08/10146/4 "2020-05-22T23:55:57Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/7/57498c9c0160d93d7d4318d4fdd8461733153f5e.png)

but if I select any of the options, Slicer crashes.

If I reopen Slicer, reopen the AirwayLandmarks module, and do the same thing without using the lambda, i.e.

`>>> slicer.modules.AirwayLandmarksWidget.fhTable.clearS`  
and hit the tab key, I get the same options, but selecting one of them does not crash Slicer.

I’m currently running the Nightly 2020-04-07 release, but will probably update to a more recent nightly early next week.

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [May 23, 2020, 5:13am UTC](https://discourse.slicer.org/t/reproducible-slicer-crash-on-attempted-tab-completion-on-nightly-2020-01-08/10146/5 "2020-05-23T05:13:43Z")

</div>

Thanks for the follow-up. Can you share a minimal example module that reproduces the issue?

---

<div class="post-metadata">

### Author: ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)
#### Post date: [May 25, 2020, 3:28pm UTC](https://discourse.slicer.org/t/reproducible-slicer-crash-on-attempted-tab-completion-on-nightly-2020-01-08/10146/6 "2020-05-25T15:28:07Z")

</div>

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:

> ```
> table = qt.QTableWidget()
> table.setRowCount(5)
> table.setColumnCount(3)
> self.table = table
> parametersFormLayout.addRow(self.table)
> 
> ```

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:

> [INFO][Stream] 25.05.2020 08:11:25 (unknown:0) - ------------------------------  
> [INFO][Stream] 25.05.2020 08:11:25 (unknown:0) - Reloading module: AutoCompleteCrash  
> [INFO][Stream] 25.05.2020 08:11:25 (unknown:0) - ------------------------------  
> [INFO][Stream] 25.05.2020 08:11:25 (unknown:0) -  
> [INFO][Stream] 25.05.2020 08:11:25 (unknown:0) -  
> [INFO][Stream] 25.05.2020 08:11:25 (unknown:0) -  
> [DEBUG][Qt] 25.05.2020 08:11:57 (unknown:0) - Python console user input: slicer.modules.AutoCompleteCrashWidget.table.clearSelection()  
> [DEBUG][Qt] 25.05.2020 08:12:26 (unknown:0) - Python console user input: w = lambda : slicer.modules.AutoCompleteCrashWidget

I am running Slicer nightly 2020-04-07 on Windows 10.

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [May 25, 2020, 3:58pm UTC](https://discourse.slicer.org/t/reproducible-slicer-crash-on-attempted-tab-completion-on-nightly-2020-01-08/10146/7 "2020-05-25T15:58:34Z")

</div>

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/](https://gist.github.com/) and copy the link here)?

---

<div class="post-metadata">

### Author: ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)
#### Post date: [May 26, 2020, 3:48pm UTC](https://discourse.slicer.org/t/reproducible-slicer-crash-on-attempted-tab-completion-on-nightly-2020-01-08/10146/8 "2020-05-26T15:48:52Z")

</div>

Here you go:

> <https://gist.github.com/mikebind/7e9cb1ac13c3cb694cf5d3932008edf9>

---

<div class="post-metadata">

### Author: ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)
#### Post date: [May 28, 2020, 11:10pm UTC](https://discourse.slicer.org/t/reproducible-slicer-crash-on-attempted-tab-completion-on-nightly-2020-01-08/10146/9 "2020-05-28T23:10:56Z")

</div>

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](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.
