diff --git a/armarx_memory/aron/conversion/pythonic_from_to_aron_ice.py b/armarx_memory/aron/conversion/pythonic_from_to_aron_ice.py index 9ff5fa7fd4a5e4b7df94ea9a7c652859fa495145..95deb2647cb04572a5b51e7b1daef1e2bd409ecc 100644 --- a/armarx_memory/aron/conversion/pythonic_from_to_aron_ice.py +++ b/armarx_memory/aron/conversion/pythonic_from_to_aron_ice.py @@ -28,10 +28,12 @@ def pythonic_to_aron_ice( return AronDataIceTypes.bool(value) elif isinstance(value, np.int64): return AronDataIceTypes.long(int(value)) - elif isinstance(value, int) or isinstance(value, np.int32): + elif isinstance(value, np.int32): + return AronIceTypes.int(int(value)) + elif isinstance(value, int): # because python is treating int and long the same, we need to differentiate between the two - assert(isinstance(value, int)), value if 'invalid value - expected int' in str(AronIceTypes.int(int(value))): + # try to convert it to AronInt -> if it fails this is a long assert 'invalid value - expected int' not in str(AronIceTypes.long(int(value))), \ f'Casting {value} to long failed. Did you intend to use np.int64 instead, ' \ 'but assigned a plain int value, or converted the value somewhere in the meantime?'