Hi!<br><br>I&#39;m having troubles accessing .NET object properties from ipy. Object<br>is passed to IronPython 1.1 and IronPython breaks with error:<br>Unhandled Exception: System.MissingMemberException: &#39;Person&#39; object
<br>has no attribute &#39;Name&#39;<br><br>This is all due to the fact, that this object is based on an<br>interface, which is based on an interface. To make things clearer I&#39;ve<br>created a simple problem-statement program, which demonstrates the
<br>behavior.<br><br>Problem: IronPython can NOT access class members of an explicitly<br>implemented interface. The program that exhibits this is below, and<br>also on <a href="http://www.mihavalencic.com/temp/Program.txt" target="_blank">
http://www.mihavalencic.com/temp/Program.txt</a> (for easier<br>reading). Just compile it with IronPython.dll and it will break where<br>it shouldn&#39;t (IMHO).<br><br>I was searching information on how could I explicitly cast this object
<br>to IPerson (in the example), but could not find anyhing -- Python as a<br>language apparently does not support interfaces.<br><br>Ideas, suggestions are very welcome!<br><br>update: I even tried something like this:<br>
<br>person_explicit = IPerson(&quot;Wrapped.person);<br>print person_explicit.Name;<br><br>but I alwyas get the same error: Either the object does not have Name property or that NoneType is not callable.<br><br>Thanks,<br>
 &nbsp;Miha.<br><br>The progarm:<br>using System;<br>using IronPython.Hosting;<br>using IronPython.Modules;<br>using System.Collections.Generic;<br><br>namespace ProblemStatement<br>{<br> &nbsp; &nbsp;public interface IPerson<br> &nbsp; &nbsp;{<br>
 &nbsp; &nbsp; &nbsp; &nbsp;string Name {get;set;}<br> &nbsp; &nbsp;}<br> &nbsp; &nbsp;public class Person : IPerson<br> &nbsp; &nbsp;{<br> &nbsp; &nbsp; &nbsp; &nbsp;string IPerson.Name<br> &nbsp; &nbsp; &nbsp; &nbsp;{<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;get<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return &quot;Default name&quot;;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;set<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br> &nbsp; &nbsp; &nbsp; &nbsp;}<br> &nbsp; &nbsp;}<br><br> &nbsp; &nbsp;public class Wrapper<br> &nbsp; &nbsp;{<br> &nbsp; &nbsp; &nbsp; &nbsp;public IPerson person;<br> &nbsp; &nbsp; &nbsp; &nbsp;public Wrapper(IPerson personIn)<br> &nbsp; &nbsp; &nbsp; &nbsp;{<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;person = personIn;<br> &nbsp; &nbsp; &nbsp; &nbsp;}<br><br> &nbsp; &nbsp;}<br><br> &nbsp; &nbsp;class Program<br> &nbsp; &nbsp;{<br> &nbsp; &nbsp; &nbsp; &nbsp;static void Main(string[] args)<br> &nbsp; &nbsp; &nbsp; &nbsp;{<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;PythonEngine eng = new PythonEngine();<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;EngineModule mod = 
eng.CreateModule();<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ClrModule clr = eng.Import(&quot;clr&quot;) as ClrModule;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;clr.AddReferenceByPartialName(&quot;ProblemStatement&quot;);<br><br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Dictionary&lt;string, object&gt; locals = new Dictionary&lt;string,
<br>object&gt;();<br><br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;locals[&quot;Env&quot;] = new Person();<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Wrapper wrapped = new Wrapper(new Person());<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;locals[&quot;Wrapped&quot;] = wrapped;<br><br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// this works
<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Console.WriteLine(<a href="http://wrapped.person.name/" target="_blank">wrapped.person.Name</a>);<br><br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// this breaks<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;eng.Execute(&quot;print Env.Name&quot;, mod, locals);<br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // this breaks as well<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; eng.Execute(&quot;print <a href="http://Wrapped.person.Name">Wrapped.person.Name</a>&quot;);<br> &nbsp; &nbsp; &nbsp; &nbsp;}<br> &nbsp; &nbsp;}<br>}