[IronPython] how to avoid a .Net object being converted to tuple type?

Liwei Peng liwei.peng at gmail.com
Wed Jul 2 01:25:48 CEST 2008


Hi,

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.

the following is what I did:
1) write a __future__.py containing the following 2 lines:
division=1
with_statement=1

2) run my script like: ipy.exe -X:Python25 pi.py
Got error here:
Traceback (most recent call last):
  File d:\tools\IronPython-1.1.1\pi.py, line 19, in Initialize
AttributeError: 'tuple' object has no attribute '__exit__'
ERROR: MPI.Environment not finalized.
Please call Dispose() on your MPI.Environment object.

Can you tell me what's wrong with the script? can I avoid to the conversion
from MPI.Environment object to tuple? Thanks,

# This is a IronPython program to calculate PI using MPI.Net.
# Usage (For IronPython 1.1.1):
#   ipy.exe -X:Python25 pi.py

from __future__ import with_statement
import sys
import clr
import System

sys.path.append("C:\Program Files (x86)\MPI.NET\Lib")
clr.AddReferenceToFile("MPI.dll")
import MPI
with MPI.Environment(argarrayref) as mpienv:
        n=100
Liwei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080701/e3f22420/attachment.html>


More information about the Ironpython-users mailing list