[Twisted-Python] mktap problem, cPickle.UnpickleableError

Allan Streib astreib at indiana.edu
Mon Apr 28 17:29:08 EDT 2003


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 ?
      File "/usr/local/lib/python2.2/site-packages/twisted/scripts/mktap.py", line 252, in run
      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.


More information about the Twisted-Python mailing list