<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content=text/html;charset=koi8-r>
<META content="MSHTML 6.00.6001.18203" name=GENERATOR></HEAD>
<BODY id=MailContainerBody
style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-TOP: 15px" leftMargin=0
topMargin=0 CanvasTabStop="true" name="Compose message area">
<DIV><FONT face=Calibri>Hello</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>This sample code throws error on Python object
initialization:</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT
face=Calibri>
var engine =
Python.CreateEngine();<BR>
var Ops =
engine.CreateOperations();<BR>
engine.Runtime.LoadAssembly(typeof(Decimal).Assembly);<BR>
var src
=<BR>
@"<BR>class Checker:<BR> def __init__(self, one, two,
three=''):<BR> self.one = one<BR> self.two =
two<BR> self.tree = three<BR> def
Call(self):<BR> return self.one + self.two +
self.tree<BR>";</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT
face=Calibri>
var cs = engine.CreateScriptSourceFromString(src,
SourceCodeKind.Statements).Compile();<BR>
cs.Execute();<BR>
var tclass =
cs.DefaultScope.GetVariable("Checker");<BR>
object obj = cs.Engine.Operations.Call(tclass,"one","two","three");// throw
NotImplementedException</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT
face=Calibri>
Console.WriteLine(obj);</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>But if I use only 2 parameter in
initialize/constructor such as :</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT
face=Calibri> object
obj = cs.Engine.Operations.Call(tclass,"one","two");</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>, than all works fine. </FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>What wrong ?</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>Best regards</FONT></DIV>
<DIV><FONT face=Calibri>Igor Elyas</FONT></DIV></BODY></HTML>