GNOME Bugzilla – Bug 644702
libglom_init(): PyDateTime_IMPORT fails when run from JNI (in JVM)
Last modified: 2013-10-31 11:18:52 UTC
OnlineGlom calls libglom_init(), which fails because it asks Python to import a standard module. Apparently the linker behaves differently under the JVM. Recent versions of Glom (1.16, 1.18, and 1.19) will now show this error from Python 2.6: void Glom::libglom_init(): PyDateTime_IMPORT (a python module import) failed. ImportError: /usr/lib/python2.6/lib-dynload/datetime.so: undefined symbol: _Py_ZeroStruct Here is a branch of OnlineGlom that is a simple JNI example of this problem, with no use of swig or libglom, which shows the same warning: http://gitorious.org/online-glom/java-libglom/trees/python_assert_investigation When using python2.7 instead (adjust the Makefile.am in that branch's Makefile.am) on Ubuntu Natty on my laptop, I see a python backtrace too, though I don't see that on my PC here. I'll paste that later.
I don't have the error with python3.1 (on Ubuntu Maverick), though that could just be a side-effect.
_Py_ZeroStruct should be found in the main libpython*.so shared library, and normally is found: nm -D /usr/lib/libpython2.6.so | grep "_Py_ZeroStruct" 001f9cc4 D _Py_ZeroStruct This might just be the first symbol that the linker looks for.
Here is the backtrace that I see on Ubuntu Natty: Error in sys.excepthook: Traceback (most recent call last):
+ Trace 226312
from apport.fileutils import likely_packaged
from apport.report import Report
from xml.parsers.expat import ExpatError
from pyexpat import *
Original exception was: ImportError: PyCapsule_Import could not import module "datetime"
Just so all relevant information is on this bug, there were different results with respect to this python failure on Fedora and Ubuntu systems. Here's a note about the difference from the TODO file in java-libglom: On Fedora 13, you get this warning when running the bindings but things seems to work: 'import site' failed; use -v for traceback" On Ubuntu 10.04 you get a total failure: ERROR:glom/libglom/init.cc:51:void Glom::libglom_init(): assertion failed: (PyDateTimeAPI)
java-libglom is not maintained or used now.