From fernandez_dan2 at hotmail.com Mon Oct 3 18:52:34 2011 From: fernandez_dan2 at hotmail.com (Daniel Fernandez) Date: Mon, 3 Oct 2011 09:52:34 -0700 Subject: [Ironpython-users] IronPython 2.7.1 release Question Message-ID: Hi All, I was wondering if there was an estimated time frame to release IronPython 2.7.1? Thanks Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdhardy at gmail.com Mon Oct 3 20:06:38 2011 From: jdhardy at gmail.com (Jeff Hardy) Date: Mon, 3 Oct 2011 11:06:38 -0700 Subject: [Ironpython-users] IronPython 2.7.1 release Question In-Reply-To: References: Message-ID: Weird, I was just going to post that this afternoon :) The current plan is to cut another beta today or tomorrow (once I fold in the SSL patches), an RC on the 15th, and then the final 2.7.1 on the 21st. I'm setting the 21st as the hard deadline (unless the RC is completely FUBAR) because otherwise I clearly can't get anything out the door. Needless to say, this is far longer than it should have taken, and the fault is entirely my own. I apologize to those who have had good patches sitting in the tree since April without a final release. I'm going to work out a quaterly-ish release schedule from here on out, and spend some time making the release process easier. Whenever the quarter ticks around, as long as there are sufficient changes to make it worthwhile, I'll cut another release. - Jeff On Mon, Oct 3, 2011 at 9:52 AM, Daniel Fernandez wrote: > Hi All, > > I was wondering if there was an estimated time frame to release IronPython > 2.7.1? > > Thanks > > Danny > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > http://mail.python.org/mailman/listinfo/ironpython-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From slide.o.mix at gmail.com Mon Oct 3 20:14:41 2011 From: slide.o.mix at gmail.com (Slide) Date: Mon, 3 Oct 2011 11:14:41 -0700 Subject: [Ironpython-users] IronPython 2.7.1 release Question In-Reply-To: References: Message-ID: I still need to sit down and finish my zipimport implementation, I know that was something you wanted in for 2.7.1. On Oct 3, 2011 11:07 AM, "Jeff Hardy" wrote: > Weird, I was just going to post that this afternoon :) > > The current plan is to cut another beta today or tomorrow (once I fold in > the SSL patches), an RC on the 15th, and then the final 2.7.1 on the 21st. > I'm setting the 21st as the hard deadline (unless the RC is completely > FUBAR) because otherwise I clearly can't get anything out the door. > > Needless to say, this is far longer than it should have taken, and the fault > is entirely my own. I apologize to those who have had good patches sitting > in the tree since April without a final release. > > I'm going to work out a quaterly-ish release schedule from here on out, and > spend some time making the release process easier. Whenever the quarter > ticks around, as long as there are sufficient changes to make it worthwhile, > I'll cut another release. > > - Jeff > > On Mon, Oct 3, 2011 at 9:52 AM, Daniel Fernandez < fernandez_dan2 at hotmail.com >> wrote: > >> Hi All, >> >> I was wondering if there was an estimated time frame to release IronPython >> 2.7.1? >> >> Thanks >> >> Danny >> >> _______________________________________________ >> Ironpython-users mailing list >> Ironpython-users at python.org >> http://mail.python.org/mailman/listinfo/ironpython-users >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdhardy at gmail.com Mon Oct 3 20:18:48 2011 From: jdhardy at gmail.com (Jeff Hardy) Date: Mon, 3 Oct 2011 11:18:48 -0700 Subject: [Ironpython-users] IronPython 2.7.1 release Question In-Reply-To: References: Message-ID: On Mon, Oct 3, 2011 at 11:14 AM, Slide wrote: > I still need to sit down and finish my zipimport implementation, I know > that was something you wanted in for 2.7.1. > If you can get it done by the 15th, I'll take it. If not, I'll target another release for January or February (I haven't decided on 3 or 4 month cycles). - Jeff > On Oct 3, 2011 11:07 AM, "Jeff Hardy" wrote: > > Weird, I was just going to post that this afternoon :) > > > > The current plan is to cut another beta today or tomorrow (once I fold in > > the SSL patches), an RC on the 15th, and then the final 2.7.1 on the > 21st. > > I'm setting the 21st as the hard deadline (unless the RC is completely > > FUBAR) because otherwise I clearly can't get anything out the door. > > > > Needless to say, this is far longer than it should have taken, and the > fault > > is entirely my own. I apologize to those who have had good patches > sitting > > in the tree since April without a final release. > > > > I'm going to work out a quaterly-ish release schedule from here on out, > and > > spend some time making the release process easier. Whenever the quarter > > ticks around, as long as there are sufficient changes to make it > worthwhile, > > I'll cut another release. > > > > - Jeff > > > > On Mon, Oct 3, 2011 at 9:52 AM, Daniel Fernandez < > fernandez_dan2 at hotmail.com > >> wrote: > > > >> Hi All, > >> > >> I was wondering if there was an estimated time frame to release > IronPython > >> 2.7.1? > >> > >> Thanks > >> > >> Danny > >> > >> _______________________________________________ > >> Ironpython-users mailing list > >> Ironpython-users at python.org > >> http://mail.python.org/mailman/listinfo/ironpython-users > >> > >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From slide.o.mix at gmail.com Mon Oct 3 20:48:54 2011 From: slide.o.mix at gmail.com (Slide) Date: Mon, 3 Oct 2011 11:48:54 -0700 Subject: [Ironpython-users] IronPython 2.7.1 release Question In-Reply-To: References: Message-ID: I'll do my best :-) On Mon, Oct 3, 2011 at 11:18 AM, Jeff Hardy wrote: > On Mon, Oct 3, 2011 at 11:14 AM, Slide wrote: >> >> I still need to sit down and finish my zipimport implementation, I know >> that was something you wanted in for 2.7.1. > > If you can get it done by the 15th, I'll take it. If not, I'll target > another release for January or February (I haven't decided on 3 or 4 month > cycles). > - Jeff > >> >> On Oct 3, 2011 11:07 AM, "Jeff Hardy" wrote: >> > Weird, I was just going to post that this afternoon :) >> > >> > The current plan is to cut another beta today or tomorrow (once I fold >> > in >> > the SSL patches), an RC on the 15th, and then the final 2.7.1 on the >> > 21st. >> > I'm setting the 21st as the hard deadline (unless the RC is completely >> > FUBAR) because otherwise I clearly can't get anything out the door. >> > >> > Needless to say, this is far longer than it should have taken, and the >> > fault >> > is entirely my own. I apologize to those who have had good patches >> > sitting >> > in the tree since April without a final release. >> > >> > I'm going to work out a quaterly-ish release schedule from here on out, >> > and >> > spend some time making the release process easier. Whenever the quarter >> > ticks around, as long as there are sufficient changes to make it >> > worthwhile, >> > I'll cut another release. >> > >> > - Jeff >> > >> > On Mon, Oct 3, 2011 at 9:52 AM, Daniel Fernandez >> > > >> wrote: >> > >> >> Hi All, >> >> >> >> I was wondering if there was an estimated time frame to release >> >> IronPython >> >> 2.7.1? >> >> >> >> Thanks >> >> >> >> Danny >> >> >> >> _______________________________________________ >> >> Ironpython-users mailing list >> >> Ironpython-users at python.org >> >> http://mail.python.org/mailman/listinfo/ironpython-users >> >> >> >> > > -- slide-o-blog http://slide-o-blog.blogspot.com/ From tottlecp at gmx.co.uk Tue Oct 4 09:52:37 2011 From: tottlecp at gmx.co.uk (Christopher Tottle) Date: Tue, 04 Oct 2011 09:52:37 +0200 Subject: [Ironpython-users] IronPython Ubuntu 11.10 Beta 2 Message-ID: <20111004075237.198900@gmx.com> Hi All, Dose anybody know why IronPython has been removed from Ubuntu 11.10 Beta 2? as it was in Beta 1 http://www.ubuntuupdates.org/packages/show/332742 Thanks, Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: From doko at ubuntu.com Tue Oct 4 11:36:32 2011 From: doko at ubuntu.com (Matthias Klose) Date: Tue, 04 Oct 2011 11:36:32 +0200 Subject: [Ironpython-users] IronPython Ubuntu 11.10 Beta 2 In-Reply-To: <20111004075237.198900@gmx.com> References: <20111004075237.198900@gmx.com> Message-ID: <4E8AD3A0.9030201@ubuntu.com> On 10/04/2011 09:52 AM, Christopher Tottle wrote: > Hi All, > > Dose anybody know why IronPython has been removed from Ubuntu 11.10 Beta 2? as it was in Beta 1 > > http://www.ubuntuupdates.org/packages/show/332742 IronPython was built from the dlr-languages source package, which wasn't updated for the current mono version, and did fail to build from source. See https://bugs.launchpad.net/ubuntu/+source/dlr-languages/+bug/831402 If you want to provide an update/patch, please file an issue in the Ubuntu bug tracker. Matthias From doug.blank at gmail.com Tue Oct 4 12:47:58 2011 From: doug.blank at gmail.com (Doug Blank) Date: Tue, 4 Oct 2011 06:47:58 -0400 Subject: [Ironpython-users] IronPython Ubuntu 11.10 Beta 2 In-Reply-To: <4E8AD3A0.9030201@ubuntu.com> References: <20111004075237.198900@gmx.com> <4E8AD3A0.9030201@ubuntu.com> Message-ID: On Tue, Oct 4, 2011 at 5:36 AM, Matthias Klose wrote: > On 10/04/2011 09:52 AM, Christopher Tottle wrote: >> Hi All, >> >> ?Dose anybody know why IronPython has been removed from Ubuntu 11.10 Beta 2? as it was in Beta 1 >> >> ?http://www.ubuntuupdates.org/packages/show/332742 > > IronPython was built from the dlr-languages source package, which wasn't updated > for the current mono version, and did fail to build from source. > > See https://bugs.launchpad.net/ubuntu/+source/dlr-languages/+bug/831402 > > If you want to provide an update/patch, please file an issue in the Ubuntu bug > tracker. I'd really like to see dlr-languages in Ubuntu. The failure above is from the IronRuby sources. I just built ironruby yesterday from git with Mono 2.10.2, and worked fine for the regular config. Does Ubuntu need an official release to be able to include dlr-languages? Or can it be from current trunk? BTW, there is this little issue for v2Release, which I sent to the ironruby-core mailing list yesterday: """ When trying to build IronRuby for a v2Release under Mono 2.10.2, I'm getting a failure: % git clone https://github.com/IronLanguages/main.git IronLanguages % cd IronLanguages % xbuild Solutions/Ruby.sln /p:Configuration="v2Release" ... Builtins/RangeOps.cs(307,17): error CS0266: Cannot implicitly convert type `System.Collections.Generic.IEnumerable' to `System.Collections.Generic.IEnumerable'. An explicit conversion exists (are you missing a cast?) Building for the regular configuration is fine. """ Which looks like an easy fix. Then there could be a common dlr-languages release for v2 and v4. (I also have a patch that makes dlr-languages build under Mono 2.6.7, which was a reason the iron languages couldn't be added earlier, as that was the version of Mono they were using). -Doug > ?Matthias From doko at ubuntu.com Tue Oct 4 13:11:12 2011 From: doko at ubuntu.com (Matthias Klose) Date: Tue, 04 Oct 2011 13:11:12 +0200 Subject: [Ironpython-users] IronPython Ubuntu 11.10 Beta 2 In-Reply-To: References: <20111004075237.198900@gmx.com> <4E8AD3A0.9030201@ubuntu.com> Message-ID: <4E8AE9D0.9070107@ubuntu.com> On 10/04/2011 12:47 PM, Doug Blank wrote: > On Tue, Oct 4, 2011 at 5:36 AM, Matthias Klose wrote: >> On 10/04/2011 09:52 AM, Christopher Tottle wrote: >>> Hi All, >>> >>> Dose anybody know why IronPython has been removed from Ubuntu 11.10 Beta 2? as it was in Beta 1 >>> >>> http://www.ubuntuupdates.org/packages/show/332742 >> >> IronPython was built from the dlr-languages source package, which wasn't updated >> for the current mono version, and did fail to build from source. >> >> See https://bugs.launchpad.net/ubuntu/+source/dlr-languages/+bug/831402 >> >> If you want to provide an update/patch, please file an issue in the Ubuntu bug >> tracker. > > I'd really like to see dlr-languages in Ubuntu. The failure above is > from the IronRuby sources. I just built ironruby yesterday from git > with Mono 2.10.2, and worked fine for the regular config. > > Does Ubuntu need an official release to be able to include > dlr-languages? No. > Or can it be from current trunk? dlr-languages is a leaf package (no reverse dependencies or build dependencies), so it should be sae to upgrade. Best thing would be to provide a package in a PPA, or provide the updated source package. From doug.blank at gmail.com Tue Oct 4 13:36:13 2011 From: doug.blank at gmail.com (Doug Blank) Date: Tue, 4 Oct 2011 07:36:13 -0400 Subject: [Ironpython-users] IronPython Ubuntu 11.10 Beta 2 In-Reply-To: <4E8AE9D0.9070107@ubuntu.com> References: <20111004075237.198900@gmx.com> <4E8AD3A0.9030201@ubuntu.com> <4E8AE9D0.9070107@ubuntu.com> Message-ID: On Tue, Oct 4, 2011 at 7:11 AM, Matthias Klose wrote: > On 10/04/2011 12:47 PM, Doug Blank wrote: >> On Tue, Oct 4, 2011 at 5:36 AM, Matthias Klose wrote: >>> On 10/04/2011 09:52 AM, Christopher Tottle wrote: >>>> Hi All, >>>> >>>> ?Dose anybody know why IronPython has been removed from Ubuntu 11.10 Beta 2? as it was in Beta 1 >>>> >>>> ?http://www.ubuntuupdates.org/packages/show/332742 >>> >>> IronPython was built from the dlr-languages source package, which wasn't updated >>> for the current mono version, and did fail to build from source. >>> >>> See https://bugs.launchpad.net/ubuntu/+source/dlr-languages/+bug/831402 >>> >>> If you want to provide an update/patch, please file an issue in the Ubuntu bug >>> tracker. >> >> I'd really like to see dlr-languages in Ubuntu. The failure above is >> from the IronRuby sources. I just built ironruby yesterday from git >> with Mono 2.10.2, and worked fine for the regular config. >> >> Does Ubuntu need an official release to be able to include >> dlr-languages? > > No. > >> Or can it be from current trunk? > > dlr-languages is a leaf package (no reverse dependencies or build dependencies), > so it should be sae to upgrade. ?Best thing would be to provide a package in a > PPA, or provide the updated source package. > Matthias, Thanks for the information! I see from the Ubuntu launchpad issue tracker that Colin Watson has suggested that this get fixed in Debian, and I see that you are a maintainer for libdlr0.9 in Debian unstable [1]. I would like to know how to make a repository for Debian from the git dlr-languages sources, but I suspect that it could take me a bit of time to figure it out. Perhaps there is someone on this list that can quickly describe these steps in order to quickly get the dlr into Debian, and thus Ubuntu? IronLanguages builds cleanly from git with Mono 2.10.2 with standard Configuration, so this seems like it could be straightforward, with a bit of help. Any pointers appreciated, -Doug [1] - http://packages.debian.org/unstable/cli-mono/libdlr0.9-cil From jdhardy at gmail.com Wed Oct 5 07:59:33 2011 From: jdhardy at gmail.com (Jeff Hardy) Date: Tue, 4 Oct 2011 22:59:33 -0700 Subject: [Ironpython-users] IronPython 2.7.1 Beta 3 now available Message-ID: The third and final beta release of IronPython 2.7.1 is now available from http://ironpython.codeplex.com/releases/view/74454. Like IronPython 2.7, this release *requires .NET 4 or Silverlight 4.* This release will replace any existing IronPython installation. The highlights of 2.7.1 are: - Updated the standard library to match CPython 2.7.2. - Add the ast, csv, and unicodedata modules. - Fixed several bugs. - IronPython Tools for Visual Studio are disabled by default. See http://pytools.codeplex.com for the next generation of Python Visual Studio support. This release fixes even more bugs on top of what is fixed in 2.7.1 Beta 2. See the current list of fixed issues for more details. In particular, there is a fix for #26852 (ssl IE gets disconnected after request, CPython doesn't. ), so if you have SSL errors on previous IronPython versions it would be helpful to see if they are resolved with this version. In particular, the updated standard library may have introduced some undetected bugs. Please report any issues at http://ironpython.codeplex.com/workitem/list/basic. - Jeff -------------- next part -------------- An HTML attachment was scrubbed... URL: From no_reply at codeplex.com Wed Oct 5 09:49:41 2011 From: no_reply at codeplex.com (no_reply at codeplex.com) Date: 5 Oct 2011 00:49:41 -0700 Subject: [Ironpython-users] IronPython, Daily Digest 10/4/2011 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New issue] "import foo.zap as bar" throws AttributeError instead of ImportError 2. [New issue] Tracing traceback is missing line information for exception 3. [New comment] ssl IE gets disconnected after request, CPython doesn't. ---------------------------------------------- ISSUES 1. [New issue] "import foo.zap as bar" throws AttributeError instead of ImportError http://ironpython.codeplex.com/workitem/31545 User mkorpela has proposed the issue: "The exception: AttributeError: 'LightException' object has no attribute 'zap' The defacto way in python to check if some module is available is: try: import foo.zap as bar except ImportError: bar = my_dummy_function And this fails on IronPython, because an AttributeError is not an ImportError"----------------- 2. [New issue] Tracing traceback is missing line information for exception http://ironpython.codeplex.com/workitem/31547 User dinov has proposed the issue: "Run attached program, on IronPython it outputs: 0 15 On CPython it outputs: 11 15 This is because the traceback exception info is missing line information."----------------- 3. [New comment] ssl IE gets disconnected after request, CPython doesn't. http://ironpython.codeplex.com/workitem/26852 User jdhardy has commented on the issue: "Fixed in 4913ead." ---------------------------------------------- ---------------------------------------------- You are receiving this email because you subscribed to notifications on CodePlex. To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mwilsonedu at yahoo.com Thu Oct 6 00:19:21 2011 From: mwilsonedu at yahoo.com (Mark Wilson) Date: Wed, 5 Oct 2011 15:19:21 -0700 (PDT) Subject: [Ironpython-users] Help Change Python Engine Options inside Python Message-ID: <1317853161.43666.YahooMailNeo@web120525.mail.ne1.yahoo.com> Hi,? I am writing python scripts in a launched?ironpython console. I cannot use the pdb debug module because the FullFrames and Tracing were off. I cannot relaunch ipy -X:FullFrames -X:Tracing. Could you advise how to debug the scripts within the?existing?python console 2.7? Thanks in advance, Mike -------------- next part -------------- An HTML attachment was scrubbed... URL: From no_reply at codeplex.com Thu Oct 6 10:20:43 2011 From: no_reply at codeplex.com (no_reply at codeplex.com) Date: 6 Oct 2011 01:20:43 -0700 Subject: [Ironpython-users] IronPython, Daily Digest 10/5/2011 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New issue] Converting large float to int produces Int64 (which is not int or long) 2. [New comment] "import foo.zap as bar" throws AttributeError instead of ImportError 3. [New comment] IOError: Unable to write data to the transport connection: cannot access a disposed object. 4. [New comment] IOError: Unable to write data to the transport connection: cannot access a disposed object. ---------------------------------------------- ISSUES 1. [New issue] Converting large float to int produces Int64 (which is not int or long) http://ironpython.codeplex.com/workitem/31549 User mkorpela has proposed the issue: "import sys type(int(float(sys.maxint+1))) # --> Int64 This makes it hard to check if a thing is a number as it has a new type in IronPython that is not available in cPython or Jython."----------------- 2. [New comment] "import foo.zap as bar" throws AttributeError instead of ImportError http://ironpython.codeplex.com/workitem/31545 User jdhardy has commented on the issue: "It looks like IP is trying to raise the right exception (the 'LightException' object) but for some reason tries to look up 'zap' on that."----------------- 3. [New comment] IOError: Unable to write data to the transport connection: cannot access a disposed object. http://ironpython.codeplex.com/workitem/31439 User jdhardy has commented on the issue: "The SSL fixes are in the new 2.7.1 Beta 3 release. Can you give that a try and see if it fixes your issue?"----------------- 4. [New comment] IOError: Unable to write data to the transport connection: cannot access a disposed object. http://ironpython.codeplex.com/workitem/31439 User loocas has commented on the issue: "YES! Brilliant! It seems that the issue is gone! Thank you very much!" ---------------------------------------------- ---------------------------------------------- You are receiving this email because you subscribed to notifications on CodePlex. To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdhardy at gmail.com Thu Oct 6 23:08:20 2011 From: jdhardy at gmail.com (Jeff Hardy) Date: Thu, 6 Oct 2011 14:08:20 -0700 Subject: [Ironpython-users] Help Change Python Engine Options inside Python In-Reply-To: <1317853161.43666.YahooMailNeo@web120525.mail.ne1.yahoo.com> References: <1317853161.43666.YahooMailNeo@web120525.mail.ne1.yahoo.com> Message-ID: I'm pretty sure that once the Python Engine has started, the options cannot be changed. If you have VS available you could attach to the ipy process and debug using that. Calling System.Diagnostics.Debugger.Break() in your python code will trigger a breakpoint. - Jeff On Wed, Oct 5, 2011 at 3:19 PM, Mark Wilson wrote: > Hi, > I am writing python scripts in a launched?ironpython console. I cannot use > the pdb debug module because the FullFrames and Tracing were off. I cannot > relaunch ipy -X:FullFrames -X:Tracing. Could you advise how to debug the > scripts within the?existing?python console 2.7? > Thanks in advance, > Mike > > > > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > http://mail.python.org/mailman/listinfo/ironpython-users > > From no_reply at codeplex.com Fri Oct 7 12:50:50 2011 From: no_reply at codeplex.com (no_reply at codeplex.com) Date: 7 Oct 2011 03:50:50 -0700 Subject: [Ironpython-users] IronPython, Daily Digest 10/6/2011 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New comment] IOError: Unable to write data to the transport connection: cannot access a disposed object. ---------------------------------------------- ISSUES 1. [New comment] IOError: Unable to write data to the transport connection: cannot access a disposed object. http://ironpython.codeplex.com/workitem/31439 User jdhardy has commented on the issue: "Fixed in 7d354729a6." ---------------------------------------------- ---------------------------------------------- You are receiving this email because you subscribed to notifications on CodePlex. To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdhardy at gmail.com Fri Oct 7 17:39:14 2011 From: jdhardy at gmail.com (Jeff Hardy) Date: Fri, 7 Oct 2011 08:39:14 -0700 Subject: [Ironpython-users] Help Change Python Engine Options inside Python In-Reply-To: <1317993485.82249.YahooMailNeo@web120525.mail.ne1.yahoo.com> References: <1317853161.43666.YahooMailNeo@web120525.mail.ne1.yahoo.com> <1317993485.82249.YahooMailNeo@web120525.mail.ne1.yahoo.com> Message-ID: On Fri, Oct 7, 2011 at 6:18 AM, Mark Wilson wrote: > Thanks Jeff for the help. > I do have vs2010. The ipy process is?embedded?in a commercial software, > ANSYS. ?Do you know how to trigger vs2010?debugging?from python??script? The > console is?launched by ANSYS program. Add the following to your script: import System; System.Diagnostics.Debugger.Break() you may need `import clr` as well if you haven't already done so in that script. HOWEVER, I had forgotten that this requires ipy.exe to be run with -X:Debug, so it won't help you much. Your best bet would be to bug the ANSYS authors to let you set command line options for IronPython. If ANSYS just launches ipy.exe (as opposed to embedding the engine), then you could replace their ipy.exe with one that had the debug options hardcoded on; it's the IronPythonConsole project in the source tree. - Jeff From Justin.Perez at energytransfer.com Sat Oct 8 03:12:11 2011 From: Justin.Perez at energytransfer.com (Perez, Justin) Date: Sat, 8 Oct 2011 01:12:11 +0000 Subject: [Ironpython-users] Ccalling c# from python script Message-ID: <4DD5E1315FB74F4E83962C3A3CC9200B19CF9D49@sanexmbprd02.etc.lan> I would like to be able to call a C# something from a python script from IDLE or if better from ironpython. The code I need to call is below. I am fairly certain that this is VB.net so if easiest I could build this in a vb.net something. I do not know how to package this into something that could be called from python (c# or vb -.net). It would be most cool if I could call from ironpython. Thanks. Public Sub ListUniqueRecords() Dim pMyTable As ITable Dim pCurs As ICursor = Nothing Dim intFieldIdx As Integer Dim pDataStatistics As IDataStatistics Dim pEnumVar As IEnumerator Dim pWorkspaceFactory As IWorkspaceFactory Dim pWorkspace As IWorkspace Dim pFeatWorkSpace As IFeatureWorkspace Dim strMyField As String = ?VAL? Try pWorkspaceFactory = New AccessWorkspaceFactory pWorkspace = pWorkspaceFactory.OpenFromFile(?C:\MyPath\MyGDB.mdb?, 0) pFeatWorkSpace = CType(pWorkspace, IFeatureWorkspace) pMyTable = pFeatWorkSpace.OpenTable(?MyTableName?) intFieldIdx = pMyTable.FindField(strMyField) pCurs = pMyTable.Search(Nothing, True) pDataStatistics = New DataStatistics pDataStatistics.Field = strMyField pDataStatistics.Cursor = pCurs pEnumVar = CType(pDataStatistics.UniqueValues, IEnumerator) Do Until pEnumVar.MoveNext = False Debug.Print(pEnumVar.Current.ToString) Loop Catch ex As Exception Trace.WriteLine(ex.ToString) Finally ?clean up pCurs = Nothing pWorkspace = Nothing End Try End Sub ________________________________________ From: ironpython-users-bounces+justin.perez=energytransfer.com at python.org [ironpython-users-bounces+justin.perez=energytransfer.com at python.org] on behalf of ironpython-users-request at python.org [ironpython-users-request at python.org] Sent: Friday, October 07, 2011 5:00 AM To: ironpython-users at python.org Subject: Ironpython-users Digest, Vol 5, Issue 4 Send Ironpython-users mailing list submissions to ironpython-users at python.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.python.org/mailman/listinfo/ironpython-users or, via email, send a message with subject or body 'help' to ironpython-users-request at python.org You can reach the person managing the list at ironpython-users-owner at python.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Ironpython-users digest..." Today's Topics: 1. Re: Help Change Python Engine Options inside Python (Jeff Hardy) ---------------------------------------------------------------------- Message: 1 Date: Thu, 6 Oct 2011 14:08:20 -0700 From: Jeff Hardy To: Mark Wilson Cc: "ironpython-users at python.org" Subject: Re: [Ironpython-users] Help Change Python Engine Options inside Python Message-ID: Content-Type: text/plain; charset=ISO-8859-1 I'm pretty sure that once the Python Engine has started, the options cannot be changed. If you have VS available you could attach to the ipy process and debug using that. Calling System.Diagnostics.Debugger.Break() in your python code will trigger a breakpoint. - Jeff On Wed, Oct 5, 2011 at 3:19 PM, Mark Wilson wrote: > Hi, > I am writing python scripts in a launched?ironpython console. I cannot use > the pdb debug module because the FullFrames and Tracing were off. I cannot > relaunch ipy -X:FullFrames -X:Tracing. Could you advise how to debug the > scripts within the?existing?python console 2.7? > Thanks in advance, > Mike > > > > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > http://mail.python.org/mailman/listinfo/ironpython-users > > ------------------------------ _______________________________________________ Ironpython-users mailing list Ironpython-users at python.org http://mail.python.org/mailman/listinfo/ironpython-users End of Ironpython-users Digest, Vol 5, Issue 4 ********************************************** From vernondcole at gmail.com Sat Oct 8 07:39:02 2011 From: vernondcole at gmail.com (Vernon Cole) Date: Fri, 7 Oct 2011 23:39:02 -0600 Subject: [Ironpython-users] Ccalling c# from python script In-Reply-To: <4DD5E1315FB74F4E83962C3A3CC9200B19CF9D49@sanexmbprd02.etc.lan> References: <4DD5E1315FB74F4E83962C3A3CC9200B19CF9D49@sanexmbprd02.etc.lan> Message-ID: Justin: May I humbly suggest that rather than calling a very nasty Visual Basic routine, you could do the entire thing in Python more simply. The following example uses an SQL query to obtain the same information as the VB you supplied (if I understood the VB correctly.) I think you'll find the Python a bit easier to read. -- Vernon def ListUniqueRecords(): import adodbapi as db connection_string = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s' dbFile = "C:\MyPath\MyGDB.mdb" Workspace = db.connect(connection_string % dbFile) Curs = Workspace.cursor() Curs.execute('select distinct VAL from MyTableName') for val in Curs.fetchall(): print(val[0]) Curs.close() Workspace.close() if __name__ == "__main__": ListUniqueRecords() You can get adodbapi at http://sourceforge.net/projects/adodbapi/ On Fri, Oct 7, 2011 at 7:12 PM, Perez, Justin < Justin.Perez at energytransfer.com> wrote: > I would like to be able to call a C# something from a python script from > IDLE or if better from ironpython. The code I need to call is below. I am > fairly certain that this is VB.net so if easiest I could build this in a > vb.net something. I do not know how to package this into something that > could be called from python (c# or vb -.net). It would be most cool if I > could call from ironpython. Thanks. > > Public Sub ListUniqueRecords() > > Dim pMyTable As ITable > Dim pCurs As ICursor = Nothing > Dim intFieldIdx As Integer > Dim pDataStatistics As IDataStatistics > Dim pEnumVar As IEnumerator > Dim pWorkspaceFactory As IWorkspaceFactory > Dim pWorkspace As IWorkspace > Dim pFeatWorkSpace As IFeatureWorkspace > Dim strMyField As String = ?VAL? > > Try > pWorkspaceFactory = New AccessWorkspaceFactory > pWorkspace = > pWorkspaceFactory.OpenFromFile(?C:\MyPath\MyGDB.mdb?, 0) > pFeatWorkSpace = CType(pWorkspace, IFeatureWorkspace) > pMyTable = pFeatWorkSpace.OpenTable(?MyTableName?) > intFieldIdx = pMyTable.FindField(strMyField) > > pCurs = pMyTable.Search(Nothing, True) > pDataStatistics = New DataStatistics > pDataStatistics.Field = strMyField > pDataStatistics.Cursor = pCurs > > pEnumVar = CType(pDataStatistics.UniqueValues, IEnumerator) > > Do Until pEnumVar.MoveNext = False > Debug.Print(pEnumVar.Current.ToString) > Loop > > Catch ex As Exception > Trace.WriteLine(ex.ToString) > Finally > ?clean up > pCurs = Nothing > pWorkspace = Nothing > End Try > > End Sub > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Sat Oct 8 07:49:15 2011 From: vernondcole at gmail.com (Vernon Cole) Date: Fri, 7 Oct 2011 23:49:15 -0600 Subject: [Ironpython-users] Ccalling c# from python script In-Reply-To: References: <4DD5E1315FB74F4E83962C3A3CC9200B19CF9D49@sanexmbprd02.etc.lan> Message-ID: I spotted the error just after I hit "Send" ... line 4 should have escaped the backslashes in the Windows-format filename string, like: dbFile = r"C:\MyPath\MyGDB.mdb" or alternatively, use forward slashes dbFile = "C:/MyPath/MyGDB.mdb" -- Vernon On Fri, Oct 7, 2011 at 11:39 PM, Vernon Cole wrote: > Justin: > May I humbly suggest that rather than calling a very nasty Visual Basic > routine, you could do the entire thing in Python more simply. > The following example uses an SQL query to obtain the same information as > the VB you supplied (if I understood the VB correctly.) > I think you'll find the Python a bit easier to read. > -- > Vernon > > def ListUniqueRecords(): > import adodbapi as db > connection_string = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s' > dbFile = "C:\MyPath\MyGDB.mdb" > -------------- next part -------------- An HTML attachment was scrubbed... URL: From no_reply at codeplex.com Sat Oct 8 12:48:49 2011 From: no_reply at codeplex.com (no_reply at codeplex.com) Date: 8 Oct 2011 03:48:49 -0700 Subject: [Ironpython-users] IronPython, Daily Digest 10/7/2011 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New issue] ipy -c "import re; print re.sub('a', 'b', 'a', -1)" works differently than in cpython ---------------------------------------------- ISSUES 1. [New issue] ipy -c "import re; print re.sub('a', 'b', 'a', -1)" works differently than in cpython http://ironpython.codeplex.com/workitem/31560 User mkorpela has proposed the issue: "ipy -c "import re; print re.sub('a', 'b', 'a', -1)" ---> b python -c "import re; print re.sub('a', 'b', 'a', -1)" ---> a Negative count in re module works differently than in cPython or Jython. Positive and 0 count work correctly." ---------------------------------------------- ---------------------------------------------- You are receiving this email because you subscribed to notifications on CodePlex. To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.schaber at 3s-software.com Mon Oct 10 16:53:20 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Mon, 10 Oct 2011 14:53:20 +0000 Subject: [Ironpython-users] Utility function for encoding detection Message-ID: <727D8E16AE957149B447FE368139F2B502C270@SERVER10.in.3s-software.com> Hi, For our embedded IronPython, we need to convert python scripts from string to files and back. To do that, I need to know the encoding of the python source for both ways, if there's one specified according to PEP 0263. (Our intended fallback is to UTF8 with BOM if none is specified.) Are there any public utility functions in IronPython I can call to detect encoding markers in files and in strings? Best regards Markus Schaber -- ___________________________ We software Automation. 3S-Smart Software Solutions GmbH Markus Schaber | Developer Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax +49-831-54031-50 Email: m.schaber at 3s-software.com | Web: http://www.3s-software.com CoDeSys internet forum: http://forum.3s-software.com Download CoDeSys sample projects: http://www.3s-software.com/index.shtml?sample_projects Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 From mfoord at python.org Mon Oct 10 17:42:59 2011 From: mfoord at python.org (Michael Foord) Date: Mon, 10 Oct 2011 16:42:59 +0100 Subject: [Ironpython-users] Utility function for encoding detection In-Reply-To: <727D8E16AE957149B447FE368139F2B502C270@SERVER10.in.3s-software.com> References: <727D8E16AE957149B447FE368139F2B502C270@SERVER10.in.3s-software.com> Message-ID: <4E931283.4040105@python.org> On 10/10/2011 15:53, Markus Schaber wrote: > Hi, > > For our embedded IronPython, we need to convert python scripts from string to files and back. To do that, I need to know the encoding of the python source for both ways, if there's one specified according to PEP 0263. (Our intended fallback is to UTF8 with BOM if none is specified.) > > Are there any public utility functions in IronPython I can call to detect encoding markers in files and in strings? Python 3 has a "detect_encoding" function in the tokenize module that does this. You could copy and reuse that. Michael Foord > Best regards > > Markus Schaber -- http://www.voidspace.org.uk/ May you do good and not evil May you find forgiveness for yourself and forgive others May you share freely, never taking more than you give. -- the sqlite blessing http://www.sqlite.org/different.html From no_reply at codeplex.com Tue Oct 11 12:44:17 2011 From: no_reply at codeplex.com (no_reply at codeplex.com) Date: 11 Oct 2011 03:44:17 -0700 Subject: [Ironpython-users] IronPython, Daily Digest 10/10/2011 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New comment] Implement _elementtree module 2. [New comment] ValueError: unmarshallable object 3. [New comment] 'x'.replace(u'\uFFFE','') -> ValueError 4. [New comment] print u'\xe4'.encode(sys.stdout.encoding) -> ? 5. [New comment] os.path.abspath('*') -> ValueError 6. [New issue] Module __doc__ is None when using `ipy -m module.py` 7. [New comment] Module __doc__ is None when using `ipy -m module.py` 8. [New comment] Module __doc__ is None when using `ipy -m module.py` ---------------------------------------------- ISSUES 1. [New comment] Implement _elementtree module http://ironpython.codeplex.com/workitem/21407 User pekkaklarck has commented on the issue: "I'm surprised this issue is considered low priority because not having a working ElementTree implementation in IronPython is a big blocker for many Python programs. I know this is an open source project with limited resources but in this case there already is a working implementation that ought to be easy to take into use (see my nearly a year old comment above about ET 1.2.7). What's worse than not having ET is having an implementation that can be imported but not used. This means that even if you install a working ET, any code that uses the "standard" way to conditionally import ET (see e.g. http://lxml.de/tutorial.html) still doesn't work because you end up getting a broken ET implementation anyway."----------------- 2. [New comment] ValueError: unmarshallable object http://ironpython.codeplex.com/workitem/26489 User pekkaklarck has commented on the issue: "I noticed that with IPY 2.7 you don't need --no-compile anymore. Apparently the compilation step in setup.py is just skipped."----------------- 3. [New comment] 'x'.replace(u'\uFFFE','') -> ValueError http://ironpython.codeplex.com/workitem/29402 User pekkaklarck has commented on the issue: "Seems to be fixed in IPY 2.7."----------------- 4. [New comment] print u'\xe4'.encode(sys.stdout.encoding) -> ? http://ironpython.codeplex.com/workitem/29487 User pekkaklarck has commented on the issue: "This occurs also with IPY 2.7. Notice that sys.stdout.encoding is cp437 both with IronPython and CPython. Some more experimenting below: D:\>ipy IronPython 2.7 (2.7.0.40) on .NET 4.0.30319.237 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.stdout.encoding 'cp437' >>> a = u'\xe4'.encode(_) >>> a u'\x84' # should be just '\x84' >>> print a ? >>> ^Z D:\>python Python 2.7 (r27:82525, Jul 4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.stdout.encoding 'cp437' >>> a = u'\xe4'.encode(_) >>> a '\x84' >>> print a ? >>>"----------------- 5. [New comment] os.path.abspath('*') -> ValueError http://ironpython.codeplex.com/workitem/29489 User pekkaklarck has commented on the issue: "Occurs also with IPY 2.7."----------------- 6. [New issue] Module __doc__ is None when using `ipy -m module.py` http://ironpython.codeplex.com/workitem/31570 User pekkaklarck has proposed the issue: "The problem is demonstrated by the example below. It occurs both with IPY 2.6.2 and 2.7. D:\>type mymod.py """Hello, Kitty!""" print "Greeting:", __doc__ D:\>ipy mymod.py Greeting: Hello, Kitty! D:\>ipy -m mymod Greeting: None D:\>python -m mymod Greeting: Hello, Kitty!"----------------- 7. [New comment] Module __doc__ is None when using `ipy -m module.py` http://ironpython.codeplex.com/workitem/31570 User pekkaklarck has commented on the issue: "Because of this problem you cannot start Robot Framework (http://robotframework.py) like `ipy -m robot.runner` like you can with Python and Jython. We can add a workaround for this in future releases but that's still pretty annoying."----------------- 8. [New comment] Module __doc__ is None when using `ipy -m module.py` http://ironpython.codeplex.com/workitem/31570 User pekkaklarck has commented on the issue: "Ooops, it's obviously http://robotframework.org. There are separate instructions to get it working with IronPython [1] and we plan to ease the installation in RF 2.7 release (and having this particular bug fixed would help). [1] http://code.google.com/p/robotframework/wiki/DotNetSupport" ---------------------------------------------- ---------------------------------------------- You are receiving this email because you subscribed to notifications on CodePlex. To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.schaber at 3s-software.com Tue Oct 11 18:13:24 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Tue, 11 Oct 2011 16:13:24 +0000 Subject: [Ironpython-users] Warn user when using old print syntax Message-ID: <727D8E16AE957149B447FE368139F2B502C476@SERVER10.in.3s-software.com> Hi, What is the easiest way to detect and warn the user when he uses the old print syntax? It seems that "-3" aka "WarnPy3k" does not warn about it, and a simple check whether the user does "from __future__ import print_function" gives false positives if the user does not print at all. Thanks! Best regards Markus Schaber -- ___________________________ We software Automation. 3S-Smart Software Solutions GmbH Markus Schaber | Developer Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax +49-831-54031-50 Email: m.schaber at 3s-software.com | Web: http://www.3s-software.com CoDeSys internet forum: http://forum.3s-software.com Download CoDeSys sample projects: http://www.3s-software.com/index.shtml?sample_projects Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 From jdhardy at gmail.com Tue Oct 11 18:25:38 2011 From: jdhardy at gmail.com (Jeff Hardy) Date: Tue, 11 Oct 2011 09:25:38 -0700 Subject: [Ironpython-users] Warn user when using old print syntax In-Reply-To: <727D8E16AE957149B447FE368139F2B502C476@SERVER10.in.3s-software.com> References: <727D8E16AE957149B447FE368139F2B502C476@SERVER10.in.3s-software.com> Message-ID: I think you'd have to patch the code to add the print check to the -3 warnings. Dino might be able to point out where you would do that. - Jeff On Tue, Oct 11, 2011 at 9:13 AM, Markus Schaber wrote: > Hi, > > What is the easiest way to detect and warn the user when he uses the old print syntax? > > It seems that "-3" aka "WarnPy3k" does not warn about it, and a simple check whether the user does "from __future__ import print_function" gives false positives if the user does not print at all. > > Thanks! > > Best regards > > Markus Schaber > -- > ___________________________ > We software Automation. > > 3S-Smart Software Solutions GmbH > Markus Schaber | Developer > Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax +49-831-54031-50 > > Email: m.schaber at 3s-software.com | Web: http://www.3s-software.com > CoDeSys internet forum: http://forum.3s-software.com > Download CoDeSys sample projects: http://www.3s-software.com/index.shtml?sample_projects > > Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 > > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > http://mail.python.org/mailman/listinfo/ironpython-users > From dinov at microsoft.com Tue Oct 11 20:53:27 2011 From: dinov at microsoft.com (Dino Viehland) Date: Tue, 11 Oct 2011 18:53:27 +0000 Subject: [Ironpython-users] Warn user when using old print syntax In-Reply-To: References: <727D8E16AE957149B447FE368139F2B502C476@SERVER10.in.3s-software.com> Message-ID: <6C7ABA8B4E309440B857D74348836F2E3F7A79C9@TK5EX14MBXC293.redmond.corp.microsoft.com> So you want to warn if the file contains a print statement w/o from __future__ import print_function? What if it's a call to print such as print('foo') which is valid in both 2.x and 3.x? Either way you should be able to just update ParsePrintStmt in Parser.cs. But dealing w/ the case of the parens would be a little more difficult - but I think you can just peek at the next token after print and see if it's a parenthesis right after we eat the print keyword. -----Original Message----- From: Jeff Hardy [mailto:jdhardy at gmail.com] Sent: Tuesday, October 11, 2011 9:26 AM To: Markus Schaber; Dino Viehland Cc: ironpython-users at python.org Subject: Re: [Ironpython-users] Warn user when using old print syntax I think you'd have to patch the code to add the print check to the -3 warnings. Dino might be able to point out where you would do that. - Jeff On Tue, Oct 11, 2011 at 9:13 AM, Markus Schaber wrote: > Hi, > > What is the easiest way to detect and warn the user when he uses the old print syntax? > > It seems that "-3" aka "WarnPy3k" does not warn about it, and a simple check whether the user does "from __future__ import print_function" gives false positives if the user does not print at all. > > Thanks! > > Best regards > > Markus Schaber > -- > ___________________________ > We software Automation. > > 3S-Smart Software Solutions GmbH > Markus Schaber | Developer > Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | > Fax +49-831-54031-50 > > Email: m.schaber at 3s-software.com | Web: http://www.3s-software.com > CoDeSys internet forum: http://forum.3s-software.com Download CoDeSys > sample projects: > http://www.3s-software.com/index.shtml?sample_projects > > Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | > Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 > > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > http://mail.python.org/mailman/listinfo/ironpython-users > From Tsahi.Muyal at kla-tencor.com Tue Oct 11 18:12:49 2011 From: Tsahi.Muyal at kla-tencor.com (Muyal,Tsahi) Date: Tue, 11 Oct 2011 18:12:49 +0200 Subject: [Ironpython-users] .NET Remoting and Interface based objects Message-ID: <7285703A69D4DE44A36406A8F8118863701D1C@BEL1EXCLV03.adcorp.kla-tencor.com> Hi, I am trying to call our .NET service via remoting using IronPython I have the transparent proxy object but I don't know how to cast it to the interfaces (that are implemented by the server side object) I tried IServerInterface.SomeMethod(transparent-proxy-object) but it is failing with "expected IServerInterface, got MarshalByRefObject" How can I cast it to an interface? I am using 2.7 Thanks in advance, Tsahi Muyal -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Tue Oct 11 22:58:12 2011 From: dinov at microsoft.com (Dino Viehland) Date: Tue, 11 Oct 2011 20:58:12 +0000 Subject: [Ironpython-users] .NET Remoting and Interface based objects In-Reply-To: <7285703A69D4DE44A36406A8F8118863701D1C@BEL1EXCLV03.adcorp.kla-tencor.com> References: <7285703A69D4DE44A36406A8F8118863701D1C@BEL1EXCLV03.adcorp.kla-tencor.com> Message-ID: <6C7ABA8B4E309440B857D74348836F2E3F7A900B@TK5EX14MBXC293.redmond.corp.microsoft.com> I'm not quite certain this is the same issue but you should try using the wrapper from this thread: http://lists.ironpython.com/pipermail/users-ironpython.com/2006-September/003549.html The transparent proxies always succeed when casting them to an interface type so it's hard for us to work w/ the objects when we need to check for certain interfaces ourselves. From: ironpython-users-bounces+dinov=microsoft.com at python.org [mailto:ironpython-users-bounces+dinov=microsoft.com at python.org] On Behalf Of Muyal,Tsahi Sent: Tuesday, October 11, 2011 9:13 AM To: ironpython-users at python.org Subject: [Ironpython-users] .NET Remoting and Interface based objects Hi, I am trying to call our .NET service via remoting using IronPython I have the transparent proxy object but I don't know how to cast it to the interfaces (that are implemented by the server side object) I tried IServerInterface.SomeMethod(transparent-proxy-object) but it is failing with "expected IServerInterface, got MarshalByRefObject" How can I cast it to an interface? I am using 2.7 Thanks in advance, Tsahi Muyal -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Tue Oct 11 23:45:31 2011 From: dinov at microsoft.com (Dino Viehland) Date: Tue, 11 Oct 2011 21:45:31 +0000 Subject: [Ironpython-users] .NET Remoting and Interface based objects In-Reply-To: <7285703A69D4DE44A36406A8F8118863701DAD@BEL1EXCLV03.adcorp.kla-tencor.com> References: <7285703A69D4DE44A36406A8F8118863701D1C@BEL1EXCLV03.adcorp.kla-tencor.com> <6C7ABA8B4E309440B857D74348836F2E3F7A900B@TK5EX14MBXC293.redmond.corp.microsoft.com> <7285703A69D4DE44A36406A8F8118863701DAD@BEL1EXCLV03.adcorp.kla-tencor.com> Message-ID: <6C7ABA8B4E309440B857D74348836F2E3F7A91E8@TK5EX14MBXC293.redmond.corp.microsoft.com> Hurm, maybe this is a different problem then... Does: import clr clr.Convert(TransparentProxy, IServerInterface).IServerInterfaceMethod() work? If not then my guess is you might need a C# wrapper :( From: Muyal,Tsahi [mailto:Tsahi.Muyal at kla-tencor.com] Sent: Tuesday, October 11, 2011 2:39 PM To: Dino Viehland Cc: ironpython-users at python.org Subject: RE: .NET Remoting and Interface based objects I tried using typedproxy class Not sure I am using it the right way This is what I did test = typedproxy(TransparentProxy, IServerInterface) test.IServerInterfaceMethod() This call is failing with "Expected IServerInterface, got MarshalByRefObject" I debugged the code to find out where it is failing, it is in typedproxy (I marked the line) class typedproxy(object): __slots__ = ['obj', 'proxyType'] def __init__(self, obj, proxyType): self.proxyType = proxyType self.obj = obj def __getattribute__(self, attr): proxyType = object.__getattribute__(self, 'proxyType') obj = object.__getattribute__(self, 'obj') att = getattr(proxyType, attr) att2 = att.__get__(obj, proxyType) #This line is throwing the exception return att2 Any idea? Thank you very much; Tsahi Muyal From: Dino Viehland [mailto:dinov at microsoft.com] Sent: Tuesday, October 11, 2011 10:58 PM To: Muyal,Tsahi; ironpython-users at python.org Subject: RE: .NET Remoting and Interface based objects I'm not quite certain this is the same issue but you should try using the wrapper from this thread: http://lists.ironpython.com/pipermail/users-ironpython.com/2006-September/003549.html The transparent proxies always succeed when casting them to an interface type so it's hard for us to work w/ the objects when we need to check for certain interfaces ourselves. From: ironpython-users-bounces+dinov=microsoft.com at python.org [mailto:ironpython-users-bounces+dinov=microsoft.com at python.org] On Behalf Of Muyal,Tsahi Sent: Tuesday, October 11, 2011 9:13 AM To: ironpython-users at python.org Subject: [Ironpython-users] .NET Remoting and Interface based objects Hi, I am trying to call our .NET service via remoting using IronPython I have the transparent proxy object but I don't know how to cast it to the interfaces (that are implemented by the server side object) I tried IServerInterface.SomeMethod(transparent-proxy-object) but it is failing with "expected IServerInterface, got MarshalByRefObject" How can I cast it to an interface? I am using 2.7 Thanks in advance, Tsahi Muyal -------------- next part -------------- An HTML attachment was scrubbed... URL: From Tsahi.Muyal at kla-tencor.com Tue Oct 11 23:38:51 2011 From: Tsahi.Muyal at kla-tencor.com (Muyal,Tsahi) Date: Tue, 11 Oct 2011 23:38:51 +0200 Subject: [Ironpython-users] .NET Remoting and Interface based objects In-Reply-To: <6C7ABA8B4E309440B857D74348836F2E3F7A900B@TK5EX14MBXC293.redmond.corp.microsoft.com> References: <7285703A69D4DE44A36406A8F8118863701D1C@BEL1EXCLV03.adcorp.kla-tencor.com> <6C7ABA8B4E309440B857D74348836F2E3F7A900B@TK5EX14MBXC293.redmond.corp.microsoft.com> Message-ID: <7285703A69D4DE44A36406A8F8118863701DAD@BEL1EXCLV03.adcorp.kla-tencor.com> I tried using typedproxy class Not sure I am using it the right way This is what I did test = typedproxy(TransparentProxy, IServerInterface) test.IServerInterfaceMethod() This call is failing with "Expected IServerInterface, got MarshalByRefObject" I debugged the code to find out where it is failing, it is in typedproxy (I marked the line) class typedproxy(object): __slots__ = ['obj', 'proxyType'] def __init__(self, obj, proxyType): self.proxyType = proxyType self.obj = obj def __getattribute__(self, attr): proxyType = object.__getattribute__(self, 'proxyType') obj = object.__getattribute__(self, 'obj') att = getattr(proxyType, attr) att2 = att.__get__(obj, proxyType) #This line is throwing the exception return att2 Any idea? Thank you very much; Tsahi Muyal From: Dino Viehland [mailto:dinov at microsoft.com] Sent: Tuesday, October 11, 2011 10:58 PM To: Muyal,Tsahi; ironpython-users at python.org Subject: RE: .NET Remoting and Interface based objects I'm not quite certain this is the same issue but you should try using the wrapper from this thread: http://lists.ironpython.com/pipermail/users-ironpython.com/2006-Septembe r/003549.html The transparent proxies always succeed when casting them to an interface type so it's hard for us to work w/ the objects when we need to check for certain interfaces ourselves. From: ironpython-users-bounces+dinov=microsoft.com at python.org [mailto:ironpython-users-bounces+dinov=microsoft.com at python.org] On Behalf Of Muyal,Tsahi Sent: Tuesday, October 11, 2011 9:13 AM To: ironpython-users at python.org Subject: [Ironpython-users] .NET Remoting and Interface based objects Hi, I am trying to call our .NET service via remoting using IronPython I have the transparent proxy object but I don't know how to cast it to the interfaces (that are implemented by the server side object) I tried IServerInterface.SomeMethod(transparent-proxy-object) but it is failing with "expected IServerInterface, got MarshalByRefObject" How can I cast it to an interface? I am using 2.7 Thanks in advance, Tsahi Muyal -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Wed Oct 12 00:19:47 2011 From: dinov at microsoft.com (Dino Viehland) Date: Tue, 11 Oct 2011 22:19:47 +0000 Subject: [Ironpython-users] .NET Remoting and Interface based objects In-Reply-To: <7285703A69D4DE44A36406A8F8118863701DB1@BEL1EXCLV03.adcorp.kla-tencor.com> References: <7285703A69D4DE44A36406A8F8118863701D1C@BEL1EXCLV03.adcorp.kla-tencor.com> <6C7ABA8B4E309440B857D74348836F2E3F7A900B@TK5EX14MBXC293.redmond.corp.microsoft.com> <7285703A69D4DE44A36406A8F8118863701DAD@BEL1EXCLV03.adcorp.kla-tencor.com> <6C7ABA8B4E309440B857D74348836F2E3F7A91E8@TK5EX14MBXC293.redmond.corp.microsoft.com> <7285703A69D4DE44A36406A8F8118863701DB1@BEL1EXCLV03.adcorp.kla-tencor.com> Message-ID: <6C7ABA8B4E309440B857D74348836F2E3F7A9306@TK5EX14MBXC293.redmond.corp.microsoft.com> The C# wrapper could be as simple as: public static class MyWrapper { public static void IServerInterfaceMethod(object o) { ((IServerInterface)o).IServerInterfaceMethod(); } } Used like: MyWrapper.IServerInterfaceMethod(TransparentProxy) If you just want to call all static methods, or you can make an instance wrapper: public class MyWrapper { private readonly IServerInterface _wrapped; public MyWrapper(object wrapped) { _wrapped = (IServerInterface)wrapped; } public void IServerInterfaceMethod(object o) { _wrapped.IServerInterfaceMethod(); } } Used like: MyWrapper(TransparentProxy).IServerInterfaceMethod() Then you can pass around the wrapper object and just use it like a normal object. If you need to get back to the transparent proxy for some reason you could add a property which returns it. From: Muyal,Tsahi [mailto:Tsahi.Muyal at kla-tencor.com] Sent: Tuesday, October 11, 2011 3:01 PM To: Dino Viehland Cc: ironpython-users at python.org Subject: RE: .NET Remoting and Interface based objects The clr.Convert(TransparentProxy, IServerInterface) is failing with same exception I will code a C# wrapper but what does it mean? A client side assembly that will get the transparent proxy and convert it to the Interface type I need? Tsahi Muyal Corporate Platform Group(CPG) KLA-Tencor Israel From: Dino Viehland [mailto:dinov at microsoft.com] Sent: Tuesday, October 11, 2011 11:46 PM To: Muyal,Tsahi Cc: ironpython-users at python.org Subject: RE: .NET Remoting and Interface based objects Hurm, maybe this is a different problem then... Does: import clr clr.Convert(TransparentProxy, IServerInterface).IServerInterfaceMethod() work? If not then my guess is you might need a C# wrapper :( From: Muyal,Tsahi [mailto:Tsahi.Muyal at kla-tencor.com] Sent: Tuesday, October 11, 2011 2:39 PM To: Dino Viehland Cc: ironpython-users at python.org Subject: RE: .NET Remoting and Interface based objects I tried using typedproxy class Not sure I am using it the right way This is what I did test = typedproxy(TransparentProxy, IServerInterface) test.IServerInterfaceMethod() This call is failing with "Expected IServerInterface, got MarshalByRefObject" I debugged the code to find out where it is failing, it is in typedproxy (I marked the line) class typedproxy(object): __slots__ = ['obj', 'proxyType'] def __init__(self, obj, proxyType): self.proxyType = proxyType self.obj = obj def __getattribute__(self, attr): proxyType = object.__getattribute__(self, 'proxyType') obj = object.__getattribute__(self, 'obj') att = getattr(proxyType, attr) att2 = att.__get__(obj, proxyType) #This line is throwing the exception return att2 Any idea? Thank you very much; Tsahi Muyal From: Dino Viehland [mailto:dinov at microsoft.com] Sent: Tuesday, October 11, 2011 10:58 PM To: Muyal,Tsahi; ironpython-users at python.org Subject: RE: .NET Remoting and Interface based objects I'm not quite certain this is the same issue but you should try using the wrapper from this thread: http://lists.ironpython.com/pipermail/users-ironpython.com/2006-September/003549.html The transparent proxies always succeed when casting them to an interface type so it's hard for us to work w/ the objects when we need to check for certain interfaces ourselves. From: ironpython-users-bounces+dinov=microsoft.com at python.org [mailto:ironpython-users-bounces+dinov=microsoft.com at python.org] On Behalf Of Muyal,Tsahi Sent: Tuesday, October 11, 2011 9:13 AM To: ironpython-users at python.org Subject: [Ironpython-users] .NET Remoting and Interface based objects Hi, I am trying to call our .NET service via remoting using IronPython I have the transparent proxy object but I don't know how to cast it to the interfaces (that are implemented by the server side object) I tried IServerInterface.SomeMethod(transparent-proxy-object) but it is failing with "expected IServerInterface, got MarshalByRefObject" How can I cast it to an interface? I am using 2.7 Thanks in advance, Tsahi Muyal -------------- next part -------------- An HTML attachment was scrubbed... URL: From Tsahi.Muyal at kla-tencor.com Wed Oct 12 00:00:41 2011 From: Tsahi.Muyal at kla-tencor.com (Muyal,Tsahi) Date: Wed, 12 Oct 2011 00:00:41 +0200 Subject: [Ironpython-users] .NET Remoting and Interface based objects In-Reply-To: <6C7ABA8B4E309440B857D74348836F2E3F7A91E8@TK5EX14MBXC293.redmond.corp.microsoft.com> References: <7285703A69D4DE44A36406A8F8118863701D1C@BEL1EXCLV03.adcorp.kla-tencor.com> <6C7ABA8B4E309440B857D74348836F2E3F7A900B@TK5EX14MBXC293.redmond.corp.microsoft.com> <7285703A69D4DE44A36406A8F8118863701DAD@BEL1EXCLV03.adcorp.kla-tencor.com> <6C7ABA8B4E309440B857D74348836F2E3F7A91E8@TK5EX14MBXC293.redmond.corp.microsoft.com> Message-ID: <7285703A69D4DE44A36406A8F8118863701DB1@BEL1EXCLV03.adcorp.kla-tencor.com> The clr.Convert(TransparentProxy, IServerInterface) is failing with same exception I will code a C# wrapper but what does it mean? A client side assembly that will get the transparent proxy and convert it to the Interface type I need? Tsahi Muyal Corporate Platform Group(CPG) KLA-Tencor Israel From: Dino Viehland [mailto:dinov at microsoft.com] Sent: Tuesday, October 11, 2011 11:46 PM To: Muyal,Tsahi Cc: ironpython-users at python.org Subject: RE: .NET Remoting and Interface based objects Hurm, maybe this is a different problem then... Does: import clr clr.Convert(TransparentProxy, IServerInterface).IServerInterfaceMethod() work? If not then my guess is you might need a C# wrapper L From: Muyal,Tsahi [mailto:Tsahi.Muyal at kla-tencor.com] Sent: Tuesday, October 11, 2011 2:39 PM To: Dino Viehland Cc: ironpython-users at python.org Subject: RE: .NET Remoting and Interface based objects I tried using typedproxy class Not sure I am using it the right way This is what I did test = typedproxy(TransparentProxy, IServerInterface) test.IServerInterfaceMethod() This call is failing with "Expected IServerInterface, got MarshalByRefObject" I debugged the code to find out where it is failing, it is in typedproxy (I marked the line) class typedproxy(object): __slots__ = ['obj', 'proxyType'] def __init__(self, obj, proxyType): self.proxyType = proxyType self.obj = obj def __getattribute__(self, attr): proxyType = object.__getattribute__(self, 'proxyType') obj = object.__getattribute__(self, 'obj') att = getattr(proxyType, attr) att2 = att.__get__(obj, proxyType) #This line is throwing the exception return att2 Any idea? Thank you very much; Tsahi Muyal From: Dino Viehland [mailto:dinov at microsoft.com] Sent: Tuesday, October 11, 2011 10:58 PM To: Muyal,Tsahi; ironpython-users at python.org Subject: RE: .NET Remoting and Interface based objects I'm not quite certain this is the same issue but you should try using the wrapper from this thread: http://lists.ironpython.com/pipermail/users-ironpython.com/2006-Septembe r/003549.html The transparent proxies always succeed when casting them to an interface type so it's hard for us to work w/ the objects when we need to check for certain interfaces ourselves. From: ironpython-users-bounces+dinov=microsoft.com at python.org [mailto:ironpython-users-bounces+dinov=microsoft.com at python.org] On Behalf Of Muyal,Tsahi Sent: Tuesday, October 11, 2011 9:13 AM To: ironpython-users at python.org Subject: [Ironpython-users] .NET Remoting and Interface based objects Hi, I am trying to call our .NET service via remoting using IronPython I have the transparent proxy object but I don't know how to cast it to the interfaces (that are implemented by the server side object) I tried IServerInterface.SomeMethod(transparent-proxy-object) but it is failing with "expected IServerInterface, got MarshalByRefObject" How can I cast it to an interface? I am using 2.7 Thanks in advance, Tsahi Muyal -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.schaber at 3s-software.com Wed Oct 12 08:58:17 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Wed, 12 Oct 2011 06:58:17 +0000 Subject: [Ironpython-users] Warn user when using old print syntax In-Reply-To: <6C7ABA8B4E309440B857D74348836F2E3F7A79C9@TK5EX14MBXC293.redmond.corp.microsoft.com> References: <727D8E16AE957149B447FE368139F2B502C476@SERVER10.in.3s-software.com> <6C7ABA8B4E309440B857D74348836F2E3F7A79C9@TK5EX14MBXC293.redmond.corp.microsoft.com> Message-ID: <727D8E16AE957149B447FE368139F2B502C537@SERVER10.in.3s-software.com> Hi, Dino, Von: Dino Viehland [mailto:dinov at microsoft.com] > So you want to warn if the file contains a print statement w/o from > __future__ import print_function? What if it's a call to print such as > print('foo') which is valid in both 2.x and 3.x? Considering our user base, I could ignore this corner case, as the user can simply get rid of the warning by adding the import statement. > Either way you should be able to just update ParsePrintStmt in Parser.cs. > But dealing w/ the case of the parens would be a little more difficult - > but I think you can just peek at the next token after print and see if it's > a parenthesis right after we eat the print keyword. Ok, I'll see whether I can do that. Best regards Markus Schaber -- ___________________________ We software Automation. 3S-Smart Software Solutions GmbH Markus Schaber | Developer Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax +49-831-54031-50 Email: m.schaber at 3s-software.com | Web: http://www.3s-software.com CoDeSys internet forum: http://forum.3s-software.com Download CoDeSys sample projects: http://www.3s-software.com/index.shtml?sample_projects Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 From m.schaber at 3s-software.com Wed Oct 12 09:27:31 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Wed, 12 Oct 2011 07:27:31 +0000 Subject: [Ironpython-users] ErrorListener Message-ID: <727D8E16AE957149B447FE368139F2B502C56B@SERVER10.in.3s-software.com> Hi, Sorry for disturbing again, but I'm a little bit confused about the ErrorListeners from the Hosting API. For compilation of a ScriptSource, I can pass an ErrorListener which gets the errors and warnings, but it seems that I cannot pass an ErrorListener for the execution of the ScriptSource. My guess is that the ErrorListener passed to the compilation is referenced from the compiled ScriptSource. Can you confirm hat? Or did I miss something? Best regards Markus Schaber -- ___________________________ We software Automation. 3S-Smart Software Solutions GmbH Markus Schaber | Developer Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax +49-831-54031-50 Email: m.schaber at 3s-software.com | Web: http://www.3s-software.com CoDeSys internet forum: http://forum.3s-software.com Download CoDeSys sample projects: http://www.3s-software.com/index.shtml?sample_projects Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 From m.schaber at 3s-software.com Wed Oct 12 10:55:41 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Wed, 12 Oct 2011 08:55:41 +0000 Subject: [Ironpython-users] ErrorListener In-Reply-To: <727D8E16AE957149B447FE368139F2B502C56B@SERVER10.in.3s-software.com> References: <727D8E16AE957149B447FE368139F2B502C56B@SERVER10.in.3s-software.com> Message-ID: <727D8E16AE957149B447FE368139F2B502C596@SERVER10.in.3s-software.com> Hi, Von: Markus Schaber > Sorry for disturbing again, but I'm a little bit confused about the > ErrorListeners from the Hosting API. > > For compilation of a ScriptSource, I can pass an ErrorListener which gets > the errors and warnings, but it seems that I cannot pass an ErrorListener > for the execution of the ScriptSource. > > My guess is that the ErrorListener passed to the compilation is referenced > from the compiled ScriptSource. Can you confirm hat? Or did I miss > something? This guess seems wrong - it seems that the warnings are simply spit out on stderr by default. Best regards Markus Schaber -- ___________________________ We software Automation. 3S-Smart Software Solutions GmbH Markus Schaber | Developer Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax +49-831-54031-50 Email: m.schaber at 3s-software.com | Web: http://www.3s-software.com CoDeSys internet forum: http://forum.3s-software.com Download CoDeSys sample projects: http://www.3s-software.com/index.shtml?sample_projects Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 From no_reply at codeplex.com Wed Oct 12 14:44:10 2011 From: no_reply at codeplex.com (no_reply at codeplex.com) Date: 12 Oct 2011 05:44:10 -0700 Subject: [Ironpython-users] IronPython, Daily Digest 10/11/2011 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New comment] Lib/config directory not present in zip distribution. 2. [New comment] Implement _elementtree module 3. [New comment] Implement _elementtree module 4. [New issue] Update ElementTree to IronPython compatible version ---------------------------------------------- ISSUES 1. [New comment] Lib/config directory not present in zip distribution. http://ironpython.codeplex.com/workitem/31417 User kenial has commented on the issue: "It also happened to me. I'm using Mac OS X 10.6.8 and IronPython 2.7.1 beta 3 installed."----------------- 2. [New comment] Implement _elementtree module http://ironpython.codeplex.com/workitem/21407 User jdhardy has commented on the issue: "This issue is low priority because it refers to the _elementtree C accelerator module. To make ET work, IronPython needs a pyexpat implmentation ([workitem:20023]) or, as you pointed *last year* (sorry!), an upgrade to ET."----------------- 3. [New comment] Implement _elementtree module http://ironpython.codeplex.com/workitem/21407 User pekkaklarck has commented on the issue: "Submitted issue #31579 about changing ET implementation to IPY compatible version."----------------- 4. [New issue] Update ElementTree to IronPython compatible version http://ironpython.codeplex.com/workitem/31579 User pekkaklarck has proposed the issue: "The ElementTree implementation in IPY 2.6 and 2.7 is broken: >>> from xml.etree import ElementTree as ET >>> from StringIO import StringIO >>> ET.parse(StringIO('')) Traceback (most recent call last): File "", line 1, in File "C:\Program Files\IronPython 2.6 for .NET 4.0\Lib\xml\etree\ElementTree.py", line 862, in parse File "C:\Program Files\IronPython 2.6 for .NET 4.0\Lib\xml\etree\ElementTree.py", line 581, in parse File "C:\Program Files\IronPython 2.6 for .NET 4.0\Lib\xml\etree\ElementTree.py", line 1117, in __init__ ImportError: No module named expat; use SimpleXMLTreeBuilder instead >>> ElementTree 1.2.7 preview available at [1] has this comment: "ElementTree 1.2.7 preview is now available. This is 1.2.6 plus support for IronPython.". We've also used this version with Robot Framework [2] and at least in our relatively simple use it works great. It might be worth checking how ET 1.3 alpha 3 works too. It's newer than 1.2.7 so it could have same IronPython fixes. CPython 2.7 uses ET 1.3 [3] so this would make IPY 2.7 API compatible with CPython 2.7 in this regard. Notice that there's already work item #21407 about adding _elementtree module for the current ET implementation. [1] http://effbot.org/zone/element-index.htm [2] http://code.google.com/p/robotframework/wiki/DotNetSupport [3] http://docs.python.org/library/xml.etree.elementtree.html" ---------------------------------------------- ---------------------------------------------- You are receiving this email because you subscribed to notifications on CodePlex. To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jschementi at gmail.com Wed Oct 12 15:22:58 2011 From: jschementi at gmail.com (Jimmy Schementi) Date: Wed, 12 Oct 2011 09:22:58 -0400 Subject: [Ironpython-users] ErrorListener In-Reply-To: <727D8E16AE957149B447FE368139F2B502C596@SERVER10.in.3s-software.com> References: <727D8E16AE957149B447FE368139F2B502C56B@SERVER10.in.3s-software.com> <727D8E16AE957149B447FE368139F2B502C596@SERVER10.in.3s-software.com> Message-ID: On Oct 12, 2011, at 4:55 AM, Markus Schaber wrote: >> Sorry for disturbing again, but I'm a little bit confused about the >> ErrorListeners from the Hosting API. >> >> For compilation of a ScriptSource, I can pass an ErrorListener which gets >> the errors and warnings, but it seems that I cannot pass an ErrorListener >> for the execution of the ScriptSource. >> >> My guess is that the ErrorListener passed to the compilation is referenced >> from the compiled ScriptSource. Can you confirm hat? Or did I miss >> something? > > This guess seems wrong - it seems that the warnings are simply spit out on stderr by default. ErrorListener is only used for compiler errors; if you want to capture runtime errors you can put a try/catch around the call to ScriptSource.Execute(). ~Jimmy From m.schaber at 3s-software.com Wed Oct 12 15:50:19 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Wed, 12 Oct 2011 13:50:19 +0000 Subject: [Ironpython-users] ErrorListener In-Reply-To: References: <727D8E16AE957149B447FE368139F2B502C56B@SERVER10.in.3s-software.com> <727D8E16AE957149B447FE368139F2B502C596@SERVER10.in.3s-software.com> Message-ID: <727D8E16AE957149B447FE368139F2B502CA96@SERVER10.in.3s-software.com> Hi, Jimmy, Von: Jimmy Schementi [mailto:jschementi at gmail.com] > >> Sorry for disturbing again, but I'm a little bit confused about the > >> ErrorListeners from the Hosting API. > >> > >> For compilation of a ScriptSource, I can pass an ErrorListener which > >> gets the errors and warnings, but it seems that I cannot pass an > >> ErrorListener for the execution of the ScriptSource. > >> > >> My guess is that the ErrorListener passed to the compilation is > >> referenced from the compiled ScriptSource. Can you confirm hat? Or > >> did I miss something? > > > > This guess seems wrong - it seems that the warnings are simply spit out > on stderr by default. > > ErrorListener is only used for compiler errors; if you want to capture > runtime errors you can put a try/catch around the call to > ScriptSource.Execute(). It's not about the errors, but about the warnings. We run IronPython embedded (hosted) in our application, and want to capture the warnings to display them in a different window. Best regards Markus Schaber -- ___________________________ We software Automation. 3S-Smart Software Solutions GmbH Markus Schaber | Developer Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax +49-831-54031-50 Email: m.schaber at 3s-software.com | Web: http://www.3s-software.com CoDeSys internet forum: http://forum.3s-software.com Download CoDeSys sample projects: http://www.3s-software.com/index.shtml?sample_projects Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 From rome at Wintellect.com Wed Oct 12 16:04:06 2011 From: rome at Wintellect.com (Keith Rome) Date: Wed, 12 Oct 2011 07:04:06 -0700 Subject: [Ironpython-users] ErrorListener In-Reply-To: <727D8E16AE957149B447FE368139F2B502CA96@SERVER10.in.3s-software.com> References: <727D8E16AE957149B447FE368139F2B502C56B@SERVER10.in.3s-software.com> <727D8E16AE957149B447FE368139F2B502C596@SERVER10.in.3s-software.com> <727D8E16AE957149B447FE368139F2B502CA96@SERVER10.in.3s-software.com> Message-ID: <7737799D90E55E4BB9C9F7E40D161E110E38F5FEA6@VA3DIAXVS461.RED001.local> Is there a notion of "Warning" in context of execution? My understanding is that during execution you either get a single error, or you get the resulting value (or void/null if the script does not eval to a return value). Any print() messages are routed to the stdout stream which you can also intercept via the script engine's IO property. Perhaps that kind of trace output is what you are looking for? Keith Rome Senior Consultant and Architect MCPD-EAD, MCSD, MCDBA, MCTS-WPF, MCTS-TFS, MCTS-WSS Wintellect | 770.617.4016 | krome at wintellect.com www.wintellect.com -----Original Message----- From: ironpython-users-bounces+rome=wintellect.com at python.org [mailto:ironpython-users-bounces+rome=wintellect.com at python.org] On Behalf Of Markus Schaber Sent: Wednesday, October 12, 2011 9:50 AM To: Jimmy Schementi Cc: ironpython-users at python.org Subject: Re: [Ironpython-users] ErrorListener Hi, Jimmy, Von: Jimmy Schementi [mailto:jschementi at gmail.com] > >> Sorry for disturbing again, but I'm a little bit confused about the > >> ErrorListeners from the Hosting API. > >> > >> For compilation of a ScriptSource, I can pass an ErrorListener > >> which gets the errors and warnings, but it seems that I cannot pass > >> an ErrorListener for the execution of the ScriptSource. > >> > >> My guess is that the ErrorListener passed to the compilation is > >> referenced from the compiled ScriptSource. Can you confirm hat? Or > >> did I miss something? > > > > This guess seems wrong - it seems that the warnings are simply spit > > out > on stderr by default. > > ErrorListener is only used for compiler errors; if you want to capture > runtime errors you can put a try/catch around the call to > ScriptSource.Execute(). It's not about the errors, but about the warnings. We run IronPython embedded (hosted) in our application, and want to capture the warnings to display them in a different window. Best regards Markus Schaber -- ___________________________ We software Automation. 3S-Smart Software Solutions GmbH Markus Schaber | Developer Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax +49-831-54031-50 Email: m.schaber at 3s-software.com | Web: http://www.3s-software.com CoDeSys internet forum: http://forum.3s-software.com Download CoDeSys sample projects: http://www.3s-software.com/index.shtml?sample_projects Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 _______________________________________________ Ironpython-users mailing list Ironpython-users at python.org http://mail.python.org/mailman/listinfo/ironpython-users From m.schaber at 3s-software.com Wed Oct 12 16:25:59 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Wed, 12 Oct 2011 14:25:59 +0000 Subject: [Ironpython-users] ErrorListener In-Reply-To: <7737799D90E55E4BB9C9F7E40D161E110E38F5FEA6@VA3DIAXVS461.RED001.local> References: <727D8E16AE957149B447FE368139F2B502C56B@SERVER10.in.3s-software.com> <727D8E16AE957149B447FE368139F2B502C596@SERVER10.in.3s-software.com> <727D8E16AE957149B447FE368139F2B502CA96@SERVER10.in.3s-software.com> <7737799D90E55E4BB9C9F7E40D161E110E38F5FEA6@VA3DIAXVS461.RED001.local> Message-ID: <727D8E16AE957149B447FE368139F2B502CAE6@SERVER10.in.3s-software.com> Hi, Keith, Von: Keith Rome [mailto:rome at Wintellect.com] > > Is there a notion of "Warning" in context of execution? My understanding is > that during execution you either get a single error, or you get the > resulting value (or void/null if the script does not eval to a return > value). Any print() messages are routed to the stdout stream which you can > also intercept via the script engine's IO property. Perhaps that kind of > trace output is what you are looking for? At least Python has that notion, and it has been ported to IronPython. With switches like -t, -b, -3 and -Wall for IPy.exe, corresponding to the options IndentationInconsistencySeverity, BytesWarning, WarnPy3k and WarningFilters passed to Python.CreateEngine(), some of those warnings can be enabled. While -t only has effect during compilation, -3 and -Wall trigger some warnings during execution (I'm not sure about -b.) But it seems that those runtime warnings are handled completely inside the python warnings framework, and there the default is simply to write the warning to stdout. I guess I have to override the warnings.showwarning method (as it is documented for python) from hosting environment to achieve what I want. Best regards Markus Schaber -- ___________________________ We software Automation. 3S-Smart Software Solutions GmbH Markus Schaber | Developer Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax +49-831-54031-50 Email: m.schaber at 3s-software.com | Web: http://www.3s-software.com CoDeSys internet forum: http://forum.3s-software.com Download CoDeSys sample projects: http://www.3s-software.com/index.shtml?sample_projects Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 From m.schaber at 3s-software.com Wed Oct 12 16:44:54 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Wed, 12 Oct 2011 14:44:54 +0000 Subject: [Ironpython-users] Patch: Warn user when using old print syntax Message-ID: <727D8E16AE957149B447FE368139F2B502CB20@SERVER10.in.3s-software.com> Hi, Von: Markus Schaber > Von: Dino Viehland [mailto:dinov at microsoft.com] > > So you want to warn if the file contains a print statement w/o from > > __future__ import print_function? What if it's a call to print such > > as > > print('foo') which is valid in both 2.x and 3.x? > > Considering our user base, I could ignore this corner case, as the user can > simply get rid of the warning by adding the import statement. > > > Either way you should be able to just update ParsePrintStmt in Parser.cs. > > But dealing w/ the case of the parens would be a little more difficult > > - but I think you can just peek at the next token after print and see > > if it's a parenthesis right after we eat the print keyword. > > Ok, I'll see whether I can do that. The patch below emits a warning during Compilation for print statements whose argument list does not start with a '(' if Py3k warnings are enabled. Best regards Markus Schaber 944eab0d7da3660001f1dabf473f48d5ddd4ee25 Languages/IronPython/IronPython/Compiler/Parser.cs | 18 ++++++++++++++++-- .../IronPython/IronPython/Resources.Designer.cs | 9 +++++++++ Languages/IronPython/IronPython/Resources.resx | 3 +++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/Languages/IronPython/IronPython/Compiler/Parser.cs b/Languages/IronPython/IronPython/Compiler/Parser.cs index bdef897..d756593 100644 --- a/Languages/IronPython/IronPython/Compiler/Parser.cs +++ b/Languages/IronPython/IronPython/Compiler/Parser.cs @@ -38,6 +38,7 @@ namespace IronPython.Compiler { public class Parser : IDisposable { // TODO: remove IDisposable // immutable properties: private readonly Tokenizer _tokenizer; + private readonly bool _warnPython30; // mutable properties: private ErrorSink _errors; @@ -70,7 +71,7 @@ namespace IronPython.Compiler { #region Construction - private Parser(CompilerContext context, Tokenizer tokenizer, ErrorSink errorSink, ParserSink parserSink, ModuleOptions languageFeatures) { + private Parser(CompilerContext context, Tokenizer tokenizer, ErrorSink errorSink, ParserSink parserSink, ModuleOptions languageFeatures, bool warnPython30) { ContractUtils.RequiresNotNull(tokenizer, "tokenizer"); ContractUtils.RequiresNotNull(errorSink, "errorSink"); ContractUtils.RequiresNotNull(parserSink, "parserSink"); @@ -79,6 +80,7 @@ namespace IronPython.Compiler { _tokenizer = tokenizer; _errors = errorSink; + _warnPython30 = warnPython30; if (parserSink != ParserSink.Null) { _sink = parserSink; } @@ -123,7 +125,7 @@ namespace IronPython.Compiler { tokenizer.Initialize(null, reader, context.SourceUnit, SourceLocation.MinValue); tokenizer.IndentationInconsistencySeverity = options.IndentationInconsistencySeverity; - Parser result = new Parser(context, tokenizer, context.Errors, context.ParserSink, compilerOptions.Module); + Parser result = new Parser(context, tokenizer, context.Errors, context.ParserSink, compilerOptions.Module, options.WarnPython30); result._sourceReader = reader; return result; } @@ -379,6 +381,13 @@ namespace IronPython.Compiler { Severity.FatalError); } + private void ReportWarning(string message) + { + SourceLocation start = _tokenizer.IndexToLocation(_lookahead.Span.Start); + SourceLocation end = _tokenizer.IndexToLocation(_lookahead.Span.End); + _errors.Add(_sourceUnit, message, new SourceSpan(start, end), 0, Severity.Warning); + } + #endregion #region LL(1) Parsing @@ -1017,6 +1026,11 @@ namespace IronPython.Compiler { //print_stmt: 'print' ( [ expression (',' expression)* [','] ] | '>>' expression [ (',' expression)+ [','] ] ) private PrintStatement ParsePrintStmt() { Eat(TokenKind.KeywordPrint); + + if (_warnPython30 && PeekToken().Kind != TokenKind.LeftParenthesis) { + ReportWarning(Resources.UsingPrintStatementWarning); + } + var start = GetStart(); Expression dest = null; PrintStatement ret; diff --git a/Languages/IronPython/IronPython/Resources.Designer.cs b/Languages/IronPython/IronPython/Resources.Designer.cs index b564a8e..4a5d5fe 100644 --- a/Languages/IronPython/IronPython/Resources.Designer.cs +++ b/Languages/IronPython/IronPython/Resources.Designer.cs @@ -419,5 +419,14 @@ namespace IronPython { return ResourceManager.GetString("UnknownFutureFeature", resourceCulture); } } + + /// + /// Looks up a localized string similar to Python 2 print statement found. For Python 3 compatibility, use "from __future__ import print_function" and the print() function instead.. + /// + internal static string UsingPrintStatementWarning { + get { + return ResourceManager.GetString("UsingPrintStatementWarning", resourceCulture); + } + } } } diff --git a/Languages/IronPython/IronPython/Resources.resx b/Languages/IronPython/IronPython/Resources.resx index 3d89b3d..f666b1f 100644 --- a/Languages/IronPython/IronPython/Resources.resx +++ b/Languages/IronPython/IronPython/Resources.resx @@ -238,4 +238,7 @@ future feature is not defined: + + Python 2 print statement found. For Python 3 compatibility, use "from __future__ import print_function" and the print() function instead. + \ No newline at end of file From jdhardy at gmail.com Wed Oct 12 17:40:20 2011 From: jdhardy at gmail.com (Jeff Hardy) Date: Wed, 12 Oct 2011 08:40:20 -0700 Subject: [Ironpython-users] Patch: Warn user when using old print syntax In-Reply-To: <727D8E16AE957149B447FE368139F2B502CB20@SERVER10.in.3s-software.com> References: <727D8E16AE957149B447FE368139F2B502CB20@SERVER10.in.3s-software.com> Message-ID: Thanks! Can you make this a pull request on GitHub? It's much easier to manage patches from there. - Jeff On Wed, Oct 12, 2011 at 7:44 AM, Markus Schaber wrote: > Hi, > > Von: Markus Schaber >> Von: Dino Viehland [mailto:dinov at microsoft.com] >> > So you want to warn if the file contains a print statement w/o from >> > __future__ import print_function? ?What if it's a call to print such >> > as >> > print('foo') ?which is valid in both 2.x and 3.x? >> >> Considering our user base, I could ignore this corner case, as the user can >> simply get rid of the warning by adding the import statement. >> >> > Either way you should be able to just update ParsePrintStmt in Parser.cs. >> > But dealing w/ the case of the parens would be a little more difficult >> > - but I think you can just peek at the next token after print and see >> > if it's a parenthesis right after we eat the print keyword. >> >> Ok, I'll see whether I can do that. > > The patch below emits a warning during Compilation for print statements whose argument list does not start with a '(' if Py3k warnings are enabled. > > Best regards > > Markus Schaber > > 944eab0d7da3660001f1dabf473f48d5ddd4ee25 > ?Languages/IronPython/IronPython/Compiler/Parser.cs | ? 18 ++++++++++++++++-- > ?.../IronPython/IronPython/Resources.Designer.cs ? ?| ? ?9 +++++++++ > ?Languages/IronPython/IronPython/Resources.resx ? ? | ? ?3 +++ > ?3 files changed, 28 insertions(+), 2 deletions(-) > > diff --git a/Languages/IronPython/IronPython/Compiler/Parser.cs b/Languages/IronPython/IronPython/Compiler/Parser.cs > index bdef897..d756593 100644 > --- a/Languages/IronPython/IronPython/Compiler/Parser.cs > +++ b/Languages/IronPython/IronPython/Compiler/Parser.cs > @@ -38,6 +38,7 @@ namespace IronPython.Compiler { > ? ? public class Parser : IDisposable { // TODO: remove IDisposable > ? ? ? ? // immutable properties: > ? ? ? ? private readonly Tokenizer _tokenizer; > + ? ? ? ?private readonly bool _warnPython30; > > ? ? ? ? // mutable properties: > ? ? ? ? private ErrorSink _errors; > @@ -70,7 +71,7 @@ namespace IronPython.Compiler { > > ? ? ? ? #region Construction > > - ? ? ? ?private Parser(CompilerContext context, Tokenizer tokenizer, ErrorSink errorSink, ParserSink parserSink, ModuleOptions languageFeatures) { > + ? ? ? ?private Parser(CompilerContext context, Tokenizer tokenizer, ErrorSink errorSink, ParserSink parserSink, ModuleOptions languageFeatures, bool warnPython30) { > ? ? ? ? ? ? ContractUtils.RequiresNotNull(tokenizer, "tokenizer"); > ? ? ? ? ? ? ContractUtils.RequiresNotNull(errorSink, "errorSink"); > ? ? ? ? ? ? ContractUtils.RequiresNotNull(parserSink, "parserSink"); > @@ -79,6 +80,7 @@ namespace IronPython.Compiler { > > ? ? ? ? ? ? _tokenizer = tokenizer; > ? ? ? ? ? ? _errors = errorSink; > + ? ? ? ? ? ?_warnPython30 = warnPython30; > ? ? ? ? ? ? if (parserSink != ParserSink.Null) { > ? ? ? ? ? ? ? ? _sink = parserSink; > ? ? ? ? ? ? } > @@ -123,7 +125,7 @@ namespace IronPython.Compiler { > ? ? ? ? ? ? tokenizer.Initialize(null, reader, context.SourceUnit, SourceLocation.MinValue); > ? ? ? ? ? ? tokenizer.IndentationInconsistencySeverity = options.IndentationInconsistencySeverity; > > - ? ? ? ? ? ?Parser result = new Parser(context, tokenizer, context.Errors, context.ParserSink, compilerOptions.Module); > + ? ? ? ? ? ?Parser result = new Parser(context, tokenizer, context.Errors, context.ParserSink, compilerOptions.Module, options.WarnPython30); > ? ? ? ? ? ? result._sourceReader = reader; > ? ? ? ? ? ? return result; > ? ? ? ? } > @@ -379,6 +381,13 @@ namespace IronPython.Compiler { > ? ? ? ? ? ? ? ? Severity.FatalError); > ? ? ? ? } > > + ? ? ? ?private void ReportWarning(string message) > + ? ? ? ?{ > + ? ? ? ? ? ?SourceLocation start = _tokenizer.IndexToLocation(_lookahead.Span.Start); > + ? ? ? ? ? ?SourceLocation end = _tokenizer.IndexToLocation(_lookahead.Span.End); > + ? ? ? ? ? ?_errors.Add(_sourceUnit, message, new SourceSpan(start, end), 0, Severity.Warning); > + ? ? ? ?} > + > ? ? ? ? #endregion > > ? ? ? ? #region LL(1) Parsing > @@ -1017,6 +1026,11 @@ namespace IronPython.Compiler { > ? ? ? ? //print_stmt: 'print' ( [ expression (',' expression)* [','] ] | '>>' expression [ (',' expression)+ [','] ] ) > ? ? ? ? private PrintStatement ParsePrintStmt() { > ? ? ? ? ? ? Eat(TokenKind.KeywordPrint); > + > + ? ? ? ? ? ?if (_warnPython30 && PeekToken().Kind != TokenKind.LeftParenthesis) { > + ? ? ? ? ? ? ? ?ReportWarning(Resources.UsingPrintStatementWarning); > + ? ? ? ? ? ?} > + > ? ? ? ? ? ? var start = GetStart(); > ? ? ? ? ? ? Expression dest = null; > ? ? ? ? ? ? PrintStatement ret; > diff --git a/Languages/IronPython/IronPython/Resources.Designer.cs b/Languages/IronPython/IronPython/Resources.Designer.cs > index b564a8e..4a5d5fe 100644 > --- a/Languages/IronPython/IronPython/Resources.Designer.cs > +++ b/Languages/IronPython/IronPython/Resources.Designer.cs > @@ -419,5 +419,14 @@ namespace IronPython { > ? ? ? ? ? ? ? ? return ResourceManager.GetString("UnknownFutureFeature", resourceCulture); > ? ? ? ? ? ? } > ? ? ? ? } > + > + ? ? ? ?/// > + ? ? ? ?/// ? Looks up a localized string similar to Python 2 print statement found. For Python 3 compatibility, use "from __future__ import print_function" and the print() function instead.. > + ? ? ? ?/// > + ? ? ? ?internal static string UsingPrintStatementWarning { > + ? ? ? ? ? ?get { > + ? ? ? ? ? ? ? ?return ResourceManager.GetString("UsingPrintStatementWarning", resourceCulture); > + ? ? ? ? ? ?} > + ? ? ? ?} > ? ? } > ?} > diff --git a/Languages/IronPython/IronPython/Resources.resx b/Languages/IronPython/IronPython/Resources.resx > index 3d89b3d..f666b1f 100644 > --- a/Languages/IronPython/IronPython/Resources.resx > +++ b/Languages/IronPython/IronPython/Resources.resx > @@ -238,4 +238,7 @@ > ? > ? ? future feature is not defined: > ? > + ? > + ? ?Python 2 print statement found. For Python 3 compatibility, use "from __future__ import print_function" and the print() function instead. > + ? > ? > \ No newline at end of file > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > http://mail.python.org/mailman/listinfo/ironpython-users > From luis.vallejo at gmail.com Wed Oct 12 18:04:48 2011 From: luis.vallejo at gmail.com (Luis Vallejo) Date: Thu, 13 Oct 2011 00:04:48 +0800 Subject: [Ironpython-users] Retrieving Ironpython variables within .NET Message-ID: Hi Guys, Im new to Ironpython and I was reading the book Ironpython in Action now in Chapter 15, there is something i want to do but i just cant make it work. I have the following script class Item: def __init__(self,value,quality): self.value = value self.quality = quality number = 5; variable = "Goodbye world!" x = Item(5.0,"Good") print x.quality And I want to retrieve the variable "x" from C# change its value and inject it back to Ironpython the problem I face is that well.. i dont know how. I have tried with the scope.GetItems() but it returns 0. the only time it returns the variables is when I Execute the Code, and if its possible I would like to have it before... //Item is of size 0 var items = _scope.GetItems(); _code.Execute(_scope); //After execute items is size 5 items = _scope.GetItems(); Thanks LV -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdhardy at gmail.com Wed Oct 12 19:01:14 2011 From: jdhardy at gmail.com (Jeff Hardy) Date: Wed, 12 Oct 2011 10:01:14 -0700 Subject: [Ironpython-users] Retrieving Ironpython variables within .NET In-Reply-To: References: Message-ID: On Wed, Oct 12, 2011 at 9:04 AM, Luis Vallejo wrote: > And I want to retrieve the variable "x" from C# change its value and inject > it back to Ironpython the problem I face is that well.. i dont know how. I > have tried with the scope.GetItems() but it returns 0. the only time it > returns the variables is when I Execute the Code, and if its possible I > would like to have it before... In Python, the variable doesn't exist until the code is executed. There's no way around that. - Jeff From m.schaber at 3s-software.com Thu Oct 13 10:13:44 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Thu, 13 Oct 2011 08:13:44 +0000 Subject: [Ironpython-users] Patch: Warn user when using old print syntax In-Reply-To: <727D8E16AE957149B447FE368139F2B502CB20@SERVER10.in.3s-software.com> References: <727D8E16AE957149B447FE368139F2B502CB20@SERVER10.in.3s-software.com> Message-ID: <727D8E16AE957149B447FE368139F2B508A6963B@SERVER10> Hi, Von: Markus Schaber > The patch below emits a warning during Compilation for print statements > whose argument list does not start with a '(' if Py3k warnings are enabled. Somehow, this patch leads to a StackOverFlowException in some cases, so please don't apply it. (It seemed to work fine in my tests yesterday, though.) I'm still investigating, but it seems that ErrorSink.Add tries to import the Warnings module, which itself triggers that warning recursively. Maybe we should find a way to exclude the standard library from this kind of warning? I'll try to check how it is done for -t - or do we simply rely on the fact that the warnings module itself has a consistent indentation? Best regards Markus Schaber -- ___________________________ We software Automation. 3S-Smart Software Solutions GmbH Markus Schaber | Developer Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax +49-831-54031-50 Email: m.schaber at 3s-software.com | Web: http://www.3s-software.com CoDeSys internet forum: http://forum.3s-software.com Download CoDeSys sample projects: http://www.3s-software.com/index.shtml?sample_projects Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 From m.schaber at 3s-software.com Thu Oct 13 10:26:18 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Thu, 13 Oct 2011 08:26:18 +0000 Subject: [Ironpython-users] Patch: Warn user when using old print syntax In-Reply-To: <727D8E16AE957149B447FE368139F2B508A6963B@SERVER10> References: <727D8E16AE957149B447FE368139F2B502CB20@SERVER10.in.3s-software.com> <727D8E16AE957149B447FE368139F2B508A6963B@SERVER10> Message-ID: <727D8E16AE957149B447FE368139F2B508A6A653@SERVER10> Hi, Von: ironpython-users-bounces+m.schaber=3s-software.com at python.org > Von: Markus Schaber > > The patch below emits a warning during Compilation for print > > statements whose argument list does not start with a '(' if Py3k warnings > are enabled. > > Somehow, this patch leads to a StackOverFlowException in some cases, so > please don't apply it. > > (It seemed to work fine in my tests yesterday, though.) The reason for that is that my tests yesterday involved only Compilation of ScriptSources. When actually executing a script, however, import of modules triggers their compilation, and then warnings are dispatched to the warnings module, instead of the ErrorListener used for Compilation. > I'm still investigating, but it seems that ErrorSink.Add tries to import > the Warnings module, which itself triggers that warning recursively. > Maybe we should find a way to exclude the standard library from this kind > of warning? I'll try to check how it is done for -t - or do we simply rely > on the fact that the warnings module itself has a consistent indentation? Best regards Markus Schaber -- ___________________________ We software Automation. 3S-Smart Software Solutions GmbH Markus Schaber | Developer Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax +49-831-54031-50 Email: m.schaber at 3s-software.com | Web: http://www.3s-software.com CoDeSys internet forum: http://forum.3s-software.com Download CoDeSys sample projects: http://www.3s-software.com/index.shtml?sample_projects Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 From dinov at microsoft.com Fri Oct 14 18:32:48 2011 From: dinov at microsoft.com (Dino Viehland) Date: Fri, 14 Oct 2011 16:32:48 +0000 Subject: [Ironpython-users] Patch: Warn user when using old print syntax In-Reply-To: <727D8E16AE957149B447FE368139F2B508A6A653@SERVER10> References: <727D8E16AE957149B447FE368139F2B502CB20@SERVER10.in.3s-software.com> <727D8E16AE957149B447FE368139F2B508A6963B@SERVER10> <727D8E16AE957149B447FE368139F2B508A6A653@SERVER10> Message-ID: <6C7ABA8B4E309440B857D74348836F2E3F7DC665@TK5EX14MBXC293.redmond.corp.microsoft.com> You could add a thread static bool which tracks whether or not we're already reporting the warning, and if so don't recurse and report again. -----Original Message----- From: ironpython-users-bounces+dinov=microsoft.com at python.org [mailto:ironpython-users-bounces+dinov=microsoft.com at python.org] On Behalf Of Markus Schaber Sent: Thursday, October 13, 2011 1:26 AM To: Markus Schaber; Discussion of IronPython Subject: Re: [Ironpython-users] Patch: Warn user when using old print syntax Hi, Von: ironpython-users-bounces+m.schaber=3s-software.com at python.org > Von: Markus Schaber > > The patch below emits a warning during Compilation for print > > statements whose argument list does not start with a '(' if Py3k > > warnings > are enabled. > > Somehow, this patch leads to a StackOverFlowException in some cases, > so please don't apply it. > > (It seemed to work fine in my tests yesterday, though.) The reason for that is that my tests yesterday involved only Compilation of ScriptSources. When actually executing a script, however, import of modules triggers their compilation, and then warnings are dispatched to the warnings module, instead of the ErrorListener used for Compilation. > I'm still investigating, but it seems that ErrorSink.Add tries to > import the Warnings module, which itself triggers that warning recursively. > Maybe we should find a way to exclude the standard library from this > kind of warning? I'll try to check how it is done for -t - or do we > simply rely on the fact that the warnings module itself has a consistent indentation? Best regards Markus Schaber -- ___________________________ We software Automation. 3S-Smart Software Solutions GmbH Markus Schaber | Developer Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax +49-831-54031-50 Email: m.schaber at 3s-software.com | Web: http://www.3s-software.com CoDeSys internet forum: http://forum.3s-software.com Download CoDeSys sample projects: http://www.3s-software.com/index.shtml?sample_projects Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 _______________________________________________ Ironpython-users mailing list Ironpython-users at python.org http://mail.python.org/mailman/listinfo/ironpython-users From no_reply at codeplex.com Sun Oct 16 09:49:32 2011 From: no_reply at codeplex.com (no_reply at codeplex.com) Date: 16 Oct 2011 00:49:32 -0700 Subject: [Ironpython-users] IronPython, Daily Digest 10/15/2011 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New comment] zlib.compress missing an overload allowing BufferObjects 2. [Status update] zlib.compress missing an overload allowing BufferObjects ---------------------------------------------- ISSUES 1. [New comment] zlib.compress missing an overload allowing BufferObjects http://ironpython.codeplex.com/workitem/30887 User jdhardy has commented on the issue: "Fixed in 567b367."----------------- 2. [Status update] zlib.compress missing an overload allowing BufferObjects http://ironpython.codeplex.com/workitem/30887 User jdhardy has updated the issue: Status has changed from Fixed to Closed with the following comment, "Fixed in 2.7.1 Beta 3" ---------------------------------------------- ---------------------------------------------- You are receiving this email because you subscribed to notifications on CodePlex. To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bruce306 at rogers.com Sun Oct 16 22:33:14 2011 From: bruce306 at rogers.com (Bruce Anderson) Date: Sun, 16 Oct 2011 13:33:14 -0700 (PDT) Subject: [Ironpython-users] Getting started reference Message-ID: <1318797194.2381.YahooMailNeo@web88616.mail.bf1.yahoo.com> I've done some WPF in C# using VisualStudio 2010 and I've done some Python in IDLE, but I've never done IronPython using WPF in VS2010. Are there any references or web pages to help people get to First base? (I'm looking specifically for IronPython WPF using VS2010 - I've found so many generic pages that my eyes are tired - but absolutely nada about what I need to get started.)? I have Foorde's book - but it pre-dates the integration of WPF, VS and IronPython, so it doesn't seem to help. For example, I fired up VS2010, built an IronPython WPF application and added a button and a label. I have the XAML code and the PY code. But how do I reference the controls from my Python code-behind? I've tried the way I would do it from C# (e.g. label1.contents = "Hello World") - but that just gives me an "Unbound Name Exception" unhandled error. I even tried setting properties of "self" in the button_click handler - but that didn't work either. This has got to be simple - can someone point me in the right direction? ? Bruce Anderson -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdhardy at gmail.com Mon Oct 17 08:33:29 2011 From: jdhardy at gmail.com (Jeff Hardy) Date: Sun, 16 Oct 2011 23:33:29 -0700 Subject: [Ironpython-users] IronPython 2.7.1 RC Released Message-ID: The first release candidate of IronPython 2.7.1is now available. Like IronPython 2.7 , this release *requires .NET 4 or Silverlight 4.* This release will replace any existing IronPython installation. If there are no showstopping issues, this will be the only release candidate for 2.7.1, so please speak up if you run into any roadblocks. The highlights of 2.7.1 are: - Updated the standard library to match CPython 2.7.2. - Add the ast, csv, and unicodedata modules. - Fixed several bugs. - IronPython Tools for Visual Studio are disabled by default. See http://pytools.codeplex.com for the next generation of Python Visual Studio support. This release fixes a few minor bugs from 2.7.1 Beta 3, namely making ElementTree work and avoiding an exception on startup on Unix and MacOS. See the current list of fixed issues for more details. In particular, the updated standard library may have introduced some undetected bugs. Please report any issues at http://ironpython.codeplex.com/workitem/list/basic. Thanks, IronPython Team -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.schaber at 3s-software.com Mon Oct 17 09:05:31 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Mon, 17 Oct 2011 07:05:31 +0000 Subject: [Ironpython-users] Patch: Warn user when using old print syntax In-Reply-To: <6C7ABA8B4E309440B857D74348836F2E3F7DC665@TK5EX14MBXC293.redmond.corp.microsoft.com> References: <727D8E16AE957149B447FE368139F2B502CB20@SERVER10.in.3s-software.com> <727D8E16AE957149B447FE368139F2B508A6963B@SERVER10> <727D8E16AE957149B447FE368139F2B508A6A653@SERVER10> <6C7ABA8B4E309440B857D74348836F2E3F7DC665@TK5EX14MBXC293.redmond.corp.microsoft.com> Message-ID: <727D8E16AE957149B447FE368139F2B508A6C59E@SERVER10> Hi, Dino, Von: Dino Viehland [mailto:dinov at microsoft.com] >> [... reporting warnings for old print statement syntax ...] > You could add a thread static bool which tracks whether or not we're > already reporting the warning, and if so don't recurse and report again. That would fix the problem with recursiveness. But I'd prefer a fix which excludes the standard library from those warnings, I don't want to swamp our users with useless warnings they can't fix. Or maybe only trigger the warning on explicit ScriptScope.Compile() calls... I'll investigate further... Best regards Markus Schaber -- ___________________________ We software Automation. 3S-Smart Software Solutions GmbH Markus Schaber | Developer Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax +49-831-54031-50 Email: m.schaber at 3s-software.com | Web: http://www.3s-software.com CoDeSys internet forum: http://forum.3s-software.com Download CoDeSys sample projects: http://www.3s-software.com/index.shtml?sample_projects Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 From no_reply at codeplex.com Mon Oct 17 12:45:23 2011 From: no_reply at codeplex.com (no_reply at codeplex.com) Date: 17 Oct 2011 03:45:23 -0700 Subject: [Ironpython-users] IronPython, Daily Digest 10/16/2011 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New comment] Lib/config directory not present in zip distribution. 2. [New comment] Update ElementTree to IronPython compatible version ---------------------------------------------- ISSUES 1. [New comment] Lib/config directory not present in zip distribution. http://ironpython.codeplex.com/workitem/31417 User jdhardy has commented on the issue: "Fixed in 97ee5a7."----------------- 2. [New comment] Update ElementTree to IronPython compatible version http://ironpython.codeplex.com/workitem/31579 User jdhardy has commented on the issue: "Fixed in cb73948. You'll need to specify SimpleXMLTreeBuilder.TreeBuilder when calling ElementTree.parse, but otherwise it should work." ---------------------------------------------- ---------------------------------------------- You are receiving this email because you subscribed to notifications on CodePlex. To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From no_reply at codeplex.com Tue Oct 18 15:19:58 2011 From: no_reply at codeplex.com (no_reply at codeplex.com) Date: 18 Oct 2011 06:19:58 -0700 Subject: [Ironpython-users] IronPython, Daily Digest 10/17/2011 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New comment] Update ElementTree to IronPython compatible version ---------------------------------------------- ISSUES 1. [New comment] Update ElementTree to IronPython compatible version http://ironpython.codeplex.com/workitem/31579 User adal has commented on the issue: "This is still broken. The SimpleXMLTreeBuilder.py module is not included with IronPython. Besides, "fromstring" should work without having to pass SimpleXMLTreeBuilder.TreeBuilder to it, I'm using the same code with both CPython and IronPython. ATM I'm using ET 1.2.7, with a small patch in ElementIron.py: ....# FIXME: handle settings here? (disable comments, etc) ....# PATCH BEGIN ....from System.Xml import XmlReaderSettings, DtdProcessing ....settings = XmlReaderSettings() ....settings.DtdProcessing = DtdProcessing.Ignore ....# PATCH END ....reader = XmlReader.Create(source, settings)" ---------------------------------------------- ---------------------------------------------- You are receiving this email because you subscribed to notifications on CodePlex. To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From no_reply at codeplex.com Wed Oct 19 09:51:57 2011 From: no_reply at codeplex.com (no_reply at codeplex.com) Date: 19 Oct 2011 00:51:57 -0700 Subject: [Ironpython-users] IronPython, Daily Digest 10/18/2011 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New issue] Some path ops are not done through PlatformAdaptationLayer in IronPython.Runtime.Importer ---------------------------------------------- ISSUES 1. [New issue] Some path ops are not done through PlatformAdaptationLayer in IronPython.Runtime.Importer http://ironpython.codeplex.com/workitem/31603 User rickardholmberg has proposed the issue: "Path name operations in IronPython.Runtime.Importer are supposed to be performed through the PlatformAdaptationLayer, enabling platform adaptations of path name structure. Some operations are still directly done to System.IO.Path, though, which breaks the adaptation layer. The commit https://github.com/rickardraysearch/main/commit/7cc9ed676c1ee6f6f0e770d9c8842d24b4e1c7d6 fixes (at least some of some of) the remaining items." ---------------------------------------------- ---------------------------------------------- You are receiving this email because you subscribed to notifications on CodePlex. To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdhardy at gmail.com Sat Oct 22 09:29:50 2011 From: jdhardy at gmail.com (Jeff Hardy) Date: Sat, 22 Oct 2011 00:29:50 -0700 Subject: [Ironpython-users] IronPython 2.7.1 Released! Message-ID: On behalf of the IronPython, I'm happy to announce the release of IronPython 2.7.1 . Like IronPython 2.7 , this release *requires .NET 4 or Silverlight 4.* This release will replace any existing IronPython installation. The biggest improvement in IronPython 2.7.1 is support for the unicodedata, csv, and ats modules. The other Python standard library modules have been upgraded to match Python 2.7.2. There has also been a number of bug fixes to make IronPython generally more compatible with CPython. Finally, the IronPython Tools for Visual Studio have been deprecated in favour of the Python Tools for Visual Studio . See the list of fixed issues for details on what has changed since IronPython 2.7. - Jeff -------------- next part -------------- An HTML attachment was scrubbed... URL: From daftspaniel at gmail.com Sat Oct 22 10:47:36 2011 From: daftspaniel at gmail.com (Davy Mitchell) Date: Sat, 22 Oct 2011 09:47:36 +0100 Subject: [Ironpython-users] IronPython 2.7.1 Released! In-Reply-To: References: Message-ID: Well done everyone! On 22 October 2011 08:29, Jeff Hardy wrote: > On behalf of the IronPython, I'm happy to announce the release of IronPython > 2.7.1. Like IronPython?2.7, this release?requires .NET 4 or Silverlight > 4.?This release will replace any existing IronPython installation. > > The biggest improvement in IronPython 2.7.1 is support for the unicodedata, > csv, and ats modules. The other Python standard library modules have been > upgraded to match Python 2.7.2. > > There has also been a number of bug fixes to make IronPython generally more > compatible with CPython. > > Finally, the IronPython Tools for Visual Studio have been deprecated in > favour of the?Python Tools for Visual Studio. > > See?the list of fixed issues?for details on what has changed since > IronPython 2.7. > - Jeff > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > http://mail.python.org/mailman/listinfo/ironpython-users > > -- -- ? Davy's Blog - http://daftspaniel.wordpress.com From loocas at duber.cz Sat Oct 22 11:17:54 2011 From: loocas at duber.cz (=?UTF-8?B?THVrw6HFoSBEdWLEm2Rh?=) Date: Sat, 22 Oct 2011 11:17:54 +0200 Subject: [Ironpython-users] IronPython 2.7.1 Released! In-Reply-To: References: Message-ID: <4EA28A42.406@duber.cz> Congratulations everyone! Nice work! :) Luk?? Dub?da Director [T] +420 602 444 164 duber studio(tm) [M] info at duber.cz [W] http://www.duber.cz [A] R.A.Dvorsk?ho 601, Praha 10 [A] 10900, Czech Republic, Europe On 22.10.2011 10:47, Davy Mitchell wrote: > Well done everyone! > > On 22 October 2011 08:29, Jeff Hardy wrote: >> On behalf of the IronPython, I'm happy to announce the release of IronPython >> 2.7.1. Like IronPython 2.7, this release requires .NET 4 or Silverlight >> 4. This release will replace any existing IronPython installation. >> >> The biggest improvement in IronPython 2.7.1 is support for the unicodedata, >> csv, and ats modules. The other Python standard library modules have been >> upgraded to match Python 2.7.2. >> >> There has also been a number of bug fixes to make IronPython generally more >> compatible with CPython. >> >> Finally, the IronPython Tools for Visual Studio have been deprecated in >> favour of the Python Tools for Visual Studio. >> >> See the list of fixed issues for details on what has changed since >> IronPython 2.7. >> - Jeff >> _______________________________________________ >> Ironpython-users mailing list >> Ironpython-users at python.org >> http://mail.python.org/mailman/listinfo/ironpython-users >> >> > > > From no_reply at codeplex.com Sat Oct 22 13:05:56 2011 From: no_reply at codeplex.com (no_reply at codeplex.com) Date: 22 Oct 2011 04:05:56 -0700 Subject: [Ironpython-users] IronPython, Daily Digest 10/21/2011 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New issue] NullReference bug report 2. [New comment] Update ElementTree to IronPython compatible version ---------------------------------------------- ISSUES 1. [New issue] NullReference bug report http://ironpython.codeplex.com/workitem/31621 User linhaoxiang has proposed the issue: "I use my own static analysis tool on the latest source code and find a NullReference bug in file src\IronPython\Runtime\Operations\DelegateOps.cs, function DelegateOps::__new__(). The code is " if (type == null) throw PythonOps.TypeError("expected type for 1st param, got {0}", type.Name);", and "type" is null when dereferencing its "Name" property."----------------- 2. [New comment] Update ElementTree to IronPython compatible version http://ironpython.codeplex.com/workitem/31579 User jdhardy has commented on the issue: "Fixed again in 164c804 - thanks @adal for the suggestion." ---------------------------------------------- ---------------------------------------------- You are receiving this email because you subscribed to notifications on CodePlex. To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From zgramana at pottsconsultinggroup.com Sat Oct 22 17:10:07 2011 From: zgramana at pottsconsultinggroup.com (Zachary Gramana) Date: Sat, 22 Oct 2011 11:10:07 -0400 Subject: [Ironpython-users] IronPython 2.7.1 Released! In-Reply-To: References: Message-ID: Huzzah! Congratulations! On Oct 22, 2011, at 3:29 AM, Jeff Hardy wrote: > On behalf of the IronPython, I'm happy to announce the release of IronPython 2.7.1. Like IronPython 2.7, this release requires .NET 4 or Silverlight 4. This release will replace any existing IronPython installation. > > The biggest improvement in IronPython 2.7.1 is support for the unicodedata, csv, and ats modules. The other Python standard library modules have been upgraded to match Python 2.7.2. > > There has also been a number of bug fixes to make IronPython generally more compatible with CPython. > > Finally, the IronPython Tools for Visual Studio have been deprecated in favour of the Python Tools for Visual Studio. > > See the list of fixed issues for details on what has changed since IronPython 2.7. > > - Jeff > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > http://mail.python.org/mailman/listinfo/ironpython-users -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrwizard82d1 at gmail.com Sun Oct 23 01:33:07 2011 From: mrwizard82d1 at gmail.com (Larry Jones) Date: Sat, 22 Oct 2011 18:33:07 -0500 Subject: [Ironpython-users] IronPython 2.7.1 Released! In-Reply-To: <4EA28A42.406@duber.cz> References: <4EA28A42.406@duber.cz> Message-ID: <4EA352B3.4040501@gmail.com> +1! On 10/22/2011 4:17 AM, Luk?? Dub?da wrote: > Congratulations everyone! Nice work! :) > > Luk?? Dub?da > Director > [T] +420 602 444 164 > > duber studio(tm) > [M] info at duber.cz > [W] http://www.duber.cz > > [A] R.A.Dvorsk?ho 601, Praha 10 > [A] 10900, Czech Republic, Europe > > On 22.10.2011 10:47, Davy Mitchell wrote: >> Well done everyone! >> >> On 22 October 2011 08:29, Jeff Hardy wrote: >>> On behalf of the IronPython, I'm happy to announce the release of >>> IronPython >>> 2.7.1. Like IronPython 2.7, this release requires .NET 4 or Silverlight >>> 4. This release will replace any existing IronPython installation. >>> >>> The biggest improvement in IronPython 2.7.1 is support for the >>> unicodedata, >>> csv, and ats modules. The other Python standard library modules have >>> been >>> upgraded to match Python 2.7.2. >>> >>> There has also been a number of bug fixes to make IronPython >>> generally more >>> compatible with CPython. >>> >>> Finally, the IronPython Tools for Visual Studio have been deprecated in >>> favour of the Python Tools for Visual Studio. >>> >>> See the list of fixed issues for details on what has changed since >>> IronPython 2.7. >>> - Jeff >>> _______________________________________________ >>> Ironpython-users mailing list >>> Ironpython-users at python.org >>> http://mail.python.org/mailman/listinfo/ironpython-users >>> >>> >> >> >> > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > http://mail.python.org/mailman/listinfo/ironpython-users -- Lawrence Allan Jones Software Architect, Designer, Developer, Team Lead Improving the software experience for managers, developers, and customers. http://www.linkedin.com/in/lajones13f9 From darnold992000 at yahoo.com Sun Oct 23 02:26:24 2011 From: darnold992000 at yahoo.com (Don Arnold) Date: Sat, 22 Oct 2011 17:26:24 -0700 (PDT) Subject: [Ironpython-users] how to uninstall IronPython Tools for Visual Studio 1.0? Message-ID: <1319329584.31339.YahooMailNeo@web160804.mail.bf1.yahoo.com> I'm quite interested in trying out the new PTVS, but i cannot for the life of me figure out how to uninstall the old "IronPython Tools for Visual Studio 1.0". Does anyone have a (relatively simple) step-by-step guide on how to do so? -------------- next part -------------- An HTML attachment was scrubbed... URL: From no_reply at codeplex.com Sun Oct 23 13:06:36 2011 From: no_reply at codeplex.com (no_reply at codeplex.com) Date: 23 Oct 2011 04:06:36 -0700 Subject: [Ironpython-users] IronPython, Daily Digest 10/22/2011 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [Status update] IOError: Unable to write data to the transport connection: cannot access a disposed object. 2. [Status update] Inconsistent Behavior of %d in string substitution 3. [Status update] PythonSha.sha.update missing overload that takes PythonBuffer objects 4. [Status update] Please add a function somewhere which returns the underlying byte[] from a bytes object 5. [Status update] os.access(..., os.F_OK) is incorrect for directories 6. [Status update] ssl IE gets disconnected after request, CPython doesn't. ---------------------------------------------- ISSUES 1. [Status update] IOError: Unable to write data to the transport connection: cannot access a disposed object. http://ironpython.codeplex.com/workitem/31439 User jdhardy has updated the issue: Status has changed from Fixed to Closed with the following comment, "Fixed in 2.7.1 Beta 3."----------------- 2. [Status update] Inconsistent Behavior of %d in string substitution http://ironpython.codeplex.com/workitem/31049 User jdhardy has updated the issue: Status has changed from Fixed to Closed with the following comment, "Fixed in 2.7.1 Beta 3."----------------- 3. [Status update] PythonSha.sha.update missing overload that takes PythonBuffer objects http://ironpython.codeplex.com/workitem/30888 User jdhardy has updated the issue: Status has changed from Fixed to Closed with the following comment, "Fixed in 2.7.1 Beta 3."----------------- 4. [Status update] Please add a function somewhere which returns the underlying byte[] from a bytes object http://ironpython.codeplex.com/workitem/27175 User jdhardy has updated the issue: Status has changed from Fixed to Closed with the following comment, "Fixed in 2.7.1 Beta 3."----------------- 5. [Status update] os.access(..., os.F_OK) is incorrect for directories http://ironpython.codeplex.com/workitem/31079 User jdhardy has updated the issue: Status has changed from Fixed to Closed with the following comment, "Fixed in 2.7.1 Beta 3."----------------- 6. [Status update] ssl IE gets disconnected after request, CPython doesn't. http://ironpython.codeplex.com/workitem/26852 User jdhardy has updated the issue: Status has changed from Fixed to Closed with the following comment, "Fixed in 2.7.1 Beta 3." ---------------------------------------------- ---------------------------------------------- You are receiving this email because you subscribed to notifications on CodePlex. To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdhardy at gmail.com Mon Oct 24 00:47:22 2011 From: jdhardy at gmail.com (Jeff Hardy) Date: Sun, 23 Oct 2011 15:47:22 -0700 Subject: [Ironpython-users] how to uninstall IronPython Tools for Visual Studio 1.0? In-Reply-To: <1319329584.31339.YahooMailNeo@web160804.mail.bf1.yahoo.com> References: <1319329584.31339.YahooMailNeo@web160804.mail.bf1.yahoo.com> Message-ID: On Sat, Oct 22, 2011 at 5:26 PM, Don Arnold wrote: > I'm quite interested in trying out the new PTVS, but i cannot for the life > of me figure out how to uninstall the old "IronPython Tools for Visual > Studio 1.0". Does anyone have a (relatively simple) step-by-step guide on > how to do so? 1. Uninstall IronPython. 2. Reinstall IronPython, but make sure "IronPython Tools for Visual Studio" is disabled (it is by default in 2.7.1). You *should* be able to remove it by doing a repair install, but I've never gotten that to work. The full cycle has always worked for me. - Jeff From bernd.viehmann at googlemail.com Mon Oct 24 09:30:41 2011 From: bernd.viehmann at googlemail.com (Bernd Viehmann) Date: Mon, 24 Oct 2011 09:30:41 +0200 Subject: [Ironpython-users] q: how to configure site-packages folder for ironpython/asp.net Message-ID: Hi, currently i am trying to get a mongo-db running in an asp.net application written in ironpython. I am trying to use the python-driver pymongo. I have installed the modules in the site-packages folder and i am able to use it in my python25- and also in my ironpython- commandline interpreter. I can connect to the db and play with it. But its is not working in my asp.net application. When i fstart the webform i get following error message: Parser Error Message: No module named collections Here is my test code-behind: webform.aspx.py-------------------------------------------------------------------------------------------- from pymongo import Connection def Page_Load(sender, e): connection = Connection() def Button1_Click(sender, e): pass --------------------------------------------------------------------------------------------------------------- In the Global.py I have made following configuration: def Application_Start(): ' Code that runs on application startup' # if you want to use stdrt-py-libs in yout iron-python app add the folder import sys sys.path.append('C:\\Python25\\Lib') sys.path.append('C:\\Python25\\Lib\\site-packages') Anyone here who can tell me what's wrong? And BTW does someone here tried the mongo-db with ipy and the clr-driver? Thanks much for your help & kind regards Bernd -- Mit freundlichen Gr??en Bernd Viehmann Mahrweg 46 41836 H?ckelhoven Tel.: 02433 9640 100 Fax: 02433 9640 109 From igor.brejc at gmail.com Mon Oct 24 09:56:45 2011 From: igor.brejc at gmail.com (Igor Brejc) Date: Mon, 24 Oct 2011 09:56:45 +0200 Subject: [Ironpython-users] Getting started reference In-Reply-To: <1318797194.2381.YahooMailNeo@web88616.mail.bf1.yahoo.com> References: <1318797194.2381.YahooMailNeo@web88616.mail.bf1.yahoo.com> Message-ID: Hi Bruce, I have not done any WPF myself, but there are a lot of resources on the web: - http://www.ironpython.info/index.php/WPF_Example - google "ironpython wpf" I can also recommend "IronPython in Action" book, it has a chapter on WPF. As for "label1.contents", shouldn't it be "label1.Content" ? Igor On Sun, Oct 16, 2011 at 10:33 PM, Bruce Anderson wrote: > I've done some WPF in C# using VisualStudio 2010 and I've done some Python > in IDLE, but I've never done IronPython using WPF in VS2010. > > Are there any references or web pages to help people get to First base? > (I'm looking specifically for IronPython WPF using VS2010 - I've found so > many generic pages that my eyes are tired - but absolutely nada about what I > need to get started.) I have Foorde's book - but it pre-dates the > integration of WPF, VS and IronPython, so it doesn't seem to help. > > For example, I fired up VS2010, built an IronPython WPF application and > added a button and a label. I have the XAML code and the PY code. > > But how do I reference the controls from my Python code-behind? I've tried > the way I would do it from C# (e.g. label1.contents = "Hello World") - but > that just gives me an "Unbound Name Exception" unhandled error. I even tried > setting properties of "self" in the button_click handler - but that didn't > work either. > > This has got to be simple - can someone point me in the right direction? > > Bruce Anderson > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users at python.org > http://mail.python.org/mailman/listinfo/ironpython-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From no_reply at codeplex.com Mon Oct 24 13:15:51 2011 From: no_reply at codeplex.com (no_reply at codeplex.com) Date: 24 Oct 2011 04:15:51 -0700 Subject: [Ironpython-users] IronPython, Daily Digest 10/23/2011 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [Status update] Typo 2. [Status update] ArgumentException when using SetTrace 3. [Status update] Lib/config directory not present in zip distribution. 4. [Status update] Update ElementTree to IronPython compatible version ---------------------------------------------- ISSUES 1. [Status update] Typo http://ironpython.codeplex.com/workitem/28772 User jdhardy has updated the issue: Status has changed from Fixed to Closed with the following comment, "Fixed in 2.7.1 RC."----------------- 2. [Status update] ArgumentException when using SetTrace http://ironpython.codeplex.com/workitem/31308 User jdhardy has updated the issue: Status has changed from Fixed to Closed with the following comment, "Fixed in 2.7.1 RC."----------------- 3. [Status update] Lib/config directory not present in zip distribution. http://ironpython.codeplex.com/workitem/31417 User jdhardy has updated the issue: Status has changed from Fixed to Closed with the following comment, "Fixed in 2.7.1 RC."----------------- 4. [Status update] Update ElementTree to IronPython compatible version http://ironpython.codeplex.com/workitem/31579 User jdhardy has updated the issue: Status has changed from Fixed to Closed with the following comment, "Fixed in 2.7.1." ---------------------------------------------- ---------------------------------------------- You are receiving this email because you subscribed to notifications on CodePlex. To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jhcd.jhcd at gmail.com Mon Oct 24 18:52:00 2011 From: jhcd.jhcd at gmail.com (John Dickinson) Date: Mon, 24 Oct 2011 17:52:00 +0100 Subject: [Ironpython-users] Unhandled .Net Exception Message-ID: Hello, I was looking at adding a handler for otherwise-uncaught .Net exceptions, and had found this page: http://www.ironpython.info/index.php/Handling_Unhandled_Exceptions useful. However, the code shown falls over where he's trying to get a nicely formatted python exception here: from IronPython.Hosting import PythonEngine pyE = PythonEngine() print pyE.FormatException(event.Exception) where I get "ImportError: No module named Hosting". At the bottom he has a note saying: "For IronPython 2.0, the code to format the exception from a PythonEngine is slightly different: import clr clr.AddReference('IronPython') from IronPython.Hosting import PythonEngine PythonEngine.CurrentEngine.FormatException(someException) " which gives me "ImportError: Cannot import name PythonEngine". I'm using IronPython 2.7.0.40 with .Net 4.0.30319.239. I assume the API has changed here; can anyone tell me if there is a way to do something like this FormatException in IronPython 2.7? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Mon Oct 24 19:16:43 2011 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 24 Oct 2011 17:16:43 +0000 Subject: [Ironpython-users] Unhandled .Net Exception In-Reply-To: References: Message-ID: <6C7ABA8B4E309440B857D74348836F2E3F83DB29@TK5EX14MBXC292.redmond.corp.microsoft.com> This should do it - the hosting APIs changed quite a bit between 2.0 and 2.7: import clr clr.AddReference('IronPython') from IronPython.Runtime import PythonContext import System clr.GetCurrentRuntime().GetLanguage(PythonContext).FormatException(System.Exception()) There could be other variations such as using GetLanguageByExtension and not needing to add a ref to IronPython but those will require that the script runtime has the languages properly registered. From: ironpython-users-bounces+dinov=exchange.microsoft.com at python.org [mailto:ironpython-users-bounces+dinov=exchange.microsoft.com at python.org] On Behalf Of John Dickinson Sent: Monday, October 24, 2011 9:52 AM To: ironpython-users at python.org Subject: [Ironpython-users] Unhandled .Net Exception Hello, I was looking at adding a handler for otherwise-uncaught .Net exceptions, and had found this page: http://www.ironpython.info/index.php/Handling_Unhandled_Exceptions useful. However, the code shown falls over where he's trying to get a nicely formatted python exception here: from IronPython.Hosting import PythonEngine pyE = PythonEngine() print pyE.FormatException(event.Exception) where I get "ImportError: No module named Hosting". At the bottom he has a note saying: "For IronPython 2.0, the code to format the exception from a PythonEngine is slightly different: import clr clr.AddReference('IronPython') from IronPython.Hosting import PythonEngine PythonEngine.CurrentEngine.FormatException(someException) " which gives me "ImportError: Cannot import name PythonEngine". I'm using IronPython 2.7.0.40 with .Net 4.0.30319.239. I assume the API has changed here; can anyone tell me if there is a way to do something like this FormatException in IronPython 2.7? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jhcd.jhcd at gmail.com Tue Oct 25 12:33:21 2011 From: jhcd.jhcd at gmail.com (John Dickinson) Date: Tue, 25 Oct 2011 11:33:21 +0100 Subject: [Ironpython-users] Unhandled .Net Exception In-Reply-To: <6C7ABA8B4E309440B857D74348836F2E3F83DB29@TK5EX14MBXC292.redmond.corp.microsoft.com> References: <6C7ABA8B4E309440B857D74348836F2E3F83DB29@TK5EX14MBXC292.redmond.corp.microsoft.com> Message-ID: Thanks Dino, that's exactly what I wanted! On Mon, Oct 24, 2011 at 6:16 PM, Dino Viehland wrote: > This should do it ? the hosting APIs changed quite a bit between 2.0 and > 2.7:**** > > import clr**** > > clr.AddReference('IronPython')**** > > from IronPython.Runtime import PythonContext**** > > import System**** > > > clr.GetCurrentRuntime().GetLanguage(PythonContext).FormatException(System.Exception()) > **** > > ** ** > > There could be other variations such as using GetLanguageByExtension and > not needing to add a ref to IronPython but those will require that the > script runtime has the languages properly registered.**** > > ** ** > > *From:* ironpython-users-bounces+dinov=exchange.microsoft.com at python.org[mailto: > ironpython-users-bounces+dinov=exchange.microsoft.com at python.org] *On > Behalf Of *John Dickinson > *Sent:* Monday, October 24, 2011 9:52 AM > *To:* ironpython-users at python.org > *Subject:* [Ironpython-users] Unhandled .Net Exception**** > > ** ** > > Hello, I was looking at adding a handler for otherwise-uncaught .Net > exceptions, and had found this page: > http://www.ironpython.info/index.php/Handling_Unhandled_Exceptionsuseful. However, the code shown falls over where he's trying to get a > nicely formatted python exception here:**** > > from IronPython.Hosting import PythonEngine**** > > pyE = PythonEngine()**** > > print pyE.FormatException(event.Exception)**** > > where I get "ImportError: No module named Hosting". At the bottom he has a > note saying:**** > > "For IronPython 2.0, the code to format the exception from a PythonEngine > is slightly different: **** > > import clr**** > > clr.AddReference('IronPython')**** > > from IronPython.Hosting import PythonEngine**** > > PythonEngine.CurrentEngine.FormatException(someException)**** > > " > > which gives me "ImportError: Cannot import name PythonEngine". > > I'm using IronPython 2.7.0.40 with .Net 4.0.30319.239. I assume the API > has changed here; can anyone tell me if there is a way to do something like > this FormatException in IronPython 2.7? > > Thanks.**** > -------------- next part -------------- An HTML attachment was scrubbed... URL: From no_reply at codeplex.com Thu Oct 27 12:23:55 2011 From: no_reply at codeplex.com (no_reply at codeplex.com) Date: 27 Oct 2011 03:23:55 -0700 Subject: [Ironpython-users] IronPython, Daily Digest 10/26/2011 Message-ID: Hi ironpython, Here's your Daily Digest of new issues for project "IronPython". In today's digest:ISSUES 1. [New comment] cannot invoke explicitly implemented generic interface methods ---------------------------------------------- ISSUES 1. [New comment] cannot invoke explicitly implemented generic interface methods http://ironpython.codeplex.com/workitem/28280 User bernd_v has commented on the issue: "I have the same problem. I want to use the mongoDB .NET driver. server.RequestStart(nejobaDb) # insert the country-list into a collection ctrContainer = MongoCollection[BsonDocument] lst = List[BsonDocument]() for atm in ctry.dataBag : doc = BsonDocument() doc.Add('country', atm.Country ) doc.Add('a2code' , atm.A2code ) doc.Add('a3code' , atm.A3code ) doc.Add('Number' , atm.Number ) lst.Add(doc) ctrContainer.InsertBatch[BsonDocument](lst) server.RequestDone() IronPython.Runtime.Exceptions.TypeErrorException was unhandled by user code Message='method_descriptor' object is unsubscriptable Source=Anonymously Hosted DynamicMethods Assembly StackTrace: bei CallSite.Target(Closure , CallSite , Object , Object ) bei System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) bei __main__$1.__main__(FunctionCode $functionCode) in D:\develop\ipy\mongo_with_dotnet\mongoDbFirst\mongoDbFirst\mongoDbFirst.py:Zeile 74. bei IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope) bei IronPython.Compiler.RuntimeScriptCode.Run(Scope scope) bei IronPython.Hosting.PythonCommandLine.RunFileWorker(String fileName) bei IronPython.Hosting.PythonCommandLine.RunFile(String fileName) InnerException: kind regards & thx 4 your work :-)" ---------------------------------------------- ---------------------------------------------- You are receiving this email because you subscribed to notifications on CodePlex. To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From loocas at duber.cz Fri Oct 28 09:55:19 2011 From: loocas at duber.cz (=?UTF-8?B?THVrw6HFoSBEdWLEm2Rh?=) Date: Fri, 28 Oct 2011 09:55:19 +0200 Subject: [Ironpython-users] IDNA encoding missing in IPy Message-ID: <4EAA5FE7.50803@duber.cz> Hi there everyone, I'm currently trying to use a new API for a package written in Python, that uses JSON for its calls. However, I'm bumping into a problem where IronPython throws me errors that it's missing a certain encoding module. Concretely IDNA. http://docs.python.org/library/codecs.html#module-encodings.idna Is there anything that can be done in this regard with IronPython? Thank you in advance, cheers, -- Luk?? Dub?da Director [T] +420 602 444 164 duber studio(tm) [M] info at duber.cz [W] http://www.duber.cz [A] R.A.Dvorsk?ho 601, Praha 10 [A] 10900, Czech Republic, Europe From pawel.jasinski at gmail.com Fri Oct 28 16:08:29 2011 From: pawel.jasinski at gmail.com (Pawel Jasinski) Date: Fri, 28 Oct 2011 16:08:29 +0200 Subject: [Ironpython-users] open xml sdk v2.0 Message-ID: hi, I am trying to use openxml sdk v2.0 together with python 2.7.1 (was 2.7.0). I have managed to generate the mini document out of the csharp (http://msdn.microsoft.com/en-us/library/dd440953%28v=office.12%29.aspx) However if I try to do it from python, the produced document is corrupted. Word complains about 'parts missing or invalid'. Unzip spits the following: $ unzip -t ../foobar.docx Archive: ?../foobar.docx ? ?testing: word/document.xml ?error: ?invalid compressed data to inflate ? ?testing: _rels/.rels ? ? ? ? ? ? ?OK At least one error was detected in ../foobar.docx. Is there some sort of fundamental incompatibility between openxml sdk and ironpython? Mixed zip libraries? The test code: import clr clr.AddReferenceToFileAndPath("C:\Program Files\Open XML SDK\V2.0\lib\DocumentFormat.OpenXml.dll") from DocumentFormat.OpenXml.Packaging import WordprocessingDocument from DocumentFormat.OpenXml import WordprocessingDocumentType from DocumentFormat.OpenXml.Wordprocessing import Text,Paragraph,Run,Document, Body package = WordprocessingDocument.Create( 'c:/Users/rejap/Desktop/foobar.docx', WordprocessingDocumentType.Document) package.AddMainDocumentPart() package.MainDocumentPart.Document = Document(Body(Paragraph(Run(Text("""asdfasdfasdfaasdfa"""))))) package.MainDocumentPart.Document.Save() --Pawel From super24bitsound at hotmail.com Fri Oct 28 17:38:47 2011 From: super24bitsound at hotmail.com (Jay Riley) Date: Fri, 28 Oct 2011 11:38:47 -0400 Subject: [Ironpython-users] Manipulating/Reversing the Ironpython AST Message-ID: Hi all, I was wondering if IronPython has the ability to reverse/unparse the AST back into a ource file? Or if someone has perhaps built something to do so? Here's what I'm trying to do: I have a game I'm working on, and I'm currently drafting up tools for it. The tools are being written in C# and are meant to make changing and editing game files easier. Several of the game files are written in python and are used to extend objects from the main game source. For instace, I have an Items.py file that contains the following (minimalized for example): from ItemModule import * import copy class ScriptedItem(Item): def __init__(self, name, description, itemtypes, primarytype, flags, usability, value, throwpower): Item.__init__(self, name, description, itemtypes, primarytype, flags, usability, value, throwpower, Item.GetNextItemID()) def Clone(self): return copy.deepcopy(self) ItemLibrary.AddItem(ScriptedItem("Abounding Crystal", "A colourful crystal composed of many smaller crystals. It gives off a warm glow.", ItemType.SynthesisMaterial, ItemType.SynthesisMaterial, 0, ItemUsage.Unusable, 0, 50)) In this case, I'd like to provide a convenient front-end to allow editors to modify/add/delete items from the list. To do this, my editor need to be able to: Find and list all the class types (in this example, it'd be only Scripted Item) Find and list all created items (in this case there'd only be one, Abounding Crystal). I'd need to find the type (in this caseScriptedItem) and all the parameter values Allow editing of parameters and the creation/removal of items. I tried writing my own parser, but that became increasingly difficult as the complexity of the Item constructors went up. When I found IronPython and its ability to generate a walkable AST, I thought I'd found my solution, and indeed the AST makes it easy to accomplish 1 and 2 of my requirements. However, I'm currently stuck on how to write back changes made in my editor to the source file. My initial idea was to preserve the AST and modify values on the existing nodes for edited items and inject new nodes when new items were created. However even if I could get this to work correctly, I have no idea how to reconvert the AST back into a source file. When I asked on stackoverflow, I was told this is usually done using "prettyprinting" and had some suggestions to use python's "inspect" property. I'm not sure how to use inspect to do what I want, and have some concerns over the amount of effort require to get "prettyprinting" correct, so i wanted to ask if anyone here has written a prettyprinter for ironpython or perhaps knows some other way to accomplish my three goals? Any help would be appreciated, Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From rome at Wintellect.com Fri Oct 28 18:31:27 2011 From: rome at Wintellect.com (Keith Rome) Date: Fri, 28 Oct 2011 09:31:27 -0700 Subject: [Ironpython-users] Manipulating/Reversing the Ironpython AST In-Reply-To: References: Message-ID: <7737799D90E55E4BB9C9F7E40D161E110E3A1A2112@VA3DIAXVS461.RED001.local> If that is the entirety of your solution's requirements, then if I were in your shoes I would just cheat... I presume ItemModule is a CLR namespace, sourced from an assembly you have loaded via sys.AddReference (or similar technique). In that case, I would create a mock version of that assembly that your tool uses. It would define all of the same interfaces, classes, enums, etc that your script is using from the real one; however the ItemLibrary.AddItem() method would just capture the incoming values for the tool to work with. The tool would simply host IronPython, load your mocked assembly instead of the real one, create a new ScriptScope, and run the script within it while capturing those incoming values. This would give the tool data to work with, I assume displaying it in some friendly UI format. After making some changes using the UI tool, it should have no problem writing out a new python file that includes the modified parameters / items. Hack? Yes. But far simpler than dealing with AST and generic code emit. Keith Rome Senior Consultant and Architect MCPD-EAD, MCSD, MCDBA, MCTS-WPF, MCTS-TFS, MCTS-WSS Wintellect | 770.617.4016 | krome at wintellect.com www.wintellect.com From: ironpython-users-bounces+rome=wintellect.com at python.org [mailto:ironpython-users-bounces+rome=wintellect.com at python.org] On Behalf Of Jay Riley Sent: Friday, October 28, 2011 11:39 AM To: ironpython-users at python.org Subject: [Ironpython-users] Manipulating/Reversing the Ironpython AST Hi all, I was wondering if IronPython has the ability to reverse/unparse the AST back into a ource file? Or if someone has perhaps built something to do so? Here's what I'm trying to do: I have a game I'm working on, and I'm currently drafting up tools for it. The tools are being written in C# and are meant to make changing and editing game files easier. Several of the game files are written in python and are used to extend objects from the main game source. For instace, I have an Items.py file that contains the following (minimalized for example): from ItemModule import * import copy class ScriptedItem(Item): def __init__(self, name, description, itemtypes, primarytype, flags, usability, value, throwpower): Item.__init__(self, name, description, itemtypes, primarytype, flags, usability, value, throwpower, Item.GetNextItemID()) def Clone(self): return copy.deepcopy(self) ItemLibrary.AddItem(ScriptedItem("Abounding Crystal", "A colourful crystal composed of many smaller crystals. It gives off a warm glow.", ItemType.SynthesisMaterial, ItemType.SynthesisMaterial, 0, ItemUsage.Unusable, 0, 50)) In this case, I'd like to provide a convenient front-end to allow editors to modify/add/delete items from the list. To do this, my editor need to be able to: 1. Find and list all the class types (in this example, it'd be only Scripted Item) 2. Find and list all created items (in this case there'd only be one, Abounding Crystal). I'd need to find the type (in this caseScriptedItem) and all the parameter values 3. Allow editing of parameters and the creation/removal of items. I tried writing my own parser, but that became increasingly difficult as the complexity of the Item constructors went up. When I found IronPython and its ability to generate a walkable AST, I thought I'd found my solution, and indeed the AST makes it easy to accomplish 1 and 2 of my requirements. However, I'm currently stuck on how to write back changes made in my editor to the source file. My initial idea was to preserve the AST and modify values on the existing nodes for edited items and inject new nodes when new items were created. However even if I could get this to work correctly, I have no idea how to reconvert the AST back into a source file. When I asked on stackoverflow, I was told this is usually done using "prettyprinting" and had some suggestions to use python's "inspect" property. I'm not sure how to use inspect to do what I want, and have some concerns over the amount of effort require to get "prettyprinting" correct, so i wanted to ask if anyone here has written a prettyprinter for ironpython or perhaps knows some other way to accomplish my three goals? Any help would be appreciated, Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Fri Oct 28 19:14:18 2011 From: dinov at microsoft.com (Dino Viehland) Date: Fri, 28 Oct 2011 17:14:18 +0000 Subject: [Ironpython-users] Manipulating/Reversing the Ironpython AST In-Reply-To: References: Message-ID: <6C7ABA8B4E309440B857D74348836F2E3F84B14E@TK5EX14MBXC292.redmond.corp.microsoft.com> PTVS's parser (which is just a branch of the IronPython parser) supports this so that we could implement the refactoring features. The nodes have a ToCodeString method on them which you can call to get back the original code. You'll need to parse in verbatim mode like so: var parser = Parser.CreateParser( someTextReader, Project.LanguageVersion, new ParserOptions() { Verbatim = true, BindReferences = true } ); var ast = parser.ParseFile(); And you'll need to pass the PythonAst that you get back into the ToCodeString as all of the verbatim round-trip info is stored on the top-level Ast node. This will preserve comments, whitespace, etc... You can modify the AST in any way you want and still call ToCodeString - the nodes which you insert will all get some default amount of formatting. You'll want to pass in the original PythonAst that you used to parse the nodes with. There's some random helper methods like CopyLeadingWhiteSpace and CopyTrailingNewLine on the Node classes for manipulating some of the round trip info - it's not exhaustive, just what we've needed for PTVS's refactoring support. You can always download the source and add more or contribute back changes if you need some specific additions. The parser is in Microsoft.PythonTools.Analysis.dll which is a stand-alone DLL (no dependencies on anything outside of the .NET framework). If you want to get a copy of the DLL you can just download and install PTVS (http://pytools.codeplex.com/) and then the DLL will either be in: VSINSTALLDIR\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\1.0 or %LOCALAPPDATA%\Microsoft\VisualStudio\10.0\Extensions\Microsoft\Python Tools for Visual Studio\1.0 Depending on if you did the default (all-users) install or the per-user install. The only thing that's possibly missing is that we don't have a good AST re-writer, so you'll need to do that by hand or implement something like the DLR ExpressionVisitor class. From: ironpython-users-bounces+dinov=exchange.microsoft.com at python.org [mailto:ironpython-users-bounces+dinov=exchange.microsoft.com at python.org] On Behalf Of Jay Riley Sent: Friday, October 28, 2011 8:39 AM To: ironpython-users at python.org Subject: [Ironpython-users] Manipulating/Reversing the Ironpython AST Hi all, I was wondering if IronPython has the ability to reverse/unparse the AST back into a ource file? Or if someone has perhaps built something to do so? Here's what I'm trying to do: I have a game I'm working on, and I'm currently drafting up tools for it. The tools are being written in C# and are meant to make changing and editing game files easier. Several of the game files are written in python and are used to extend objects from the main game source. For instace, I have an Items.py file that contains the following (minimalized for example): from ItemModule import * import copy class ScriptedItem(Item): def __init__(self, name, description, itemtypes, primarytype, flags, usability, value, throwpower): Item.__init__(self, name, description, itemtypes, primarytype, flags, usability, value, throwpower, Item.GetNextItemID()) def Clone(self): return copy.deepcopy(self) ItemLibrary.AddItem(ScriptedItem("Abounding Crystal", "A colourful crystal composed of many smaller crystals. It gives off a warm glow.", ItemType.SynthesisMaterial, ItemType.SynthesisMaterial, 0, ItemUsage.Unusable, 0, 50)) In this case, I'd like to provide a convenient front-end to allow editors to modify/add/delete items from the list. To do this, my editor need to be able to: 1. Find and list all the class types (in this example, it'd be only Scripted Item) 2. Find and list all created items (in this case there'd only be one, Abounding Crystal). I'd need to find the type (in this caseScriptedItem) and all the parameter values 3. Allow editing of parameters and the creation/removal of items. I tried writing my own parser, but that became increasingly difficult as the complexity of the Item constructors went up. When I found IronPython and its ability to generate a walkable AST, I thought I'd found my solution, and indeed the AST makes it easy to accomplish 1 and 2 of my requirements. However, I'm currently stuck on how to write back changes made in my editor to the source file. My initial idea was to preserve the AST and modify values on the existing nodes for edited items and inject new nodes when new items were created. However even if I could get this to work correctly, I have no idea how to reconvert the AST back into a source file. When I asked on stackoverflow, I was told this is usually done using "prettyprinting" and had some suggestions to use python's "inspect" property. I'm not sure how to use inspect to do what I want, and have some concerns over the amount of effort require to get "prettyprinting" correct, so i wanted to ask if anyone here has written a prettyprinter for ironpython or perhaps knows some other way to accomplish my three goals? Any help would be appreciated, Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: