[IronPython] how to avoid a .Net object being converted to tuple type?
Dino Viehland
dinov at exchange.microsoft.com
Wed Jul 2 01:40:07 CEST 2008
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: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Liwei Peng
Sent: Tuesday, July 01, 2008 4:26 PM
To: users at lists.ironpython.com
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080701/6ed184a2/attachment.html>
More information about the Ironpython-users
mailing list