I'm not sure about the error message but unfortunately 1.x doesn't expose 
Dispose as __exit__.  That's been fixed in 2.0.

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Liwei Peng
Sent: Tuesday, July 01, 2008 4:26 PM
To: [email protected]
Subject: [IronPython] how to avoid a .Net object being converted to tuple type?

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<http://MPI.NET>\Lib")
clr.AddReferenceToFile("MPI.dll")
import MPI
with MPI.Environment(argarrayref) as mpienv:
        n=100
Liwei

_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to