help on eval()-like but return module object

Dody Suria Wijaya dodysw at gmail.com
Thu Jan 12 08:47:23 EST 2006


As I'm adding XMLRPC support in my apps, I'd like to send a module in 
server to be executed in client. My plan in sending the file content via 
xmlrpc, and doing compile + eval, but eval just execute the code object 
without returning the module.

Original:

import mymodule
mymodule.run(request)

Wish:

string_code = rpc_con.GetModule('mymodule')
code_obj = compile(string_code, '<string>', 'exec')
mymodule = eval(code_obj)
mymodule.run(request)

Any helps on this topic would be highly appreciated. Thanks!

--
   dsw



More information about the Python-list mailing list