Get_property_assignments is missing some fields

Hi there!

Yesterday, I had some code which was properly returning all attributes of properties in an entity type. Today, I saw that the permId, label, and description are missing.

I am using 1.37.0 pyBIS and this snippet code:

openbis = Openbis(environ("OPENBIS_URL"))
openbis.login(environ("OPENBIS_USERNAME"), environ("OPENBIS_PASSWORD"), save_token=True)


for object_type in openbis.get_object_types():
     assignments = object_type .get_property_assignments()
     if not assignments:
           continue
     for prop in assignments:
          print(prop.permId, prop.label, prop.description, prop.code, prop.dataType)

I am getting crazy trying to find some error in my code, and nothing has changed from PyBIS, so my guess is that something has changed in my openBIS instance, but any help/guidance would be very much appreciated. Furthermore, can someone reproduce this behavior in their own instances?

Update: I checked with a colleague and the problem is with the 1.37.0 version (with 1.36.3 the code snippet below works fine and properly returns the attributes of the properties). However, 1.36.3 has an issue when using new_object_type() as this function does not pass the description.

Thanks in advance!

In this new version, the only difference is that we cannot access directly the attributes of the property type. For doing so, first we need to call prop.get_property_type(), and from there we can access all the attributes.

So the new code should be something like this:

openbis = Openbis(environ(“OPENBIS_URL”))
openbis.login(environ(“OPENBIS_USERNAME”), environ(“OPENBIS_PASSWORD”), save_token=True)

for object_type in openbis.get_object_types():
     assignments = object_type .get_property_assignments()
     if not assignments:
           continue
     for prop in assignments:
          prop = prop.get_property_type()
          print(prop.permId, prop.label, prop.description, prop.code, prop.dataType)

And like that you should get all the needed attributes.

Best,
Carlos M.

1 Like