Error using SegmentEditorExtraEffects with Python script

Hello,
I’m getting an error when I set SegmentEditorExtraEffects using Python. The code is still functional, as it looks like the error is generated when the GUI is updated from the scene. Other segment editor effects work just fine using the same syntax. With any segmentation and volume loaded, this code will produce an error:

segmentationNode=slicer.mrmlScene.GetFirstNodeByClass('vtkMRMLSegmentationNode')
masterVolumeNode=slicer.mrmlScene.GetFirstNodeByClass('vtkMRMLScalarVolumeNode')
segmentEditorWidget = slicer.qMRMLSegmentEditorWidget()
segmentEditorWidget.setMRMLScene(slicer.mrmlScene)
segmentEditorNode = slicer.vtkMRMLSegmentEditorNode()
slicer.mrmlScene.AddNode(segmentEditorNode)
segmentEditorWidget.setMRMLSegmentEditorNode(segmentEditorNode)
segmentEditorWidget.setSegmentationNode(segmentationNode)
segmentEditorWidget.setMasterVolumeNode(masterVolumeNode)
segmentEditorWidget.setActiveEffectByName("Mask volume")

Here’s the error:

Traceback (most recent call last):
File “C:/Users/srolfe/AppData/Roaming/NA-MIC/Extensions-28152/SegmentEditorExtraEffects/lib/Slicer-4.11/qt-scripted-modules/SegmentEditorMaskVolumeLib/SegmentEditorEffect.py”, line 181, in updateGUIFromMRML
operationButton = [key for key, value in self.buttonToOperationNameMap.iteritems() if value == self.scriptedEffect.parameter(“Operation”)][0]
AttributeError: ‘dict’ object has no attribute ‘iteritems’

Any advice is appreciated, thanks.

In Python3, iteritems is removed from dict, so you need to replace it by items. I’ll push a fix soon.

Great, thanks for your help @lassoan!