Python xmlrpc servers?

Skip Montanaro skip at pobox.com
Wed Dec 1 15:21:35 EST 2004


    >> Have you looked in your web server's error log file?

    ted> Shoulda thought of that....  It's telling me that the name
    ted> CGIXMLRPCRequestHandler is not found.  In other words, it is trying
    ted> to execute the proper file at least.  I'd have that that importing
    ted> SimpleXMLRPCServer would have sufficed to make the right classes
    ted> available.

Sounds like you are executing

    import SimpleXMLRPCServer

If so, you need to qualify the reference to the handler class like

    SimpleXMLRPCServer.CGIXMLRPCRequestHandler

An import statement loads the specified module and binds a variable in the
current scope to the resulting module object.  There's a builtin __import__
function that imports and returns a module object.  The above import
statement is equivalent to

    SimpleXMLRPCServer = __import__("SimpleXMLRPCServer")

If you want to import selected names from the module's namespace you can
execute

    from SimpleXMLRPCServer import CGIXMLRPCRequestHandler

which creates a binding in the current namespace called
"CGIXMLRPCRequestHandler" associated with that class.

Skip



More information about the Python-list mailing list