[Ironpython-users] Cannot create instances of that class because it is abstract

Djordje Spasic issworld2000 at yahoo.com
Mon Jan 25 11:03:52 EST 2016


Hello,

I am trying to call a specific method ("Open") from the .NET assembly.The .NET assembly along with all other .dlls and necessary files, can be downloaded from here. It's free an open source project: MapWindow.
In their examples page, by loading the Interop.MapWinGIS.dll file, they call the MapWinGIS.Shapefile.Open() method like so:

using MapWinGIS;
string shpfilename = "C:/example.shp";
Shapefile sf = new Shapefile();
if (sf.Open(shpfilename, null))
{
}


However, when I try the same thing in ironpython:
    import clr
    import os
    
    shpfilename = "C:/example.shp"
    dllsfilename = "C:/mapwindow_dlls"
    
    clr.AddReferenceToFileAndPath(os.path.join(dllsfilename, "Interop.MapWinGIS.dll"))
    print "Interop.MapWinGIS.dll loaded: ", "Interop.MapWinGIS" in [assembly.GetName().Name for assembly in clr.References]  # prints: True
    import MapWinGIS
    
    sf = MapWinGIS.Shapefile()  # raises Error
    sf.Open(shpfilename, None)


I am getting an error message:
   "Message: Cannot create instances of Shapefile because it is abstract"
Why is this happening?
I contacted the author of the project, but couldn't solve the issue.
Any kind of advice would be helpful.
Kind regards,
Djordje Spasic

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20160125/35074135/attachment.html>


More information about the Ironpython-users mailing list