On May 19, 12:52 am, Mitko Haralanov <[EMAIL PROTECTED]> wrote: > For various reason, what I need to do is be able to send some Python > code (mostly entire functions in the form of a string) to a remote > server (written in Python), have that server compile the code and > insert it in the local namespace so it is available to be called at a > later time. > > I have gotten the sending and receiving part already written and that > works. However, I can't get the compiling part! I have looked at the > compile module and while it is able to compile the code I am not > entirely sure what to do with the returned code object so it get's > inserted as a local function. > > I would appreciate any help that you guys might be able to offer? > > Thanks > > -- > Mitko Haralanov [EMAIL PROTECTED] > Senior Software Engineer 650.934.8064 > System Interconnect Group http://www.qlogic.com > > ========================================== > The "cutting edge" is getting rather dull. > -- Andy Purshottam
exec it :) --- Example--- exec(compile(""" def test(): import os for i in os.listdir('.'): print i """,'<string>', 'exec')) test() --- End example--- Now you have test() function available in namespace where executed example Po-zdravi -- http://mail.python.org/mailman/listinfo/python-list