[Ironpython-users] FW: CreateMethod() replacement

Andrew Harrison sgt_spoon at hotmail.com
Wed Jun 22 20:35:47 CEST 2011








I have recently taken over a c# project that uses IronPython 1.1. I am looking to update the IronPython implementation to 2.7 but having some issues as the api has changed dramatically. The big issue I am having at the moment is finding a replacement for the createMethod() function. 

The c# code looks like:
        public static TDelegate SetupDelegate<TDelegate>(string code, IList<string> args) {
            try {
                return interpreter.CreateMethod<TDelegate>(code, args);
            } catch (Exception) {
                log.WarnFormat("Failed to compile delegate code:\n{0}", code);
                throw;
            }
        }

interpreter was a PythonEngine variable, but I have changed it to a ScriptEngine with the new 2.7 implementation. 

If it helps at all, this system is used to create delegates for event handlers. There may be some code written to be activated when a button is clicked, which is passed into this function here then the method is created and returned and added to the list of event handlers.

I have tried for a day and a half trying to get some code that worked, but can't seem to get anything that works.

Any help is greatly appreciated.
Thanks,
Andrew.
 		 	   		   		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20110623/c734cc5d/attachment.html>


More information about the Ironpython-users mailing list