In installed standalone jython on my ubuntu 12.04, run it, but if I try to import gtk, I get no module named gtk when in python console it works.
Update:
I have done
>> sys.path.insert(1,"/usr/lib/python2.7/dist-packages/gtk-2.0")
and
>> sys.path.insert(1,'/usr/lib/python2.7/dist-packages")
and now is is
from glib._glib import *
ImportError: No module named _glib
when:
argon@vprime:/usr/lib/python2.7$ find | grep _glib
./dist-packages/gi/_glib
./dist-packages/gi/_glib/option.pyc
./dist-packages/gi/_glib/option.py
./dist-packages/gi/_glib/_glib.so
./dist-packages/gi/_glib/__init__.pyc
./dist-packages/gi/_glib/__init__.py
./dist-packages/glib/_glib.so
./dist-packages/twisted/internet/test/test_glibbase.pyc
./dist-packages/twisted/internet/test/test_glibbase.py
./dist-packages/twisted/internet/_glibbase.py
./dist-packages/twisted/internet/_glibbase.pyc
./dist-packages/_dbus_glib_bindings.so
so, glib/_glib is under dist-packages and I have no idea what is wrong…
Not all modules are compatible between Jython and CPython (the standard Python interpreter). In particular, modules that are compiled to native bytecode, generally written in C/++ (or with Cython), cannot be loaded in Java, because it uses its own Virtual Machine (JVM) which cannot understand native bytecode.
Many native/binary modules in CPython will have a name prefixed with an underscore, like _glib above.
You have at least two options: