<html><head></head><body><div style="color:#000; background-color:#fff; font-family:verdana, helvetica, sans-serif;font-size:13px"><div dir="ltr" id="yui_3_16_0_1_1447754426781_18037"><span id="yui_3_16_0_1_1447754426781_18050">Thank you.<br><br>I am not a programmer myself.<br>How would either InnerException or AggregateException be used in this case?</span></div><div id="yui_3_16_0_1_1447754426781_18402" dir="ltr"><span id="yui_3_16_0_1_1447754426781_18050">I tried:</span></div><pre class="" id="yui_3_16_0_1_1447754426781_18428" style="background:white;"><code class="" id="yui_3_16_0_1_1447754426781_18506"><span class="" id="yui_3_16_0_1_1447754426781_18508" style="color:#440062;"><code class="" id="yui_3_16_0_1_1447754426781_18506"><span class="" id="yui_3_16_0_1_1447754426781_18508" style="color:#440062;">try:</span></code> <br> gdalc.Gdal.AllRegister()<br class="" id="yui_3_16_0_1_1447754426781_18544">except System.AggregateException as e:<br class="" id="yui_3_16_0_1_1447754426781_18546"> print "exception: ", e.InnerExceptions <br class="" id="yui_3_16_0_1_1447754426781_18548"></span></code></pre>
<div id="yui_3_16_0_1_1447754426781_18405"><br></div><div id="yui_3_16_0_1_1447754426781_18407">But that didn't seem to be correct.<br><br><br> </div><div id="yui_3_16_0_1_1447754426781_18024" style="font-family: verdana, helvetica, sans-serif; font-size: 13px;"> <div id="yui_3_16_0_1_1447754426781_18023" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div id="yui_3_16_0_1_1447754426781_18035" dir="ltr"> <hr id="yui_3_16_0_1_1447754426781_18036" size="1"> <font id="yui_3_16_0_1_1447754426781_18034" size="2" face="Arial"> <b><span style="font-weight:bold;">From:</span></b> Markus Schaber <m.schaber@codesys.com><br> <b><span style="font-weight: bold;">To:</span></b> Djordje Spasic <issworld2000@yahoo.com>; "ironpython-users@python.org" <ironpython-users@python.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Tuesday, November 17, 2015 11:31 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> RE: [Ironpython-users] PINVOKE exception from loaded .NET assembly<br> </font> </div> <div id="yui_3_16_0_1_1447754426781_18022" class="y_msg_container"><br><div id="yiv9011599688"><style>#yiv9011599688 #yiv9011599688 --
_filtered #yiv9011599688 {font-family:Helvetica;panose-1:2 11 6 4 2 2 2 2 2 4;}
_filtered #yiv9011599688 {font-family:Helvetica;panose-1:2 11 6 4 2 2 2 2 2 4;}
_filtered #yiv9011599688 {font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;}
_filtered #yiv9011599688 {font-family:Tahoma;panose-1:2 11 6 4 3 5 4 4 2 4;}
_filtered #yiv9011599688 {font-family:Consolas;panose-1:2 11 6 9 2 2 4 3 2 4;}
_filtered #yiv9011599688 {font-family:Verdana;panose-1:2 11 6 4 3 5 4 4 2 4;}
#yiv9011599688
#yiv9011599688 p.yiv9011599688MsoNormal, #yiv9011599688 li.yiv9011599688MsoNormal, #yiv9011599688 div.yiv9011599688MsoNormal
{margin:0cm;margin-bottom:.0001pt;font-size:12.0pt;}
#yiv9011599688 a:link, #yiv9011599688 span.yiv9011599688MsoHyperlink
{color:blue;text-decoration:underline;}
#yiv9011599688 a:visited, #yiv9011599688 span.yiv9011599688MsoHyperlinkFollowed
{color:purple;text-decoration:underline;}
#yiv9011599688 code
{}
#yiv9011599688 pre
{margin:0cm;margin-bottom:.0001pt;font-size:10.0pt;}
#yiv9011599688 p.yiv9011599688MsoAcetate, #yiv9011599688 li.yiv9011599688MsoAcetate, #yiv9011599688 div.yiv9011599688MsoAcetate
{margin:0cm;margin-bottom:.0001pt;font-size:8.0pt;}
#yiv9011599688 span.yiv9011599688HTMLVorformatiertZchn
{font-family:Consolas;}
#yiv9011599688 span.yiv9011599688E-MailFormatvorlage20
{color:windowtext;font-weight:normal;font-style:normal;}
#yiv9011599688 span.yiv9011599688SprechblasentextZchn
{}
#yiv9011599688 .yiv9011599688MsoChpDefault
{font-size:10.0pt;}
_filtered #yiv9011599688 {margin:70.85pt 70.85pt 2.0cm 70.85pt;}
#yiv9011599688 div.yiv9011599688WordSection1
{}
#yiv9011599688 </style><div id="yui_3_16_0_1_1447754426781_18033">
<div id="yui_3_16_0_1_1447754426781_18032" class="yiv9011599688WordSection1">
<div id="yui_3_16_0_1_1447754426781_18031" class="yiv9011599688MsoNormal"><span style="font-size:10.0pt;" lang="EN-US">Hi,</span></div>
<div id="yui_3_16_0_1_1447754426781_18052" class="yiv9011599688MsoNormal"><span style="font-size:10.0pt;" lang="EN-US"> </span></div>
<div id="yui_3_16_0_1_1447754426781_18053" class="yiv9011599688MsoNormal"><span id="yui_3_16_0_1_1447754426781_18054" style="font-size:10.0pt;" lang="EN-US">The inner exception (if present) can be accessed via the InnerException property of the “outer” exception:</span></div>
<div id="yui_3_16_0_1_1447754426781_18134" class="yiv9011599688MsoNormal"><span style="font-size:10.0pt;" lang="EN-US"> </span></div>
<div id="yui_3_16_0_1_1447754426781_18099" class="yiv9011599688MsoNormal"><span id="yui_3_16_0_1_1447754426781_18136" style="font-size:10.0pt;" lang="EN-US"><a id="yui_3_16_0_1_1447754426781_18135" rel="nofollow" shape="rect" target="_blank" href="https://msdn.microsoft.com/de-de/library/system.exception.innerexception%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396">https://msdn.microsoft.com/de-de/library/system.exception.innerexception%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396</a></span></div>
<div id="yui_3_16_0_1_1447754426781_18100" class="yiv9011599688MsoNormal"><span style="font-size:10.0pt;" lang="EN-US"> </span></div>
<div id="yui_3_16_0_1_1447754426781_18063" class="yiv9011599688MsoNormal"><span id="yui_3_16_0_1_1447754426781_18408" style="font-size:10.0pt;" lang="EN-US">(This is a .NET feature, not an IronPython specific one.)</span></div>
<div id="yui_3_16_0_1_1447754426781_18057" class="yiv9011599688MsoNormal"><span style="font-size:10.0pt;" lang="EN-US"> </span></div>
<div id="yui_3_16_0_1_1447754426781_18059" class="yiv9011599688MsoNormal"><span id="yui_3_16_0_1_1447754426781_18058" style="font-size:10.0pt;" lang="EN-US">There’s also an AggregateException which is used in some cases:</span></div>
<div id="yui_3_16_0_1_1447754426781_18062" class="yiv9011599688MsoNormal"><span id="yui_3_16_0_1_1447754426781_18061" style="font-size:10.0pt;" lang="EN-US"><a id="yui_3_16_0_1_1447754426781_18060" rel="nofollow" shape="rect" target="_blank" href="https://msdn.microsoft.com/de-de/library/system.aggregateexception%28v=vs.110%29.aspx">https://msdn.microsoft.com/de-de/library/system.aggregateexception%28v=vs.110%29.aspx</a></span></div>
<div id="yui_3_16_0_1_1447754426781_18413" class="yiv9011599688MsoNormal"><span style="font-size:10.0pt;" lang="EN-US"> </span></div>
<div class="yiv9011599688MsoNormal"><span style="font-size:10.0pt;" lang="EN-US"> </span></div>
<div id="yui_3_16_0_1_1447754426781_18447">
<div id="yui_3_16_0_1_1447754426781_18446" class="yiv9011599688MsoNormal"><span style="font-size:10.0pt;">Grüße,</span></div>
<div class="yiv9011599688MsoNormal"><span style="font-size:10.0pt;">Markus</span></div>
</div>
<div id="yui_3_16_0_1_1447754426781_18444" class="yiv9011599688MsoNormal"><span style="font-size:10.0pt;" lang="EN-US"> </span></div>
<div class="qtdSeparateBR"><br><br></div><div class="yiv9011599688yqt5702794402" id="yiv9011599688yqt93492"><div id="yui_3_16_0_1_1447754426781_18418" style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt;">
<div id="yui_3_16_0_1_1447754426781_18417">
<div id="yui_3_16_0_1_1447754426781_18416" style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm;">
<div id="yui_3_16_0_1_1447754426781_18415" class="yiv9011599688MsoNormal"><b><span style="font-size:10.0pt;">From:</span></b><span id="yui_3_16_0_1_1447754426781_18414" style="font-size:10.0pt;"> Djordje Spasic [mailto:issworld2000@yahoo.com]
<br clear="none">
<b>Sent:</b> Tuesday, November 17, 2015 11:16 AM<br clear="none">
<b>To:</b> Markus Schaber; ironpython-users@python.org<br clear="none">
<b>Subject:</b> Re: [Ironpython-users] PINVOKE exception from loaded .NET assembly</span></div>
</div>
</div>
<div id="yui_3_16_0_1_1447754426781_18420" class="yiv9011599688MsoNormal"> </div>
<div id="yui_3_16_0_1_1447754426781_18423">
<div id="yui_3_16_0_1_1447754426781_18443" class="yiv9011599688MsoNormal" style="background:white;"><span style="font-size:10.0pt;">Hi Markus,<br clear="none">
<br clear="none">
Thank you for the reply.</span></div>
<div id="yiv9011599688yui_3_16_0_1_1447754426781_10768">
<div class="yiv9011599688MsoNormal" style="background:white;"><span style="font-size:10.0pt;">How can I access the inner exception in ironpython?<br clear="none">
<br clear="none">
I tried this:</span></div>
</div>
<div id="yiv9011599688yui_3_16_0_1_1447754426781_10769">
<div id="yui_3_16_0_1_1447754426781_18442" class="yiv9011599688MsoNormal" style="background:white;"><span style="font-size:10.0pt;"> </span></div>
</div>
<pre id="yiv9011599688yui_3_16_0_1_1447674724388_3316" style="background:white;"><code id="yiv9011599688yui_3_16_0_1_1447674724388_3318"><span id="yui_3_16_0_1_1447754426781_18437" style="color:#440062;">import clr</span></code></pre>
<pre style="background:white;"><code><span style="color:#440062;">clr.AddReferenceToFileAndPath("c:/gdal/gdal2bb/gdal_csharp.dll")</span></code></pre>
<pre id="yui_3_16_0_1_1447754426781_18424" style="background:white;"><code><span style="color:#440062;"> </span></code></pre>
<pre id="yui_3_16_0_1_1447754426781_18427" style="background:white;"><code id="yui_3_16_0_1_1447754426781_18426"><span id="yui_3_16_0_1_1447754426781_18425" style="color:#440062;">import OSGeo.GDAL as gdalc</span></code></pre>
<pre id="yui_3_16_0_1_1447754426781_18428" style="background:white;"><code><span style="color:#440062;"> </span></code></pre>
<pre id="yui_3_16_0_1_1447754426781_18429" style="background:white;"><code id="yui_3_16_0_1_1447754426781_18436"><span id="yui_3_16_0_1_1447754426781_18435" style="color:#440062;">try:</span></code><span id="yui_3_16_0_1_1447754426781_18431" style="color:#440062;"><br id="yiv9011599688yui_3_16_0_1_1447754426781_10947" clear="none"><code id="yui_3_16_0_1_1447754426781_18430"> gdalc.Gdal.AllRegister()</code><br id="yiv9011599688yui_3_16_0_1_1447754426781_10949" clear="none"><br id="yiv9011599688yui_3_16_0_1_1447754426781_10951" clear="none"><code id="yui_3_16_0_1_1447754426781_18432">except System.Exception as e:</code><br id="yiv9011599688yui_3_16_0_1_1447754426781_10953" clear="none"><code id="yui_3_16_0_1_1447754426781_18434"> print e.Message</code></span><span style="color:black;"></span></pre>
<div id="yiv9011599688yui_3_16_0_1_1447754426781_10839">
<div class="yiv9011599688MsoNormal" style="background:white;"><span style="font-size:10.0pt;"> </span></div>
</div>
<div id="yiv9011599688yui_3_16_0_1_1447754426781_10789">
<div class="yiv9011599688MsoNormal" style="background:white;"><span style="font-size:10.0pt;">But it raises the same message:</span></div>
</div>
<div id="yiv9011599688yui_3_16_0_1_1447754426781_10976">
<div class="yiv9011599688MsoNormal" style="background:white;"><span style="font-size:10.0pt;"> </span></div>
</div>
<div id="yiv9011599688yui_3_16_0_1_1447754426781_10918">
<div class="yiv9011599688MsoNormal" style="background:white;"><code><span style="font-size:10.0pt;color:#440062;">The type initializer for 'OSGeo.GDAL.GdalPINVOKE' threw an exception.</span></code><span style="font-size:10.0pt;"></span></div>
</div>
<div id="yiv9011599688yui_3_16_0_1_1447754426781_10767">
<div class="yiv9011599688MsoNormal" style="background:white;"><span style="font-size:10.0pt;"><br clear="none">
So this is not an inner exception?</span></div>
</div>
<div id="yiv9011599688yui_3_16_0_1_1447754426781_10995">
<div class="yiv9011599688MsoNormal" style="background:white;"><span style="font-size:10.0pt;"><br clear="none">
<br clear="none">
</span></div>
</div>
<div id="yiv9011599688yui_3_16_0_1_1447754426781_11048">
<div class="yiv9011599688MsoNormal" style="background:white;"><span style="font-size:10.0pt;"><br clear="none">
<br clear="none">
</span></div>
</div>
<div id="yiv9011599688yui_3_16_0_1_1447754426781_11049">
<div class="yiv9011599688MsoNormal" style="background:white;"><span style="font-size:10.0pt;">Regards,<br clear="none">
Djordje</span></div>
</div>
<div class="yiv9011599688MsoNormal" style="background:white;"><span style="font-size:10.0pt;"> </span></div>
<div id="yiv9011599688yui_3_16_0_1_1447754426781_10723">
<div id="yiv9011599688yui_3_16_0_1_1447754426781_10722">
<div id="yiv9011599688yui_3_16_0_1_1447754426781_10721">
<div class="yiv9011599688MsoNormal" style="text-align:center;background:white;" align="center">
<span style="">
</span><hr align="center" size="1" width="100%">
</div>
<div class="yiv9011599688MsoNormal" style="background:white;"><b><span style="font-size:10.0pt;" lang="EN-US">From:</span></b><span style="font-size:10.0pt;" lang="EN-US"> Markus Schaber
<</span><span style="font-size:10.0pt;"><a rel="nofollow" shape="rect" ymailto="mailto:m.schaber@codesys.com" target="_blank" href="mailto:m.schaber@codesys.com"><span lang="EN-US">m.schaber@codesys.com</span></a></span><span style="font-size:10.0pt;" lang="EN-US">><br clear="none">
<b>To:</b> Djordje Spasic <</span><span style="font-size:10.0pt;"><a rel="nofollow" shape="rect" ymailto="mailto:issworld2000@yahoo.com" target="_blank" href="mailto:issworld2000@yahoo.com"><span lang="EN-US">issworld2000@yahoo.com</span></a></span><span style="font-size:10.0pt;" lang="EN-US">>
<br clear="none">
<b>Sent:</b> Tuesday, November 17, 2015 7:57 AM<br clear="none">
<b>Subject:</b> RE: [Ironpython-users] PINVOKE exception from loaded .NET assembly</span><span style="" lang="EN-US"></span></div>
</div>
<div id="yiv9011599688yui_3_16_0_1_1447754426781_10724">
<div class="yiv9011599688MsoNormal" style="background:white;"><span style="" lang="EN-US"><br clear="none">
</span><span style="">Hello,<br clear="none">
<br clear="none">
From: Djordje </span></div>
<div>
<div class="yiv9011599688MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style=""> </span></div>
</div>
<div id="yiv9011599688yqtfd66715">
<div class="yiv9011599688MsoNormal" style="background:white;"><span style=""><br clear="none">
<br clear="none">
> 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?</span></div>
</div>
<div class="yiv9011599688MsoNormal" style="background:white;"><span style=""><br clear="none">
<br clear="none">
Maybe you could try to access the inner exception?<br clear="none">
<br clear="none">
Best regards<br clear="none">
<br clear="none">
Markus Schaber<br clear="none">
<br clear="none">
CODESYS® a trademark of 3S-Smart Software Solutions GmbH <br clear="none">
<br clear="none">
Inspiring Automation Solutions <br clear="none">
________________________________________<br clear="none">
3S-Smart Software Solutions GmbH <br clear="none">
Dipl.-Inf. Markus Schaber | Product Development Core Technology <br clear="none">
Memminger Str. 151 | 87439 Kempten | Germany <br clear="none">
Tel. +49-831-54031-979 | Fax +49-831-54031-50 <br clear="none">
<br clear="none">
E-Mail: <a rel="nofollow" shape="rect" ymailto="mailto:m.schaber@codesys.com" target="_blank" href="mailto:m.schaber@codesys.com">m.schaber@codesys.com</a> | Web: codesys.com | CODESYS store: store.codesys.com
<br clear="none">
CODESYS forum: forum.codesys.com <br clear="none">
<br clear="none">
Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915
<br clear="none">
________________________________________<br clear="none">
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received
<br clear="none">
this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure
<br clear="none">
or distribution of the material in this e-mail is strictly forbidden. </span></div>
<div id="yiv9011599688yqtfd73341">
<div class="yiv9011599688MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style=""> </span></div>
</div>
<div class="yiv9011599688MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style=""> </span></div>
</div>
</div>
</div>
</div>
</div></div>
</div>
</div></div><br><br></div> </div> </div> </div></body></html>