Home Help Center

Error using Ice.loadSlice() with nested *.ice

hiaslhiasl Member Matthias WeberOrganization: University of Erlangen-NurembergProject: This baby is still nameless
Hi,

it is impossible to use Ice.loadSlice() with python for loading nested slices without using slice2py before, e.g:

a.ice:
#ifndef A_ICE
#define A_ICE

module A {
...
}

b.ice:
#ifndef B_ICE
#define B_ICE

#include "a.ice"
module B {
...
}

test.py:
import Ice
# Ice.loadSlice('a.ice')
# import stuff from a
Ice.loadSlice('b.ice')
import stuff from b

Calling python results in an error message like
Traceback (most recent call last):
File "test.py", line 4, in ?
Ice.loadSlice('b.ice')
File "b.ice", line 3, in ?

ImportError: No module named a_ice

Am i right that loadSlice() doesn't compile slices recursively?

Bye
Matthias

Comments

  • dwaynedwayne St. John's, NewfoundlandMember Dwayne BooneOrganization: ZeroC, Inc.Project: Internet Communications Engine
    If you want loadSlice to recursively compile all the slice files included by the given slice file then you have to use the --all option. For example...

    Ice.loadSlice("--all b.ice")

    Regards,
    Dwayne
Sign In or Register to comment.