<div>Hi,</div>
<div> </div>
<div>I am trying to call MPI.Net from IronPython 1.1.1 in the following script. The problem is IronPython automatically converts my MPI.Environment() object into a tuple type, so that the object cannot be disposed at the end of with statement.</div>
<div> </div>
<div>the following is what I did:</div>
<div>1) write a __future__.py containing the following 2 lines:</div>
<div>division=1<br>with_statement=1</div>
<div> </div>
<div>2) run my script like: ipy.exe -X:Python25 pi.py</div>
<div>Got error here:</div>
<div>Traceback (most recent call last):<br> File d:\tools\IronPython-1.1.1\pi.py, line 19, in Initialize<br>AttributeError: 'tuple' object has no attribute '__exit__'<br>ERROR: MPI.Environment not finalized.<br>
Please call Dispose() on your MPI.Environment object.</div>
<div> </div>
<div>Can you tell me what's wrong with the script? can I avoid to the conversion from MPI.Environment object to tuple? Thanks,</div>
<div> </div>
<div># This is a IronPython program to calculate PI using MPI.Net.<br># Usage (For IronPython 1.1.1):<br># ipy.exe -X:Python25 pi.py</div>
<p>from __future__ import with_statement<br>import sys<br>import clr<br>import System</p>
<p>sys.path.append("C:\Program Files (x86)\<a href="http://MPI.NET">MPI.NET</a>\Lib")<br>clr.AddReferenceToFile("MPI.dll")<br>import MPI</p>
<div>with MPI.Environment(argarrayref) as mpienv:<br> n=100<br></div>
<div>Liwei</div>
<div> </div>