Archived

This forum has been archived. Please start a new discussion on GitHub.

IcePy: sequence<long> issues migrating to Python 3

Under Python 3, the long basic type listed under the basic type mappings no longer exists. API methods which take a sequence<long> are now failing with:

self = ..., colNumbers = [0, 1, 2, 3, 4, 5], start = 0, stop = 1, _ctx = None

    def read(self, colNumbers, start, stop, _ctx=None):


E Ice.UnknownException: exception ::Ice::UnknownException E { E unknown = builtins.ValueError: invalid value for element 0 of sequence<string> E }

where the definition of read is:

            idempotent
            Data
                readCoordinates(omero::api::LongArray rowNumbers)
                throws omero::ServerError;

and of LongArray is simply:

        sequence<long> LongArray;

Turning those values into strings prints the expected exception of:

E       ValueError: invalid value for element 0 of sequence<long>

which for me suggests a case statement which is falling through to the string default.

I imagine Ice.Long would be one solution as with JavaScript. Additionally or alternatively, would it be possible for the conversion to be similarly flexible for longs as with floats? (cf. https://forums.zeroc.com/discussion/4450/icepy-accept-integers-where-floats-are-expected) Or even better, does a workaround exist? e.g. is there a way to use the TypeInfo definitions to generate a sequence that will be appropriately detected?

Thanks in advance,
~Josh

Comments