<div dir="ltr"><div>Shapefile is an interface with a CoClassAttribute to ShapefileClass (which means when you do new Shapefile() in C# it creates an instance of ShapefileClass). I have no idea what the correct behaviour for IronPython should be, but in this case MapWinGIS.Shapefile gives you the interface.<br><br></div>You could try MapWinGIS.ShapefileClass() instead of MapWinGIS.Shapefile().<br><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 25, 2016 at 11:03 AM, Djordje Spasic via Ironpython-users <span dir="ltr"><<a href="mailto:ironpython-users@python.org" target="_blank">ironpython-users@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="color:#000;background-color:#fff;font-family:verdana,helvetica,sans-serif;font-size:13px"><div>Hello,<br><br>I am trying to call a specific method ("Open") from the .NET assembly.</div><div dir="ltr">The .NET assembly along with all other .dlls and necessary files, can be downloaded <a href="https://mapwindow4.codeplex.com/releases/view/110244" target="_blank">from here</a>. It's free an open source project: MapWindow.</div><div dir="ltr"><br></div><div dir="ltr">In their <a href="http://www.mapwindow.org/documentation/mapwingis4.9/examples.html" target="_blank">examples page</a>, by loading the <i>Interop.MapWinGIS.dll</i> file, they call the <i>MapWinGIS.</i><span><i>Shapefile.Open()</i> method like so:</span></div><div dir="ltr"><br></div><blockquote><div dir="ltr"><span><span>using MapWinGIS;</span></span></div><div dir="ltr"><br><span><span></span></span></div><div dir="ltr"><span><span>string </span></span><span><span>shpfilename = "</span></span><span><span>C:/example.shp";<br></span></span></div><div dir="ltr"><span><span>Shapefile sf = new Shapefile();<br>if (sf.<b>Open</b>(</span></span><span><span>shpfilename, null))<br>{<br>}</span></span><span></span><b><br></b></div></blockquote><div><br></div><div>However, when I try the same thing in ironpython:</div><div><br></div><div dir="ltr">    import clr<br>    import os<br>    <br>    shpfilename = "C:/example.shp"<br>    dllsfilename = "C:/mapwindow_dlls"<br>    <br>    clr.AddReferenceToFileAndPath(os.path.join(dllsfilename, "Interop.MapWinGIS.dll"))<br>    print "Interop.MapWinGIS.dll loaded: ", "Interop.MapWinGIS" in [assembly.GetName().Name for assembly in clr.References]  # prints: True<br>    import MapWinGIS<br>    <br>    sf = MapWinGIS.Shapefile()  # raises Error<br>    sf.<b>Open</b>(shpfilename, None)<br></div><div><br></div><div><br></div><div dir="ltr">I am getting an error message:</div><div dir="ltr"><br></div><div dir="ltr"><i>   "Message: Cannot create instances of Shapefile because it is abstract"</i></div><div dir="ltr"><span></span><span><br>Why is this happening?</span></div><div dir="ltr"><br><span></span></div><div dir="ltr">I contacted the author of the project, but couldn't solve the issue.</div><div dir="ltr"><br></div><div dir="ltr">Any kind of advice would be helpful.</div><div dir="ltr"><br></div><div dir="ltr">Kind regards,<br>Djordje Spasic<br><span></span></div><div dir="ltr"><span></span><br></div></div></div><br>_______________________________________________<br>
Ironpython-users mailing list<br>
<a href="mailto:Ironpython-users@python.org">Ironpython-users@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/ironpython-users" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/ironpython-users</a><br>
<br></blockquote></div><br></div>