[mod_python] pickle objects

Graham Dumpleton grahamd at dscpl.com.au
Thu Dec 22 14:56:41 EST 2005


On 23/12/2005, at 4:11 AM, chase3 at llnl.gov wrote:

> Still stuck using
> apache server is at 2.0.46; python 2.2.35 and mod_python-3.0.3-3.ent
>
> I am using mod_python publisher and sending data to a separate server:
>
> Attempted to pickle data of the following type and pass
> it through a socket to the server:
>
> class Prop:
>    def __init__ ( self, propName, propValue, propType ):
>       self.propName = propName
>       self.propValue = propValue
>       self.propType = propType
>
> but got the following error:
>
> bugzi.llnl.gov:/home/chase/tracker/src[33] tracker-server.py &
> [1] 3559
> bugzi.llnl.gov:/home/chase/tracker/src[34] Traceback (most recent  
> call last):
>   File "tracker-server.py", line 468, in ?
>     handleDBUpdate ( clientSocket )
>   File "tracker-server.py", line 64, in handleDBUpdate
>     d = cPickle.load ( f )
>   File "tracker-receive.py", line 24, in ?
>     from mod_python import apache
>   File "/usr/src/build/513032-i386/install/usr/lib/python2.2/site- 
> packages/mod_python/apache.py", line 67, in ?
> ImportError: No module named _apache
>
> I am wondering if this is connected to Graham's article on Issues with
> Session Objects.

The question is, what were the types of the members of the instance  
of the above
class when you pickled it in the first place. The error suggests you  
tried to pickle
some data for which the class type was defined in or dependent on  
mod_python
specific modules. As a consequence, when you tried to unpickle them  
in the
separate application, it tried to load mod_python modules which isn't  
going to
work outside of mod_python running under Apache.

Graham


More information about the Mod_python mailing list