<div>&quot;fooclass&quot; is not a Python type. It&#39;s an instance of the CLR class System.RuntimeType. In order to derive from &quot;foo&quot; in this fashion, you might be able to turn fooclass into a IronPython.Runtime.Types.PythonType by saying</div>

<div> </div>
<div>import clr</div>
<div>foo = clr.GetPythonType(fooclass)</div>
<div>class bar(foo):</div>
<div>    pass</div>
<div> </div>
<div>If it&#39;s consistent with your security requirements, it would be simpler to simply expose your C# assembly directly to IronPython. You would do this from within the C# code by saying </div>
<div> </div>
<div>scriptRuntime.LoadAssembly(typeof(foo).Assembly);</div>
<div> </div>
<div>and then you could say from your Python code</div>
<div> </div>
<div>from Namespace.Containing.Your.Foo.Class import foo<br><br></div>
<div class="gmail_quote">On Mon, Dec 28, 2009 at 4:36 AM, Marcel Heing-Becker <span dir="ltr">&lt;<a href="mailto:marscel@googlemail.com">marscel@googlemail.com</a>&gt;</span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>PLEASE IGNORE MY PREVIOUS POST with the same title, I accidentally sent it before I was finished cleaning up the code.</div>
<div><br></div>
<div>Hi there,<br></div>
<div>I have a problem with my application. It&#39;s written in C# and embeds IronPython. In C#, I have a class that looks like this:</div>
<div><br></div>
<div>public class foo<br>{<br>    public foo()<br>    {<br>        ...<br>    }<br>    ...<br>}<br></div>
<div><br></div>
<div>I put this into the ScriptScope I use by doing:</div>
<div><br></div>
<div>scope.SetVariable(&quot;fooclass&quot;, typeof(foo));</div>
<div><br></div>
<div>Operations like: a = fooclass() work without any problem, but the following IronPython does not work and raises the error: Cannot create instances of RuntimeType because it has no public constructors. Code:</div>
<div><br></div>
<div>class bar(fooclass):<br>    def __init__(self):<br>        Name = &quot;Unused&quot;<br>    ...</div>
<div><br></div>
<div>barobject = bar()<br></div>
<div><br></div>
<div>Well, I can&#39;t really say what this is about. Is it a Bug in IP or anything like a limitation?<br></div>
<div>Greetings, Marcel</div><br>_______________________________________________<br>Users mailing list<br><a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br><a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
<br></blockquote></div><br>