[IronPython] with_statement in IronPython 2.6 Alpha

Dave Fugate dfugate at microsoft.com
Tue May 19 17:30:20 CEST 2009


-X:Python26 was removed before 2.6A1 was shipped.  This should work "out of the box" with 2.6A1:
    C:\Users\dfugate.REDMOND>"C:\Program Files\IronPython 2.6\ipy.exe"
    IronPython 2.6 Alpha 1 (2.6.0.1) on .NET 2.0.50727.3053
    Type "help", "copyright", "credits" or "license" for more information.
    >>> with file("test.log", "w") as f:
    ...     pass
    ...
    >>> ^Z

    C:\Users\dfugate.REDMOND>"C:\Program Files\IronPython 2.6\ipy.exe"
    IronPython 2.6 Alpha 1 (2.6.0.1) on .NET 2.0.50727.3053
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from __future__ import with_statement
    >>> ^Z

Elise, can you give a few more details about your setup?  Are you running an IronPython that was installed via IronPython.msi or are you using the zip file full of binaries directly?  Also, are you utilizing ipy.exe or perhaps using the DLR to host Python from C#?  Last but not least, what does %PYTHONPATH% look like on your machine?

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland
Sent: Tuesday, May 19, 2009 8:10 AM
To: Discussion of IronPython
Subject: Re: [IronPython] with_statement in IronPython 2.6 Alpha

I think you need to pass the -X:Python26 command line option in the alpha to enable this.

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Elise Langham (Elanit)
Sent: Tuesday, May 19, 2009 6:29 AM
To: users at lists.ironpython.com
Subject: [IronPython] with_statement in IronPython 2.6 Alpha

Can anyone explain to me how to use the with_statement in IronPython 2.6 ?
It is totally unrecognised as a keyword

I've tried the Iron Python 2.5 solution:

from __future__ import with_statement  which gives the error future feature is not defined:with_statement

can anyone help me ?

thanks,

  Elise
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20090519/0a7b1271/attachment.html>


More information about the Ironpython-users mailing list