[Twisted-Python] Re: Simple app pickle issue when stopping

Alexander May alex-news at comcast.net
Sat May 15 19:34:28 EDT 2004

Yes, that worked.  Thank you.

-----Original Message-----
From: twisted-python-bounces at twistedmatrix.com
[mailto:twisted-python-bounces at twistedmatrix.com] On Behalf Of Alex Levy
Sent: Saturday, May 15, 2004 4:40 PM
To: Twisted discussion stuff
Subject: [Twisted-Python] Re: Simple app pickle issue when stopping

On Sat, 2004-05-15 at 15:14, Alexander May wrote:
> Still trying to learn/understand twisted.  Mind exploding/getting 
> frustrated.  I created this very simple app:


>           File 
> "C:\Python23\Lib\site-packages\twisted\persisted\sob.py",
> line 119, in dumpFunc
>             pickle.dump(obj, file, 1)
>         cPickle.PicklingError: Can't pickle __builtin__.SimpleResource:
> attribute lookup __builtin__.SimpleResource faied

Try defining SimpleResource inside your own module, instead of in
scratch.py. That way, when it goes to pickle your resource, it looks up
'mymodule.SimpleResource' instead of '__builtin__.SimpleResource'.

Worth a try?

Separation of application code and deployment code is pretty important for
Twisted apps. The idea is that .tac and .rpy files (and other such
things) shouldn't have your actual application in them - they should just be
glue to get your application to work properly within a given system.

Alex Levy
WWW: http://mesozoic.geecs.org/

"Never let your sense of morals prevent you from doing what is right."
-- Salvor Hardin, Isaac Asimov's _Foundation_

More information about the Twisted-Python mailing list