Home Help Center

Problems with IceGrid Client developed in wxpython

ShilongShilong Member Shilong ZhangOrganization: Beihang universityProject: my graduation projects handling data via IceGrid
Hi,
I want to develop an IceGrid client with wxpython. And I modified some code in the demopy/simple. Here is the function to init Ice
def _InitIcePrx(self):
        self.helloPrx = None
        communicator = Ice.initialize()
        try:
            self.helloPrx = Demo.HelloPrx.checkedCast(communicator.\
                                                      stringToProxy("hello"))
        except Ice.NotRegisteredException:
            query = IceGrid.QueryPrx.checkedCast(communicator.\
                                                 stringToProxy("DemoIceGrid/Query"))
            self.helloPrx = Demo.HelloPrx.checkedCast(query.\
                                                      findObjectByType("::Demo::Hello"))
        if not self.helloPrx:
            wx.MessageBox(u"初始化IceGrid代理失败!")
I only changed the method to get communicator from Ice.Application to Ice.initialize() and all the other config files were the same as the demo's. However when I ran I got this error:
Ice.NoEndpointException: exception ::Ice::NoEndpointException
{
proxy = hello -t
}
Does this happened because I did not pass the "config.client" parameter to my application? And could someone please tell me how to include that config file in my wxpython application, since the structure of mine is different from the demo. All my code is in the attachment mainfrmcode.txt. Thank you very much!

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    You need to setup the Ice.Default.Locator property in your code if you don't want to rely on configuration files. Something like the following should do the job:
    initData = Ice.InitializationData()
    initData.properties = Ice.createProperties()
    initData.properties.setProperty('Ice.Default.Locator', 'DemoIceGrid/Locator:default -h localhost -p 4061')
    communicator = Ice.initialize(initData)
    ...
    

    If you're developing a GUI, the instance name, host and port information of the IceGrid registry will typically be provided by the user through a dialog.

    Cheers,
    Benoit.
  • ShilongShilong Member Shilong ZhangOrganization: Beihang universityProject: my graduation projects handling data via IceGrid
    Thanks to Benoit Foucher

    Thanks very much for your reply, Benoit Foucher. I have tried and it really worked!
    Sorry to bother you about my question, for I did not understand the procedure of coding IceGrid Applications very well.
Sign In or Register to comment.