0

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.

Wojtek
  • 2,514
  • 5
  • 26
  • 31

1 Answers1

4

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)'
Ewan
  • 14,592
  • 6
  • 48
  • 62
  • Uhm, apparently not, it yields ['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PIL', '/usr/lib/python2.7/dist-packages/gst-0.10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client'] – Wojtek May 06 '13 at 14:18
  • @Wojtek - would you do the following for me please; `python -c "import sys; sys.path.append('/usr/lib/pyshared/python2.7/'); import IcePy"` and see if it gives you any import errors. – Ewan May 06 '13 at 14:20
  • I see what you did there :) No error, it seems like this will be the solution. I'll test it with PYTHON_PATH when I finish my dinner and let you know in the next comment about the results. – Wojtek May 06 '13 at 14:24
  • Ok, it works. I can't really tell you why I haven't tried it in the first place. Perhaps importing .so file daunted me a bit. I've always imported .py only. Thank you for your help kisamoto! – Wojtek May 06 '13 at 14:52