[ome-devel] Python bindings when creating new service

Josh Moore josh at glencoesoftware.com
Sun May 13 20:42:08 BST 2012


On May 11, 2012, at 5:58 PM, Donald MacDonald wrote:

> Hi Josh,
> 
> I cannot seem to call IceImport or import it, I know that you used to use it in omero/grid/_init_.py etc, 
> but I cannot find a reference to it anywhere. 
> 
> How should I use it, I am using Ice3.3.1 on Beta 4.3.3

Hi Donald,

my apologies. I was thinking of the current development line (4.4) which supports Ice 3.3 and 3.4. In OMERO 4.3, you'll just need to make sure you import the file directly:

  import module_HPCService_ice

Do note, though, that when updating to OMERO 4.4 you might experience very odd Python import issues if you don't move to using IceImport.

Cheers,
~Josh.

> Regards
> 
> D.
> 
> The files are being generated correctly I think:
> 
> 
> donald at ubuntu:~/openmicroscopy/dist/lib/python$ grep IHPCServicePrx *.py
> omero_API_ice.py:    ServiceFactory._op_createHPCService = IcePy.Operation('createHPCService', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, (), (), (), _M_omero.api._t_IHPCServicePrx, (_M_omero._t_ServerError,))
> omero_api_IHPCService_ice.py:    _M_omero.api.IHPCServicePrx = Ice.createTempClass()
> omero_api_IHPCService_ice.py:    class IHPCServicePrx(_M_omero.api.StatefulServiceInterfacePrx):
> omero_api_IHPCService_ice.py:            return _M_omero.api.IHPCServicePrx.ice_checkedCast(proxy, '::omero::api::IHPCService', facetOrCtx, _ctx)
> omero_api_IHPCService_ice.py:            return _M_omero.api.IHPCServicePrx.ice_uncheckedCast(proxy, facet)
> omero_api_IHPCService_ice.py:    _M_omero.api._t_IHPCServicePrx = IcePy.defineProxy('::omero::api::IHPCService', IHPCServicePrx)
> omero_api_IHPCService_ice.py:    _M_omero.api.IHPCServicePrx = IHPCServicePrx
> omero_api_IHPCService_ice.py:    del IHPCServicePrx
> omero_ServicesF_ice.py:    _M_omero.api._t_IHPCServicePrx = IcePy.declareProxy('::omero::api::IHPCService')
> 
> 
> 
> 
> On 11 May 2012, at 13:03, Josh Moore wrote:
> 
>> 
>> On May 11, 2012, at 1:23 PM, Donald MacDonald wrote:
>> 
>>> Hi,
>>> 
>>> I have created a new service in OMERO. I originally had the service as a pure blitz service, 
>>> but I have had to push it down into the lower EJB services as I need the PixelService to have 
>>> access to it.
>>> 
>>> I can access the service from Java, but when I try and call the service from Python I get the 
>>> following error:
>>> 
>>>>>> import omero.clients
>>>>>> a = omero.client('localhost')
>>>>>> b = a.createSession('root','ome')
>>>>>> c = b.createHPCService()
>>> Traceback (most recent call last):
>>> File "<stdin>", line 1, in <module>
>>> File "/home/donald/openmicroscopy/dist/lib/python/omero_API_ice.py", line 283, in createHPCService
>>>  return _M_omero.api.ServiceFactory._op_createHPCService.invoke(self, ((), _ctx))
>>> RuntimeError: class ::omero::api::IHPCServicePrx is declared but not defined
>>>>>> 
>>> 
>>> 
>>> Any ideas as to what I have missed?
>> 
>> Hi Donald,
>> 
>> might you need to import the slice generated file?
>> 
>> import IceImport
>> IceImport.load("module_HPCService_ice") # Or whatever name
>> 
>>> Regards
>>> D.
>> 
>> Cheers,
>> ~J.
> 



More information about the ome-devel mailing list