Bug when receiving Revit data in Python Speckle client

Hi @izzylys and @AlanRynne ,

I just encountered an issue when receiving Revit data from Speckle in Python using the specklepy client.
The issue first showed up with a stream of someone else, problem is that a None value is being assigned to the units attribute of a Parameter:
image

Although here I show a Parameter object, it seems that this units parameter is assigned in more objects. The None value will find its way towards the units.py file in the specklepy client, where a string.lower() conversion is attempted:
image

Logically, this will fail for a None value. As I did not see this issue before, I compared with older streams. These indeed didn’t contain None values for units. I could also verify this with my own Revit connector as I didnt yet update it. The previous connector (version 2.2.4) didn’t send the None value units, while after updating the connector, the None value units were included.

The issue might have been introduced with this hotfix of Alan:

Can it be fixed on either Revit or specklepy side? And if it will take some time, is it possible to ‘downgrade’ my Revit connector to the previous version locally?

Thanks!

hi Rob!

the null serialisation is new in specklepy 2.5, so id recommend downgrading back to any 2.4 version if this is urgent. downgrading connectors is not currently possible (but will be soon!)

this is def a bug to be filed in specklepy now tho to handle this (and possibly Revit)! thanks for reporting

null serialisation is a new thing with the latest version of py / sharp / the connectors, so there may be a few lil bugs to iron out. sorry about that!

cheers,
izzy

Hi Izzy,
Thanks for the quick reply.
I tried downgrading specklepy to the lowest possible version (2.0.0), which still gives the same issue.
Also checked the source code, all versions include the get_units_from_string() method, to which the None values are passed. Therefore they all result in the same error.

As we’ve included specklepy in our own package running on a server, we cannot easily bypass/fix it locally in some way, so it’s a bit of an issue for us. So a small fix would be much appreciated!

hey rob!

my bad, serialisation used to ignore nulls in / out pre 2.5, but the units stuff must be taking precedence.

I’m on holiday atm so can’t spend too much time on this, but have merged and published a quick hotfix for ya!

specklepy 2.5.1 will be available shortly :rocket:

1 Like

Works again, thanks for your help!

Enjoy the holiday :grin:

2 Likes