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

Liwei Peng liwei.peng at gmail.com
Wed Jul 2 04:22:30 CEST 2008


thanks.

Can you advise on how to use "with" statement in 2.0 beta3? I couldn't find
the __future__ module by default

thanks,

liwei

On Tue, Jul 1, 2008 at 4:40 PM, Dino Viehland <dinov at exchange.microsoft.com>
wrote:

>  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
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080701/d894e672/attachment.html>


More information about the Ironpython-users mailing list