Archived

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

Probleme with the demo\IceGrid for python

Hi,

I have several problemes:
* I don't have IceGrid.py, but I don't need if I import ice.py. I don't understand.
* I don't try to connect with the next instruction (except error), but If I use the sample example in C++, I don't have any problem, I see to the IceGrid Admin my connection.
registry = ceGrid.RegistryPrx.checkedCast(communicator.stringToProxy("DemoIceGrid/Registry"))

thanks,

Comments

  • matthew
    matthew NL, Canada
    I'm sorry, but I don't understand what problems you are having...
    Hi,

    I have several problemes:
    * I don't have IceGrid.py, but I don't need if I import ice.py. I don't understand.

    What do you mean you dont have IceGrid.py? It should be part of the Ice 3.3 distribution. As to the second part of your question, you only need IceGrid.py if you are using the IceGrid definitions (for example, IceGrid.Query). Are you using that?
    * I don't try to connect with the next instruction (except error), but If I use the sample example in C++, I don't have any problem, I see to the IceGrid Admin my connection.
    registry = ceGrid.RegistryPrx.checkedCast(communicator.string ToProxy("DemoIceGrid/Registry"))

    thanks,

    What exactly are you trying to do? Without more information it is hard to guess... Sample code would be good.
  • I want to use Icegrid to run my server with my client application.
    I use :
    icegridnode --Ice.Config=config.grid
    icegridadmin --Ice.Config=config.grid -e "application add 'application.xml'"


    For my problems

    I have ICE 3.3.0 and I don't have Icegrid.py, but I have the follow files:
    IceGrid_Query_ice.py
    IceGrid_Registry_ice.py
    IceGrid_Session_ice.py
    ....

    When I run the sample demo\IceGrid\simple\client.py I have a error, icegrid.py not found.

    #!/usr/bin/env python
    # **********************************************************************
    #
    # Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved.
    #
    # This copy of Ice is licensed to you under the terms described in the
    # ICE_LICENSE file included in this distribution.
    #
    # **********************************************************************

    import sys, traceback, Ice, IceGrid

    Ice.loadSlice('Hello.ice')
    import Demo


    def menu():
    print """
    usage:
    t: send greeting as twoway
    s: shutdown server
    x: exit
    ?: help
    """

    class Client(Ice.Application):
    def run(self, args):
    if len(args) > 1:
    print self.appName() + ": too many arguments"
    return 1

    hello = None
    try:
    hello = Demo.HelloPrx.checkedCast(self.communicator().stringToProxy("hello"))
    except Ice.NotRegisteredException:
    query = IceGrid.QueryPrx.checkedCast(self.communicator().stringToProxy("DemoIceGrid/Query"))
    hello = Demo.HelloPrx.checkedCast(query.findObjectByType("::Demo::Hello"))
    .........





    In a second time, I try other test with a other script
    import sys, traceback, Ice

    try:
    print "SYSTEAM/Registry"
    re=self.communicator().stringToProxy("DemoIceGrid/Registry")
    registry = IceGrid.RegistryPrx.checkedCast(re)

    session = registry.createAdminSession("user", "passord")
    admin = session.getAdmin()

    print admin.getAllServerIds()

    session.destroy()
    communicator.destroy()
    except:
    print "Error"
    erreur=True

    I don't import IceGrid.py and I don't have any error with
    registry = IceGrid.RegistryPrx.checkedCast(re)
    but the function go to the except section. If a run the sample code with C++ I dont have any error.

    I hope my new Explanation is better

    Thanks
  • matthew
    matthew NL, Canada
    Gilles wrote: »
    I want to use Icegrid to run my server with my client application.
    I use :
    icegridnode --Ice.Config=config.grid
    icegridadmin --Ice.Config=config.grid -e "application add 'application.xml'"


    For my problems

    I have ICE 3.3.0 and I don't have Icegrid.py, but I have the follow files:
    IceGrid_Query_ice.py
    IceGrid_Registry_ice.py
    IceGrid_Session_ice.py
    ....

    IceGrid is a package, not a .py file. It sounds to me like your PYTHONPATH is not setup correctly. In order for this demo to work you must be able to do something like this:
    $ python
    >>> import Ice
    >>> import IceGrid
    

    If you cannot do that without error, then your system is configured incorrectly.
    ...
    I don't import IceGrid.py and I don't have any error with
    registry = IceGrid.RegistryPrx.checkedCast(re)
    but the function go to the except section. If a run the sample code with C++ I dont have any error.

    I hope my new Explanation is better

    Thanks

    I suggest you configure your system correctly, and if you are still having problems please report back. You also need to tell us more information, as as the versions of Ice, Python and the operating system you are using, and the exact error messages or exceptions you are encountering.
  • Thanks for your informations, I resolve my problem.

    Gilles