You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this is a follow-up to PR #393, which introduced a nice rendering for ImageWrapper objects in Jupyter notebooks (for instance). I just ran into an issue which I think is caused by this new feature.
The repr_html method is introduced for the BlitzObjectWrapper class and the ImageWrapper class then derives from it. The problem is now: a MapAnnotationWrapper object also inherits the same overwritten _repr_html method from the BlitzObjectWrapper class, but it lacks quite a few attributes and hence throws an error upon just printing the object in a Jupyter notebook:
---------------------------------------------------------------------------AttributeErrorTraceback (mostrecentcalllast)
c:\Users\johamuel\AppData\Local\mambaforge\envs\stress\lib\site-packages\omero\gateway\__init__.pyin ?(self)
249""" 250 Returns an HTML representation of the object. This is used by the 251 IPython notebook to display the object in a cell. 252 """-->253returnimage_to_html(self)
c:\Users\johamuel\AppData\Local\mambaforge\envs\stress\lib\site-packages\omero\gateway\utils.pyin ?(image)
267<table>268<tr><th></th><th>ID</th><th>Name</th></tr>269 {obj_html(image, 'Image')}
270 {obj_html(image.getParent(), 'Dataset')}
-->271 {obj_html(image.getProject(), 'Project')}
272</table>273 """
274
c:\Users\johamuel\AppData\Local\mambaforge\envs\stress\lib\site-packages\omero\gateway\__init__.py in ?(self, attr)
1307 rv = rv.decode('utf8')
1308 except:
1309 pass
1310 return rv
-> 1311 raise AttributeError(
1312 "'%s' object has no attribute '%s'"
1313% (self._obj.__class__.__name__, attr))
AttributeError: 'MapAnnotationI'objecthasnoattribute'getProject'
The solution for this would be to simply move the repr_html to the dervied class. And potentially introduce a specific _repr_html for MapAnnotation objects down the road, but that'd be for a separate PR. I'll try to send a PR today.
The text was updated successfully, but these errors were encountered:
Hi OME-Team,
this is a follow-up to PR #393, which introduced a nice rendering for
ImageWrapper
objects in Jupyter notebooks (for instance). I just ran into an issue which I think is caused by this new feature.The
repr_html
method is introduced for theBlitzObjectWrapper
class and theImageWrapper
class then derives from it. The problem is now: aMapAnnotationWrapper
object also inherits the same overwritten_repr_html
method from theBlitzObjectWrapper
class, but it lacks quite a few attributes and hence throws an error upon just printing the object in a Jupyter notebook:The solution for this would be to simply move the
repr_html
to the dervied class. And potentially introduce a specific_repr_html
forMapAnnotation
objects down the road, but that'd be for a separate PR. I'll try to send a PR today.The text was updated successfully, but these errors were encountered: