[Ironpython-users] PINVOKE exception from loaded .NET assembly

Djordje Spasic issworld2000 at yahoo.com
Mon Nov 16 07:00:19 EST 2015

Hello to IronPython community,

I am trying call a method from loaded .NET assembly in python, but for some reason, I am getting a PINVOKE exception. Is there some way to print what is the reason for that exception?
This is the code:
import clr

import OSGeo.GDAL as gdalc


The last line raises:

The type initializer for 'OSGeo.GDAL.GdalPINVOKE' threw an exception.

I am essentially trying to open the file by replicating this c++ example.

What is the reason for the raised PINVOKE exception?

I have a 32 bit windows XP SP3 operating system and loaded gdal_csharp.dll is 32 bit compiled, download​ed from gisinternals.com. I attached gdal_csharp.dll and all other its .dlls in here. I am using IronPython 2.7, which is what Rhino 5 application is shipped with (basically, I am using IronPython 2.7 interpreter inside Rhino 5 application).
This is the gdal documentation page.

I tried looking for an answer at Gdal's mailing list too, but without success.

Any help would be appreciated.

Thank you in advance,

Kind regards,
Djordje Spasic

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

More information about the Ironpython-users mailing list