If I right-click on a layer generated by this plugin, the following error message appears in the console:
error message
```bash
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
File ~/mambaforge/envs/napari/lib/python3.9/site-packages/napari/_qt/containers/_layer_delegate.py:155, in LayerDelegate.editorEvent(self=, event=, model=, option=, index=)
147 """Called when an event has occured in the editor.
148
149 This can be used to customize how the delegate handles mouse/key events
150 """
151 if (
152 event.type() == event.MouseButtonRelease
153 and event.button() == Qt.RightButton
154 ):
--> 155 self.show_context_menu(
self =
event =
model =
option =
index =
156 index, model, event.globalPos(), option.widget
157 )
159 # if the user clicks quickly on the visibility checkbox, we *don't*
160 # want it to be interpreted as a double-click. We want the visibilty
161 # to simply be toggled.
162 if event.type() == event.MouseButtonDblClick:
File ~/mambaforge/envs/napari/lib/python3.9/site-packages/napari/_qt/containers/_layer_delegate.py:187, in LayerDelegate.show_context_menu(self=, index=, model=, pos=PyQt5.QtCore.QPoint(288, 594), parent=)
184 self._context_menu = QtActionContextMenu(_LAYER_ACTIONS)
186 layer_list: LayerList = model.sourceModel()._root
--> 187 self._context_menu.update_from_context(get_context(layer_list))
layer_list = [, , , ]
self._context_menu =
self =
188 action = self._context_menu.exec_(pos)
189 if action is not None and isinstance(action.data(), dict):
190 # action.data will be a callable that accepts a layer_list instance
File ~/mambaforge/envs/napari/lib/python3.9/site-packages/napari/_qt/widgets/qt_action_context_menu.py:117, in QtActionContextMenu.update_from_context(self=, ctx=Context({'layers_selection_count': 1, 'all_layer...same_shape': True}, {}, SettingsAwareContext({})))
115 enable = d['enable_when']
116 if isinstance(enable, Expr):
--> 117 enable = enable.eval(ctx)
enable = Compare(
left=BoolOp(
op=And(),
values=[
Compare(
left=ContextKey(id='active_layer_type', ctx=Load()),
ops=[
Eq()],
comparators=[
Constant(value='image')]),
ContextKey(id='active_layer_ndim', ctx=Load())]),
ops=[
Gt()],
comparators=[
Constant(value=2)])
ctx = Context({'layers_selection_count': 1, 'all_layers_linked': False, 'unselected_linked_layers': 0, 'active_layer_is_rgb': False, 'active_layer_type': 'image', 'only_images_selected': True, 'only_labels_selected': False, 'only_shapes_selected': False, 'active_layer_ndim': None, 'active_layer_shape': (1920, 1920), 'active_layer_dtype': 'uint16', 'all_layers_same_shape': True}, {}, SettingsAwareContext({}))
118 item.setEnabled(bool(enable))
119 # if it's a menu, iterate (but don't toggle visibility)
File ~/mambaforge/envs/napari/lib/python3.9/site-packages/napari/utils/context/_expressions.py:186, in Expr.eval(self=Compare(
left=BoolOp(
op=And(),
values... Gt()],
comparators=[
Constant(value=2)]), context=Context({'layers_selection_count': 1, 'all_layer...same_shape': True}, {}, SettingsAwareContext({})))
184 code = compile(ast.Expression(body=self), '', 'eval')
185 try:
--> 186 return eval(code, {}, context)
code = at 0x175732240, file "", line 1>
context = Context({'layers_selection_count': 1, 'all_layers_linked': False, 'unselected_linked_layers': 0, 'active_layer_is_rgb': False, 'active_layer_type': 'image', 'only_images_selected': True, 'only_labels_selected': False, 'only_shapes_selected': False, 'active_layer_ndim': None, 'active_layer_shape': (1920, 1920), 'active_layer_dtype': 'uint16', 'all_layers_same_shape': True}, {}, SettingsAwareContext({}))
187 except NameError:
188 miss = {k for k in _iter_names(self) if k not in context}
File :1
TypeError: '>' not supported between instances of 'NoneType' and 'int'
```
Looks like something that should be an int is None instead? But it's a pretty show-stopping bug, because it prevents me from converting an image layer to a label layer.
edit: here's the contents of my conda environment, in case that's of use:
If I right-click on a layer generated by this plugin, the following error message appears in the console:
error message
```bash --------------------------------------------------------------------------- TypeError Traceback (most recent call last) File ~/mambaforge/envs/napari/lib/python3.9/site-packages/napari/_qt/containers/_layer_delegate.py:155, in LayerDelegate.editorEvent(self=at 0x175732240, file "", line 1>
context = Context({'layers_selection_count': 1, 'all_layers_linked': False, 'unselected_linked_layers': 0, 'active_layer_is_rgb': False, 'active_layer_type': 'image', 'only_images_selected': True, 'only_labels_selected': False, 'only_shapes_selected': False, 'active_layer_ndim': None, 'active_layer_shape': (1920, 1920), 'active_layer_dtype': 'uint16', 'all_layers_same_shape': True}, {}, SettingsAwareContext({}))
187 except NameError:
188 miss = {k for k in _iter_names(self) if k not in context}
File :1
TypeError: '>' not supported between instances of 'NoneType' and 'int'
```
Looks like something that should be an
int
isNone
instead? But it's a pretty show-stopping bug, because it prevents me from converting an image layer to a label layer.edit: here's the contents of my conda environment, in case that's of use:
conda list
```bash # Name Version Build Channel aiobotocore 2.5.0 pypi_0 pypi aiohttp 3.8.4 pypi_0 pypi aioitertools 0.11.0 pypi_0 pypi aiosignal 1.3.1 pypi_0 pypi alabaster 0.7.13 pyhd8ed1ab_0 conda-forge aom 3.5.0 h7ea286d_0 conda-forge app-model 0.1.4 pyhd8ed1ab_0 conda-forge appdirs 1.4.4 pyh9f0ad1d_0 conda-forge appnope 0.1.3 pyhd8ed1ab_0 conda-forge asciitree 0.3.3 py_2 conda-forge asttokens 2.2.1 pyhd8ed1ab_0 conda-forge async-timeout 4.0.2 pypi_0 pypi attrs 23.1.0 pyh71513ae_1 conda-forge aws-c-auth 0.6.28 h826ccd7_5 conda-forge aws-c-cal 0.5.27 h92f41cd_0 conda-forge aws-c-common 0.8.20 hb547adb_0 conda-forge aws-c-compression 0.2.17 h28992cd_0 conda-forge aws-c-event-stream 0.3.0 h7f691c3_6 conda-forge aws-c-http 0.7.8 he2e4218_4 conda-forge aws-c-io 0.13.26 h379bc4c_0 conda-forge aws-c-mqtt 0.8.13 hdb3a981_2 conda-forge aws-c-s3 0.3.4 h02343f9_5 conda-forge aws-c-sdkutils 0.1.10 h28992cd_0 conda-forge aws-checksums 0.1.16 h28992cd_0 conda-forge aws-crt-cpp 0.20.2 h37dd33e_9 conda-forge aws-sdk-cpp 1.10.57 h9b90b14_14 conda-forge babel 2.12.1 pyhd8ed1ab_1 conda-forge backcall 0.2.0 pyh9f0ad1d_0 conda-forge backports 1.0 pyhd8ed1ab_3 conda-forge backports.functools_lru_cache 1.6.4 pyhd8ed1ab_0 conda-forge blosc 1.21.4 hc338f07_0 conda-forge bokeh 3.1.1 pyhd8ed1ab_0 conda-forge botocore 1.29.76 pypi_0 pypi brotli 1.0.9 h1a8c8d9_8 conda-forge brotli-bin 1.0.9 h1a8c8d9_8 conda-forge brotlipy 0.7.0 py39h02fc5c5_1005 conda-forge brunsli 0.1 h9f76cd9_0 conda-forge bzip2 1.0.8 h3422bc3_4 conda-forge c-ares 1.19.1 hb547adb_0 conda-forge c-blosc2 2.9.2 h068da5f_0 conda-forge ca-certificates 2023.5.7 hf0a4a13_0 conda-forge cachey 0.2.1 pyh9f0ad1d_0 conda-forge certifi 2023.5.7 pyhd8ed1ab_0 conda-forge cffi 1.15.1 py39h7e6b969_3 conda-forge cfitsio 4.2.0 h2f961c4_0 conda-forge charls 2.4.2 h13dd4ca_0 conda-forge charset-normalizer 3.1.0 pyhd8ed1ab_0 conda-forge click 8.1.3 unix_pyhd8ed1ab_2 conda-forge cloudpickle 2.2.1 pyhd8ed1ab_0 conda-forge colorama 0.4.6 pyhd8ed1ab_0 conda-forge comm 0.1.3 pyhd8ed1ab_0 conda-forge contourpy 1.1.0 py39hbd775c9_0 conda-forge cryptography 41.0.1 py39had97604_0 conda-forge cytoolz 0.12.0 py39h02fc5c5_1 conda-forge dask 2023.6.0 pyhd8ed1ab_0 conda-forge dask-core 2023.6.0 pyhd8ed1ab_0 conda-forge dav1d 1.2.1 hb547adb_0 conda-forge debugpy 1.6.7 py39h23fbdae_0 conda-forge decorator 5.1.1 pyhd8ed1ab_0 conda-forge distributed 2023.6.0 pyhd8ed1ab_0 conda-forge docstring_parser 0.15 pyhd8ed1ab_0 conda-forge docutils 0.20.1 py39h2804cbe_0 conda-forge entrypoints 0.4 pyhd8ed1ab_0 conda-forge executing 1.2.0 pyhd8ed1ab_0 conda-forge expat 2.5.0 hb7217d7_1 conda-forge fasteners 0.17.3 pyhd8ed1ab_0 conda-forge font-ttf-dejavu-sans-mono 2.37 hab24e00_0 conda-forge font-ttf-inconsolata 3.000 h77eed37_0 conda-forge font-ttf-source-code-pro 2.038 h77eed37_0 conda-forge font-ttf-ubuntu 0.83 hab24e00_0 conda-forge fontconfig 2.14.2 h82840c6_0 conda-forge fonts-conda-ecosystem 1 0 conda-forge fonts-conda-forge 1 0 conda-forge freetype 2.12.1 hd633e50_1 conda-forge freetype-py 2.4.0 pyhd8ed1ab_0 conda-forge frozenlist 1.3.3 pypi_0 pypi fsspec 2023.6.0 pyh1a96a4e_0 conda-forge gettext 0.21.1 h0186832_0 conda-forge gflags 2.2.2 hc88da5d_1004 conda-forge giflib 5.2.1 h1a8c8d9_3 conda-forge glib 2.76.3 ha614eb4_0 conda-forge glib-tools 2.76.3 ha614eb4_0 conda-forge glog 0.6.0 h6da1cb0_0 conda-forge gst-plugins-base 1.22.3 h27255cc_1 conda-forge gstreamer 1.22.3 he42f4ea_1 conda-forge heapdict 1.0.1 py_0 conda-forge hsluv 5.0.2 pyh44b312d_0 conda-forge icu 70.1 h6b3803e_0 conda-forge idna 3.4 pyhd8ed1ab_0 conda-forge imagecodecs 2023.1.23 py39h43d391a_0 conda-forge imageio 2.31.1 pyh24c5eb1_0 conda-forge imagesize 1.4.1 pyhd8ed1ab_0 conda-forge importlib-metadata 6.7.0 pyha770c72_0 conda-forge importlib_metadata 6.7.0 hd8ed1ab_0 conda-forge importlib_resources 5.12.0 pyhd8ed1ab_0 conda-forge in-n-out 0.1.7 pyhd8ed1ab_0 conda-forge ipykernel 6.23.2 pyh5fb750a_0 conda-forge ipython 8.14.0 pyhd1c38e8_0 conda-forge ipython_genutils 0.2.0 py_1 conda-forge jedi 0.18.2 pyhd8ed1ab_0 conda-forge jinja2 3.1.2 pyhd8ed1ab_1 conda-forge jmespath 1.0.1 pypi_0 pypi jpeg 9e h1a8c8d9_3 conda-forge jsonschema 4.17.3 pyhd8ed1ab_0 conda-forge jupyter_client 8.2.0 pyhd8ed1ab_0 conda-forge jupyter_core 5.3.1 py39h2804cbe_0 conda-forge jxrlib 1.1 h27ca646_2 conda-forge kiwisolver 1.4.4 py39haaf3ac1_1 conda-forge krb5 1.20.1 h69eda48_0 conda-forge lazy_loader 0.2 pyhd8ed1ab_0 conda-forge lcms2 2.15 h481adae_0 conda-forge lerc 4.0.0 h9a09cb3_0 conda-forge libabseil 20230125.2 cxx17_h13dd4ca_2 conda-forge libaec 1.0.6 hb7217d7_1 conda-forge libarrow 12.0.0 hbfb5349_8_cpu conda-forge libavif 0.11.1 h9f83d30_2 conda-forge libblas 3.9.0 17_osxarm64_openblas conda-forge libbrotlicommon 1.0.9 h1a8c8d9_8 conda-forge libbrotlidec 1.0.9 h1a8c8d9_8 conda-forge libbrotlienc 1.0.9 h1a8c8d9_8 conda-forge libcblas 3.9.0 17_osxarm64_openblas conda-forge libclang 14.0.6 default_h5dc8d65_1 conda-forge libclang13 14.0.6 default_hc7183e1_1 conda-forge libcrc32c 1.1.2 hbdafb3b_0 conda-forge libcurl 8.1.2 h912dcd9_0 conda-forge libcxx 16.0.6 h4653b0c_0 conda-forge libdeflate 1.17 h1a8c8d9_0 conda-forge libedit 3.1.20191231 hc8eb9b7_2 conda-forge libev 4.33 h642e427_1 conda-forge libevent 2.1.12 h2757513_1 conda-forge libexpat 2.5.0 hb7217d7_1 conda-forge libffi 3.4.2 h3422bc3_5 conda-forge libgfortran 5.0.0 12_2_0_hd922786_31 conda-forge libgfortran5 12.2.0 h0eea778_31 conda-forge libglib 2.76.3 h24e9cb9_0 conda-forge libgoogle-cloud 2.11.0 h5263b79_1 conda-forge libgrpc 1.55.1 hc384137_1 conda-forge libiconv 1.17 he4db4b2_0 conda-forge liblapack 3.9.0 17_osxarm64_openblas conda-forge libllvm14 14.0.6 hd1a9a77_3 conda-forge libnghttp2 1.52.0 hae82a92_0 conda-forge libogg 1.3.4 h27ca646_1 conda-forge libopenblas 0.3.23 openmp_hc731615_0 conda-forge libopus 1.3.1 h27ca646_1 conda-forge libpng 1.6.39 h76d750c_0 conda-forge libpq 15.3 h7126958_1 conda-forge libprotobuf 4.23.2 hf32f9b9_5 conda-forge libsodium 1.0.18 h27ca646_1 conda-forge libsqlite 3.42.0 hb31c410_0 conda-forge libssh2 1.11.0 h7a5bd25_0 conda-forge libthrift 0.18.1 ha061701_2 conda-forge libtiff 4.5.0 h5dffbdd_2 conda-forge libutf8proc 2.8.0 h1a8c8d9_0 conda-forge libvorbis 1.3.7 h9f76cd9_0 conda-forge libwebp-base 1.3.0 h1a8c8d9_0 conda-forge libxcb 1.13 h9b22ae9_1004 conda-forge libzlib 1.2.13 h53f4e23_5 conda-forge libzopfli 1.0.3 h9f76cd9_0 conda-forge llvm-openmp 16.0.6 h1c12783_0 conda-forge locket 1.0.0 pyhd8ed1ab_0 conda-forge lz4 4.3.2 py39hb35ce34_0 conda-forge lz4-c 1.9.4 hb7217d7_0 conda-forge magicgui 0.7.2 pyhd8ed1ab_0 conda-forge markdown-it-py 3.0.0 pyhd8ed1ab_0 conda-forge markupsafe 2.1.3 py39h0f82c59_0 conda-forge matplotlib-inline 0.1.6 pyhd8ed1ab_0 conda-forge mdurl 0.1.0 pyhd8ed1ab_0 conda-forge msgpack-python 1.0.5 py39haaf3ac1_0 conda-forge multidict 6.0.4 pypi_0 pypi mypy_extensions 1.0.0 pyha770c72_0 conda-forge mysql-common 8.0.33 h7b5afe1_0 conda-forge mysql-libs 8.0.33 hb292caa_0 conda-forge napari 0.4.16 pyh275ddea_0_pyqt conda-forge napari-console 0.0.8 pyhd8ed1ab_0 conda-forge napari-ome-zarr 0.5.2 pypi_0 pypi napari-plugin-engine 0.2.0 pyhd8ed1ab_2 conda-forge napari-svg 0.1.7 pyhd8ed1ab_0 conda-forge ncurses 6.4 h7ea286d_0 conda-forge nest-asyncio 1.5.6 pyhd8ed1ab_0 conda-forge networkx 3.1 pyhd8ed1ab_0 conda-forge npe2 0.7.0 pyhd8ed1ab_0 conda-forge nspr 4.35 hb7217d7_0 conda-forge nss 3.89 h789eff7_0 conda-forge numcodecs 0.11.0 py39h23fbdae_1 conda-forge numpy 1.24.3 pypi_0 pypi numpydoc 1.5.0 pyhd8ed1ab_0 conda-forge ome-zarr 0.7.1 pypi_0 pypi openjpeg 2.5.0 hbc2ba62_2 conda-forge openssl 3.1.1 h53f4e23_1 conda-forge orc 1.8.4 h13b7ede_0 conda-forge packaging 23.1 pyhd8ed1ab_0 conda-forge pandas 2.0.2 py39h6b13a34_0 conda-forge parso 0.8.3 pyhd8ed1ab_0 conda-forge partd 1.4.0 pyhd8ed1ab_0 conda-forge pcre2 10.40 hb34f9b4_0 conda-forge pexpect 4.8.0 pyh1a96a4e_2 conda-forge pickleshare 0.7.5 py_1003 conda-forge pillow 9.4.0 py39h8bd98a6_1 conda-forge pint 0.22 pyhd8ed1ab_1 conda-forge pip 23.1.2 pyhd8ed1ab_0 conda-forge pkgutil-resolve-name 1.3.10 pyhd8ed1ab_0 conda-forge platformdirs 3.6.0 pyhd8ed1ab_0 conda-forge ply 3.11 py_1 conda-forge pooch 1.7.0 pyha770c72_3 conda-forge prompt-toolkit 3.0.38 pyha770c72_0 conda-forge prompt_toolkit 3.0.38 hd8ed1ab_0 conda-forge psutil 5.9.5 py39h02fc5c5_0 conda-forge psygnal 0.9.0 pyhd8ed1ab_0 conda-forge pthread-stubs 0.4 h27ca646_1001 conda-forge ptyprocess 0.7.0 pyhd3deb0d_0 conda-forge pure_eval 0.2.2 pyhd8ed1ab_0 conda-forge pyarrow 12.0.0 py39hf40061a_8_cpu conda-forge pycparser 2.21 pyhd8ed1ab_0 conda-forge pydantic 1.10.9 py39h0f82c59_0 conda-forge pygments 2.15.1 pyhd8ed1ab_0 conda-forge pyopengl 3.1.6 pyhd8ed1ab_1 conda-forge pyopenssl 23.2.0 pyhd8ed1ab_1 conda-forge pyproject_hooks 1.0.0 pyhd8ed1ab_0 conda-forge pyqt 5.15.7 py39h7fba1b6_3 conda-forge pyqt5-sip 12.11.0 py39h23fbdae_3 conda-forge pyrsistent 0.19.3 py39h02fc5c5_0 conda-forge pysocks 1.7.1 pyha2e5f31_6 conda-forge python 3.9.16 hea58f1e_0_cpython conda-forge python-build 0.10.0 pyhd8ed1ab_1 conda-forge python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge python-tzdata 2023.3 pyhd8ed1ab_0 conda-forge python_abi 3.9 3_cp39 conda-forge pytomlpp 1.0.13 py39haaf3ac1_0 conda-forge pytz 2023.3 pyhd8ed1ab_0 conda-forge pywavelets 1.4.1 py39h4d8bf0d_0 conda-forge pyyaml 6.0 py39h02fc5c5_5 conda-forge pyzmq 25.1.0 py39h1e134f0_0 conda-forge qt-main 5.15.8 hfe8d25c_6 conda-forge qtconsole-base 5.4.3 pyha770c72_0 conda-forge qtpy 2.3.1 pyhd8ed1ab_0 conda-forge re2 2023.03.02 hc5e2d97_0 conda-forge readline 8.2 h92ec313_1 conda-forge requests 2.31.0 pyhd8ed1ab_0 conda-forge rich 13.4.2 pyhd8ed1ab_0 conda-forge s3fs 2023.6.0 pypi_0 pypi scikit-image 0.20.0 py39hd28f0be_1 conda-forge scipy 1.9.1 py39h737da60_0 conda-forge setuptools 68.0.0 pyhd8ed1ab_0 conda-forge shellingham 1.5.1 pyhd8ed1ab_0 conda-forge sip 6.7.9 py39hb198ff7_0 conda-forge six 1.16.0 pyh6c4a22f_0 conda-forge snappy 1.1.10 h17c5cce_0 conda-forge snowballstemmer 2.2.0 pyhd8ed1ab_0 conda-forge sortedcontainers 2.4.0 pyhd8ed1ab_0 conda-forge sphinx 7.0.1 pyhd8ed1ab_0 conda-forge sphinxcontrib-applehelp 1.0.4 pyhd8ed1ab_0 conda-forge sphinxcontrib-devhelp 1.0.2 py_0 conda-forge sphinxcontrib-htmlhelp 2.0.1 pyhd8ed1ab_0 conda-forge sphinxcontrib-jsmath 1.0.1 py_0 conda-forge sphinxcontrib-qthelp 1.0.3 py_0 conda-forge sphinxcontrib-serializinghtml 1.1.5 pyhd8ed1ab_2 conda-forge stack_data 0.6.2 pyhd8ed1ab_0 conda-forge superqt 0.4.1 pyhd8ed1ab_0 conda-forge tblib 1.7.0 pyhd8ed1ab_0 conda-forge tifffile 2023.4.12 pyhd8ed1ab_0 conda-forge tk 8.6.12 he1e0b03_0 conda-forge toml 0.10.2 pyhd8ed1ab_0 conda-forge tomli 2.0.1 pyhd8ed1ab_0 conda-forge toolz 0.12.0 pyhd8ed1ab_0 conda-forge tornado 6.3.2 py39h0f82c59_0 conda-forge tqdm 4.65.0 pyhd8ed1ab_1 conda-forge traitlets 5.9.0 pyhd8ed1ab_0 conda-forge typer 0.9.0 pyhd8ed1ab_0 conda-forge typing-extensions 4.6.3 hd8ed1ab_0 conda-forge typing_extensions 4.6.3 pyha770c72_0 conda-forge tzdata 2023c h71feb2d_0 conda-forge urllib3 1.26.16 pypi_0 pypi vispy 0.10.0 py39h6eccaaf_0 conda-forge wcwidth 0.2.6 pyhd8ed1ab_0 conda-forge wheel 0.40.0 pyhd8ed1ab_0 conda-forge wrapt 1.15.0 py39h02fc5c5_0 conda-forge xorg-libxau 1.0.11 hb547adb_0 conda-forge xorg-libxdmcp 1.1.3 h27ca646_0 conda-forge xyzservices 2023.5.0 pyhd8ed1ab_1 conda-forge xz 5.2.6 h57fd34a_0 conda-forge yaml 0.2.5 h3422bc3_2 conda-forge yarl 1.9.2 pypi_0 pypi zarr 2.15.0 pyhd8ed1ab_0 conda-forge zeromq 4.3.4 hbdafb3b_1 conda-forge zfp 1.0.0 hb6e4faa_3 conda-forge zict 3.0.0 pyhd8ed1ab_0 conda-forge zipp 3.15.0 pyhd8ed1ab_0 conda-forge zlib-ng 2.0.7 h1a8c8d9_0 conda-forge zstd 1.5.2 hf913c23_6 conda-forge ```