[mod_python] ImportError: No module named _mp_6a56a751b58d143e34982c81384539ef

Graham Dumpleton graham.dumpleton at gmail.com
Tue Jul 15 08:28:31 EDT 2008


2008/7/15 Buck Golemon <workitharder at gmail.com>:
> That's a real bummer. Is there any plan to remove this limitation?

No.

> Where did this module _mp_1234567 come from?

It is a value generated from the absolute pathname to the code file
for the module. This magic value is used to allow same handler code
file name to be used in different directories.

In other words, it is this way to get around the limitation in Python
that module names have to be unique.

I don't understand why this is a problem. Just put your code where
classes are that need pickling into a separate module and install that
into a directory on your sys.path and import it like a normal Python
module. That or don't use complex types, which aren't recommended as a
good idea, within a session dictionary.

Graham

> On Mon, Jul 14, 2008 at 5:09 PM, Graham Dumpleton
> <graham.dumpleton at gmail.com> wrote:
>>
>> Read:
>>
>>  http://www.dscpl.com.au/wiki/ModPython/Articles/IssuesWithSessionObjects
>>
>> You can't pickle objects which are contained in code files managed by
>> mod_python module importer.
>>
>> Graham
>>
>> 2008/7/15 Buck Golemon <workitharder at gmail.com>:
>> > I had to manually alter my class's __module__ attribute to get it to
>> > unpickle successfully.
>> >
>> >>>> print MyClass.__module__
>> > _mp_6a56a751b58d143e34982c81384539ef
>> >>>> MyClass.__module__ = "myscript"
>> >
>> > This solved my problem, but is there something I'm doing wrong? It
>> > doesn't
>> > seem like I should have to do this.


More information about the Mod_python mailing list