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

Alex Levy mesozoic at polynode.com
Sat May 15 16:39:53 EDT 2004


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:

--snip--

>           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_
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20040515/06273aec/attachment.pgp 


More information about the Twisted-Python mailing list