[Twisted-Python] mktap problem, cPickle.UnpickleableError

Hi, I am trying to create an XMLRPC server based on the plugins example in the HOWTO documentation. My TAP construction module looks like: from twisted.web import server from MyXMLRPCServer import methods from twisted.python import usage class Options(usage.Options): optParameters = [["port", "p", 8080, "Port number for XMLRPC Server."], ["ldapurl", None, "ldap://localhost/", "URL for ldap directory server."], ["ldapbinddn", None, "cn=Manager,dc=iu,dc=edu", "Bind DN for directory"], ["ldappw", None, None, "Password for directory Bind DN"]] def postOptions(self): if self['ldappw'] is None: raise usage.UsageError, "Must provide option ldappw" def updateApplication(app, config): port = int(config['port']) factory = server.Site(methods.MyXMLRPCMethods(config)) app.listenTCP(port, factory) When I run mktap with the appropriate parameters for my application, I get: Traceback (most recent call last): File "/usr/local/bin/mktap", line 30, in ? run() File "/usr/local/lib/python2.2/site-packages/twisted/scripts/mktap.py", line 252, in run a.save() File "/usr/local/lib/python2.2/site-packages/twisted/internet/app.py", line 754, in save dumpFunc(self, f) File "/usr/local/lib/python2.2/site-packages/twisted/internet/app.py", line 736, in dumpFunc _dump(obj, file, 1) cPickle.UnpickleableError: Cannot pickle <type 'LDAP'> objects I think I am getting this because my "MyXMLRPCMethods" instance contains a connection to the LDAP Server. So what is the best approach to work around this. Sorry if this is a newbie question; I am a newbie. Allan

On Mon, Apr 28, 2003 at 04:29:08PM -0500, Allan Streib wrote:
Don't connect to the LDAP server until your application starts up. This may be best done in a Factory's startFactory() method or a Service's startService method, or hackfully in one of your object's __setstate__ methods. mktap is writing a configuration file to disk, not actually running your app. So you don't want to set up any runtime stuff, like network connections, in updateApplication(). Jp -- A disciple of another sect once came to Drescher as he was eating his morning meal. "I would like to give you this personality test," said the outsider, "because I want you to be happy." Drescher took the paper that was offered him and put it into the toaster: "I wish the toaster to be happy, too." -- up 39 days, 17:03, 8 users, load average: 0.67, 0.68, 0.64

On Mon, Apr 28, 2003 at 04:29:08PM -0500, Allan Streib wrote:
Don't connect to the LDAP server until your application starts up. This may be best done in a Factory's startFactory() method or a Service's startService method, or hackfully in one of your object's __setstate__ methods. mktap is writing a configuration file to disk, not actually running your app. So you don't want to set up any runtime stuff, like network connections, in updateApplication(). Jp -- A disciple of another sect once came to Drescher as he was eating his morning meal. "I would like to give you this personality test," said the outsider, "because I want you to be happy." Drescher took the paper that was offered him and put it into the toaster: "I wish the toaster to be happy, too." -- up 39 days, 17:03, 8 users, load average: 0.67, 0.68, 0.64
participants (2)
-
Allan Streib
-
Jp Calderone