I'm trying to use Ice (version 3.4.2) in Python (2.7.3). When I generate content using slice2py I get a class with the following import statement

import Ice, IcePy, __builtin__

The problem is, IcePy cannot be resolved. I checked the package python-zeroc-ice version 3.4.2-8.1ubuntu1 and it installs among others:

/usr/share/pyshared/Ice.py
/usr/lib/pyshared/python2.7/IcePy.so
/usr/lib/pyshared/python2.7/IcePy.so.3.4.2

There is no IcePy.py anywhere. Do you know, where can I find one? Or is it possible to use the shared library IcePy.so in Python in any reasonable way? Simply put, to make this import IcePy resolvable?

I know, that there is another way of working with Ice and Python, namely

import Ice
Ice.loadSlice("slice/MyInterface.ice")
import MyInterface

But this way the Ice interface is interpreted during runtime and I can't use IDE's syntax tips or anything. It's really a pain and I would like to avoid doing it this way.

有帮助吗?

解决方案

I don't have enough rep to comment yet so please excuse the answer.

IcePy.so should still be importable. Is /usr/lib/pyshared/python2.7/ in your python path?

What is the output of the following?

python -c 'import sys; print(sys.path)'
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top