[Twisted-Python] reactor.run() or application.save()+run?
Mario Ruggier
mario at ruggier.org
Thu Feb 27 12:15:08 EST 2003
Hi,
trying to turn the little Resources example (below) into an application
(replacing use of reactor with application), so that I can save it as
an application,
when i call "twistd -f pargs-webapp.tap", I get the following error :
Failed to load application: <twisted.persisted.styles.Ephemeral
instance at 0x3ad330> is not safe for unpickling
If I do not call save() but just run(), the application runs
correctly...
Any ideas?
mario
###
from twisted.web.resource import Resource
#from twisted.internet import reactor
from twisted.internet import app
from twisted.web.server import Site
from twisted.web.static import File
from PathArgs import PathArgs
class DynamicRequest(Resource):
def isLeaf(self):
return false
def render(self, req):
req.setHeader('Content-type','text/plain')
resp = 'uri: %s \nargs: %s\npathargs: %s\n'
return resp % ( req.uri, req.args, req.pathargs )
###
def run():
root = PathArgs(splitOnComma=1)
root.putChild("dynamic", DynamicRequest())
root.putChild("static",MyFile("."))
site = Site(root)
#reactor.listenTCP(8081,site)
#reactor.run()
application = app.Application('webapp')
application.listenTCP(8081,site)
#application.run()
application.save('pargs')
###
if __name__ == '__main__':
run()
###
More information about the Twisted-Python
mailing list