Archived

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

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

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

  • dwayne
    dwayne St. John's, Newfoundland
    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