Failure To Import ICE Client Module

afcarlafcarl ✭✭Member Andy CarlOrganization: Northrop Grumman CorpProject: Distributed analysis of air vehicle subsystems ✭✭
I have a python application that I am attempting to incorporate ICE for the RPC transport functionality. But when I import my client, I get the following error:

"Slice processing failed for 'xxx.ice'."

Various attempts to work around this gives me the impression that ICE is configured for opeation only in the "main" thread. These issues might be unrelated, but essentially I need to have an ICE client operating concurrently with another python application on the same PC. Please advise.

Thanks,
Andy

Comments

  • mesmes ZeroC Staff CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi Andy,

    Ice for C++ (on which Ice for Python is based) does not require use of the main thread. Note however that destructors for static C++ objects are invoked when the main thread terminates, which is why we state that communicators need to be destroyed prior to the termination of the main thread.

    It would be easier for us to help if we could see a small, self-contained example that reproduces the issue you are experiencing. If you don't want to post it here, you can also send it to us by email. Please tell us your platform, compiler, and Ice version.

    Regards,
    Mark
  • afcarlafcarl ✭✭ Member Andy CarlOrganization: Northrop Grumman CorpProject: Distributed analysis of air vehicle subsystems ✭✭
    Mark,
    I wish I could. Matlab calls python, python snippit as follows:

    import Ice
    Ice.loadSlice('xxx.ice')
    ....

    ...at the point the python script is called results in this error:

    "Slice processing failed for 'xxx.ice'."

    ...end of parade.

    Regarding versions: Ice v3.3.1, python activestate v2.5.2.2. I have even hardcoded the entire path in the "loadSlice' statement to insure that the "xxx.ice" file is being found. Any suggestions or known limitations?

    Thanks,
    Andy
  • mesmes ZeroC Staff CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi,

    You didn't mention which platform you were using, but I'll assume it's some flavor of Windows since you are using ActiveState Python. Please correct me if I'm wrong.

    Note that the Ice for Python extensions that we include in the Ice 3.3.1 binary distributions for Windows are compiled against the Python libraries available from python.org. We don't test with ActiveState Python, so we can't guarantee compatibility. Having said that, I just downloaded ActiveState Python 2.5.5.7 and I was able to use it to run our Ice for Python test suite successfully. (The test suite also makes extensive use of the loadSlice function.)

    It's important that you use the correct Ice distribution for Windows; in this case, I used the Ice 3.3.1 distribution for Visual Studio 2005SP1. Which one are you using?

    Also, have you tried statically compiling your Slice files using slice2py instead of using loadSlice?

    Regards,
    Mark
  • afcarlafcarl ✭✭ Member Andy CarlOrganization: Northrop Grumman CorpProject: Distributed analysis of air vehicle subsystems ✭✭
    Hello!
    I'm using PC/XP Pro SP2, ICE 3.3.1 w/ VC90.msi, and no, but I will give it a try!
    Thanks,
    Andy
  • afcarlafcarl ✭✭ Member Andy CarlOrganization: Northrop Grumman CorpProject: Distributed analysis of air vehicle subsystems ✭✭
    Mark,
    Using Slice2py helped in one regard, but I am still getting the following error which leads me to believe that ICE is configured to only run in the main thread:

    Traceback...
    ...c:\Ice-3.3.1\python\Ice.py", line 744, in main
    Application._ctrlCHandler = CtrlCHandler()
    File "C:\Ice-3.3.1\python\Ice.py", line 600, in __init__
    signal.signal(signal.SIGBREAK, CtrlCHandler, signalHandler)
    ValueError: signal only works in main thread

    Can you provide some guidelines regarding how ICE may be implemented in a multithread python application?

    Thanks,
    Andy
  • mesmes ZeroC Staff CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi,

    It's not Ice that has the limitation, but Python's signal function (this is where the ValueError originates). Python does not let you configure signals unless you're in the main thread.

    The Ice.Application class assumes you are calling its main method from the main thread because it needs to configure signals. You shouldn't call main from other threads.

    Note that Ice.Application is simply a convenience class that you are not required to use.

    Regards,
    Mark
Sign In or Register to comment.