Skip to content

Conversation

@maartenpaul
Copy link

When transferring some data from OMERO using omero-cli-transfer with the --simple flag I got the following error:

....
  File "D:\OMERO\omero_transfer\.pixi\envs\default\Lib\site-packages\omero_cli_transfer.py", line 199, in _wrapper
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\OMERO\omero_transfer\.pixi\envs\default\Lib\site-packages\omero_cli_transfer.py", line 319, in pack
    self.__pack(args)
  File "D:\OMERO\omero_transfer\.pixi\envs\default\Lib\site-packages\omero_cli_transfer.py", line 570, in __pack
    self._fix_pixels_image_simple(ome, folder, md_fp)
  File "D:\OMERO\omero_transfer\.pixi\envs\default\Lib\site-packages\omero_cli_transfer.py", line 456, in _fix_pixels_image_simple
    if isinstance(ann.value, str) and\
                  ^^^^^^^^^
  File "D:\OMERO\omero_transfer\.pixi\envs\default\Lib\site-packages\ome_types\_mixins\_base_type.py", line 152, in __getattr__
    return super().__getattr__(key)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\OMERO\omero_transfer\.pixi\envs\default\Lib\site-packages\pydantic\main.py", line 1026, in __getattr__
    raise AttributeError(f'{type(self).__name__!r} object has no attribute {item!r}')
AttributeError: 'FileAnnotation' object has no attribute 'value'

It seems that the issue is that the function _fix_pixels_image_simple assumes all annotations have a value attribute but apparently not all annotation types do.
With this PR I added a check for the annotation type first. Please adjust if necessary.

@erickmartins
Copy link
Collaborator

thanks for the report and the fix! note to self for later: this might be worth implementing as a try-except checking for AttributeError

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants