Parent module not loaded error

Ståle Undheim staaleu at
Wed Jan 14 11:20:50 CET 2009

I have a pretty strange error that I can't figure out the cause off.
This is in a Django app.

I am using berkelydb, with secondary databases for indexing. The
secondary databases are associated with a callback that uses cPickle
to serialize index values. The problem is that cPickle.dumps(value)
fails when I run it through mod_wsgi or mod_python on the deployment
server (Ubuntu Linux 8.10), but works fine when when I use Djangos
runserver on the same computer. Also, on my own computer (Ubuntu Linux
8.10), it works fine through mod_python.

Each time I call on cPickle.dumps(value) I get:
SystemError("Parent module 'd4' not loaded",)

Using sys.exc_info() I get no type or traceback, just that exception.
The callstack as far as I can figure is:

indexer callback

cPickle.loads works fine within the callback, I can also use
cPickle.dumps() outside the indexer callback. But inside the callback,
I need to use normal pickle instead. I just want to know why. I am
assuming it has something to do with the fact that I go from python to
C (bsddb) back to python (indexer callback) and back to C (cPickle).
It is still strange then that cPickle.loads() work, but not
cPickle.dumps(). I am also only storing integer values when I get this
error, so no fancy list, dictionaries or objects.

More information about the Python-list mailing list