Bug added to DLR project.
From: Curt Hagenlocher Sent: Sunday, March 15, 2009 11:50 PM To: Discussion of IronPython Subject: Re: [IronPython] IPy embedding problem Can you please open a bug for this on the DLR site (http://www.codeplex.com/dlr)? There's a few methods that basically have code looking like this: switch (parameters.Length) { case 0: // blah case 1: // blah case 2: // blah default: throw new NotImplementedException(); } and these clearly need to be cleaned up. I'm pretty sure there's a workaround for this, but a quick scan through the source code doesn't reveal anything obvious to me :(. One possibility is to get "Checker" from the scope -- it may just give you a delegate you can call directly. On Sun, Mar 15, 2009 at 9:35 AM, Igor Elyas <[email protected]> wrote: Hello This sample code throws error on Python object initialization: var engine = Python.CreateEngine(); var Ops = engine.CreateOperations(); engine.Runtime.LoadAssembly(typeof(Decimal).Assembly); var src = @" class Checker: def __init__(self, one, two, three=''): self.one = one self.two = two self.tree = three def Call(self): return self.one + self.two + self.tree "; var cs = engine.CreateScriptSourceFromString(src, SourceCodeKind.Statements).Compile(); cs.Execute(); var tclass = cs.DefaultScope.GetVariable("Checker"); object obj = cs.Engine.Operations.Call(tclass,"one","two","three");// throw NotImplementedException Console.WriteLine(obj); But if I use only 2 parameter in initialize/constructor such as : object obj = cs.Engine.Operations.Call(tclass,"one","two"); , than all works fine. What wrong ? Best regards Igor Elyas _______________________________________________ Users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------------------------------------------------------------------------- _______________________________________________ Users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________ Users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
