Hi Crispin:
> TypeError: arg 5 (closure) expected cell, found
> stackless._wrap.cell
>
> The code is....
>
> -----------------------------
>
> import stackless
> import pickle
>
> from twisted.web import client
This may not be quite answering your question but some suggestions since
I have done quite a bit of programming with Stackless and Twisted, including
pickling.
1 - Twisted does not like being serialised. Before pickling tasklets, remove
all references to Twisted. Structure your code so this is
easy to do. You need layering.
2 - I looked at your code. Unless you are doing something really esoteric,
I would recommend you use client.getPage(). Here is a very very simple coding
example from my Pycon 2008 talk, "Adventures in Stackless Twisted Integration."
!/usr/bin/envpython
import stackless
from twisted.web import client
from twisted.internet import reactor
#executes in reactor tasklet
def handleCallback(data):
channel.send(data)
#execute in separate tasklet
def getWebPage(url):
client.getPage(url).addCallback(handleCallback)
print channel.receive()
reactor.stop()
channel = stackless.channel()
stackless.tasklet(getWebPage)("http://www.google.com")
stackless.tasklet(reactor.run)()
stackless.run()
to generalise this, use the blockOn technique recommended by
Christopher Armstrong.
To do practical things, the code is a wee more sophisticated. I know this
is a shameless plug but read my slides. That said, give me about a week, and I
will be publishing the slides and code for a new talk "A Survey of
Stackless Python"
Cheers,
Andrew
_______________________________________________
Stackless mailing list
[email protected]
http://www.stackless.com/mailman/listinfo/stackless