From sanxiyn at gmail.com Thu Jun 1 03:14:09 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Thu, 1 Jun 2006 10:14:09 +0900 Subject: [IronPython] Better dir() for Enum Message-ID: <5b0248170605311814v63db5f92ue2b7d8f7206b11bc@mail.gmail.com> Let's illustrate this feature request with an interactive session: >>> import System >>> dir(System.IO.FileMode) ['Append', 'CompareTo', 'Create', 'CreateNew', 'Equals', 'Finalize', 'Format', 'GetHashCode', 'GetName', 'GetNames', 'GetType', 'GetTypeCode', 'GetUnderlyingType', 'GetValues', 'IsDefined', 'MemberwiseClone', 'Open', 'OpenOrCreate', 'Parse', 'ToBoolean', 'ToByte', 'ToChar', 'ToDateTime', 'ToDecimal', 'ToDouble', 'ToInt16', 'ToInt32', 'ToInt64', 'ToObject', 'ToSByte', 'ToSingle', 'ToString', 'ToType', 'ToUInt16', 'ToUInt32', 'ToUInt64', 'Truncate', '__class__', '__init__', '__module__', '__repr__', 'value__'] >>> sorted(System.Enum.GetNames(System.IO.FileMode)) ['Append', 'Create', 'CreateNew', 'Open', 'OpenOrCreate', 'Truncate'] I think there's no doubt that the later output is more useful. But I'm not sure whether this feature request interferes with other possible features of IronPython. If the above is undesirable, at least this could be improved: >>> print System.IO.FileMode.__doc__ no documentation available Seo Sanghyeon From sanxiyn at gmail.com Thu Jun 1 03:19:15 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Thu, 1 Jun 2006 10:19:15 +0900 Subject: [IronPython] help(), in the mean time Message-ID: <5b0248170605311819ia8f5831t6de50053d775f7b3@mail.gmail.com> Currently help() raises NotImplementedError. But in the mean time, I would like to have help(obj) as an equivalent to print obj.__doc__. It's not like CPython's help(), but it is certainly more useful than the current behaviour. What do you think? Seo Sanghyeon From dinov at exchange.microsoft.com Thu Jun 1 03:23:05 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Wed, 31 May 2006 18:23:05 -0700 Subject: [IronPython] Better dir() for Enum In-Reply-To: <5b0248170605311814v63db5f92ue2b7d8f7206b11bc@mail.gmail.com> References: <5b0248170605311814v63db5f92ue2b7d8f7206b11bc@mail.gmail.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E01E1D38694@df-foxhound-msg.exchange.corp.microsoft.com> I like the __doc__ idea a lot. I don't think we want to go changing the semantics of dir, but obviously we can put anything we want in __doc__. We're also planning in finally implementing help(), which would also presumably include this info, so ulitmately it'll only be one more character than dir(). ________________________________________ From: users-bounces at lists.ironpython.com On Behalf Of Sanghyeon Seo Sent: Wednesday, May 31, 2006 6:14 PM To: Discussion of IronPython Subject: [IronPython] Better dir() for Enum Let's illustrate this feature request with an interactive session: >>> import System >>> dir(System.IO.FileMode) ['Append', 'CompareTo', 'Create', 'CreateNew', 'Equals', 'Finalize', 'Format', 'GetHashCode', 'GetName', 'GetNames', 'GetType', 'GetTypeCode', 'GetUnderlyingType', 'GetValues', 'IsDefined', 'MemberwiseClone', 'Open', 'OpenOrCreate', 'Parse', 'ToBoolean', 'ToByte', 'ToChar', 'ToDateTime', 'ToDecimal', 'ToDouble', 'ToInt16', 'ToInt32', 'ToInt64', 'ToObject', 'ToSByte', 'ToSingle', 'ToString', 'ToType', 'ToUInt16', 'ToUInt32', 'ToUInt64', 'Truncate', '__class__', '__init__', '__module__', '__repr__', 'value__'] >>> sorted(System.Enum.GetNames(System.IO.FileMode)) ['Append', 'Create', 'CreateNew', 'Open', 'OpenOrCreate', 'Truncate'] I think there's no doubt that the later output is more useful. But I'm not sure whether this feature request interferes with other possible features of IronPython. If the above is undesirable, at least this could be improved: >>> print System.IO.FileMode.__doc__ no documentation available Seo Sanghyeon _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 4466 bytes Desc: not available URL: From korpse-ironpython at kaydash.za.net Thu Jun 1 09:15:54 2006 From: korpse-ironpython at kaydash.za.net (Jonathan Jacobs) Date: Thu, 01 Jun 2006 09:15:54 +0200 Subject: [IronPython] help(), in the mean time In-Reply-To: <5b0248170605311819ia8f5831t6de50053d775f7b3@mail.gmail.com> References: <5b0248170605311819ia8f5831t6de50053d775f7b3@mail.gmail.com> Message-ID: <447E942A.2030601@kaydash.za.net> Sanghyeon Seo wrote: > Currently help() raises NotImplementedError. > > But in the mean time, I would like to have help(obj) as an equivalent > to print obj.__doc__. It's not like CPython's help(), but it is > certainly more useful than the current behaviour. I was going to suggest using pydoc.help from the stdlib, but that seems to have it's own problems: >>> from pydoc import help >>> help Traceback (most recent call last): File , line 0, in ##313 File C:\Program Files\Python24\Lib\pydoc.py, line 1640, in __repr__ File C:\Program Files\Python24\Lib\inspect.py, line 819, in stack File , line 0, in _getframe##315 ValueError: _getframe is not implemented -- Jonathan From mbarnett at uniserve.com Thu Jun 1 19:23:41 2006 From: mbarnett at uniserve.com (Lesley & Mitch Barnett) Date: Thu, 1 Jun 2006 10:23:41 -0700 Subject: [IronPython] IronPython support In Visual Studio 2005 April VSSDK? In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E01E18326EC@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <000f01c685a0$22c73520$6401a8c0@NIS1861127372> Here is the code in the interpreter to show Types in Types: does work or is it a bug? IronPython 1.0.2328 (Beta) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> from System.Reflection import * >>> a = Assembly.LoadFrom("mapack.dll") >>> Types = a.GetTypes() >>> for Type in Types: ... print Types ... System.Type[] System.Type[] System.Type[] System.Type[] System.Type[] System.Type[] >>> Types = a.GetTypes() >>> for Types in Types: ... print Types ... Mapack.CholeskyDecomposition Mapack.EigenvalueDecomposition Mapack.LuDecomposition Mapack.Matrix Mapack.QrDecomposition Mapack.SingularValueDecomposition >>> Also, when running the debugger in VS, when it gets to the break point, it asks for the IronPython source code at: "z:\IronPython\Public\Src\IronPython\Runtime\FunctionEnvironment.cs" Should I be pointing something in VS at the IronPython source code? Or is this a bug? Thanks, Mitch _____ From: Dino Viehland [mailto:dinov at exchange.microsoft.com] Sent: May 30, 2006 8:44 AM To: Discussion of IronPython Subject: Re: [IronPython] IronPython support In Visual Studio 2005 April VSSDK? The two files that you see is being done through partial class support which is a language feature that both C# & VB support. Python doesn't have such a feature, and so we've been discussing internally ways we could do this - unfortunately we haven't come up with the ideal solution yet. Ultimately we want to have a very similar experience to C# & VB, but it certainly may not be the same. I believe our next round of VS integration work will enable the drop-down list for types & members. Debugging should work today, although you won't get the greatest display for your locals or classes always - but you can at least step through. I don't believe we have any specific plans to improve debugging immediately. You should be able to place your code anywhere in Form1.py. The CodeDom parser should just merge generated code in along w/ your code. If you run into any issues there let us know :-). Is the issue w/ the code the one Vagmi pointed out (types in types)? This should work. One suggestion would be to look in the Data property of the exception, and find the Python version of the exception - it may contain more meaningful information. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Lesley & Mitch Barnett Sent: Tuesday, May 30, 2006 5:02 AM To: users at lists.ironpython.com Subject: [IronPython] IronPython support In Visual Studio 2005 April VSSDK? Hi, using the April 2005 VSSDK, I am able fire up a new Visual Studio PythonProject (Experimental Hive) using the Windows Application template. I can drag and drop UI controls from the Toolbox onto the design surface. However, I notice the IronPython code being generated for both the designer and the form is placed in a single file called Form1.py. In a C# WinForm project, the code is separated into 2 files, Form1.cs and From1.Designer.cs. Is the plan to have IronPython fully integrated into Visual Studio in the same way as a C# project, including drop down list for types and members in the code editor? What about debugger support? I ask this as I am trying to build a simple IronPython Windows app and while being new to the Python language I am also finding it difficult to figure out exactly where I put my code in Form1.py cause the both the design code and "regular" code are in one place instead of separated as in a C# project. Finally, I cannot get some simple code to work as it throws an exception, "A first chance exception of type IronPython.Runtime.ArgumentTypeException' occurred in IronPython.dll. When I set the breakpoint to step through the code I get into disassembly and I am not good at reading IL. Then the program aborts with the error above. My project is real simple, has a Windows form and a listBox control. All I am doing is using System.Reflection to GetTypes from a DLL and put them in a listBox. In C# it looks like: private void GetMyTypes() { Assembly myAssembly = System.Reflection.Assembly.LoadFrom("mapack.dll"); Type[] types = myAssembly.GetTypes(); foreach (Type type in types) { listBox1.Items.Add(type); } } In IronPython: def GetMyTypes(): myAssembly = System.Reflection.Assembly.LoadFrom("mapack.dll") types = myAssembly.GetTypes() for types in types: _listBox1.Items.Add(types) In both cases, the method is being called right after InitializeComponent() Any ideas as to why this IronPython code won't run? Thanks in advance, Mitch http://softwareindustrialization.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From jvm_cop at spamcop.net Fri Jun 2 00:57:48 2006 From: jvm_cop at spamcop.net (J. Merrill) Date: Thu, 01 Jun 2006 18:57:48 -0400 Subject: [IronPython] IronPython support In Visual Studio 2005 April VSSDK? In-Reply-To: <000f01c685a0$22c73520$6401a8c0@NIS1861127372> References: <4039D552ADAB094BB1EA670F3E96214E01E18326EC@df-foxhound-msg.exchange.corp.microsoft.com> <000f01c685a0$22c73520$6401a8c0@NIS1861127372> Message-ID: <7.0.1.0.2.20060601185244.087f4a88@wheresmymailserver.com> You have a typo in your first sample, don't you? (See below.) To my way of thinking, by the way, "for Types in Types" does not follow the admonishment to use a separate variable name for each concept / idea. "for Type in Types" certainly makes more sense. "for Type in a.GetTypes()" makes sense. At 01:23 PM 6/1/2006, Lesley & Mitch Barnett wrote >Here is the code in the interpreter to show Types in Types: does work or is it a bug? > >IronPython 1.0.2328 (Beta) on .NET 2.0.50727.42 >Copyright (c) Microsoft Corporation. All rights reserved. >>>> from System.Reflection import * >>>> a = Assembly.LoadFrom("mapack.dll") >>>> Types = a.GetTypes() >>>> for Type in Types: Next line needs to be "print Type" doesn't it? You're just printing the value of Types, which doesn't change, once for each value in Types. >... print Types >... >System.Type[] >System.Type[] >System.Type[] >System.Type[] >System.Type[] >System.Type[] > > >>>> Types = a.GetTypes() >>>> for Types in Types: >... print Types >... >Mapack.CholeskyDecomposition >Mapack.EigenvalueDecomposition >Mapack.LuDecomposition >Mapack.Matrix >Mapack.QrDecomposition >Mapack.SingularValueDecomposition >>>> > >[snip] J. Merrill / Analytical Software Corp -------------- next part -------------- An HTML attachment was scrubbed... URL: From sanxiyn at gmail.com Fri Jun 2 11:57:24 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Fri, 2 Jun 2006 18:57:24 +0900 Subject: [IronPython] Passing keyword arguments to dict subclass Message-ID: <5b0248170606020257u6576f662rbc8bb25e707c2fc8@mail.gmail.com> # test.py class x(dict): pass print x(a=1)['a'] Found while testing Construct (http://pyconstruct.wikispaces.com/) with IronPython. Seo Sanghyeon From mbarnett at uniserve.com Fri Jun 2 13:14:44 2006 From: mbarnett at uniserve.com (Lesley & Mitch Barnett) Date: Fri, 2 Jun 2006 04:14:44 -0700 Subject: [IronPython] IronPython support In Visual Studio 2005 April VSSDK? In-Reply-To: <000f01c685a0$22c73520$6401a8c0@NIS1861127372> Message-ID: <000001c68635$c0469e40$6401a8c0@NIS1861127372> Fixed my own error: >>> from System.Reflection import * >>> a = Assembly.LoadFrom("mapack.dll") >>> Types = a.GetTypes() >>> for Type in Types: ... print Type ... Mapack.CholeskyDecomposition Mapack.EigenvalueDecomposition Mapack.LuDecomposition Mapack.Matrix Mapack.QrDecomposition Mapack.SingularValueDecomposition >>> Still have the VS debugging issue. _____ From: Lesley & Mitch Barnett [mailto:mbarnett at uniserve.com] Sent: June 1, 2006 10:24 AM To: 'Discussion of IronPython' Subject: Re: [IronPython] IronPython support In Visual Studio 2005 April VSSDK? Here is the code in the interpreter to show Types in Types: does work or is it a bug? IronPython 1.0.2328 (Beta) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> from System.Reflection import * >>> a = Assembly.LoadFrom("mapack.dll") >>> Types = a.GetTypes() >>> for Type in Types: ... print Types ... System.Type[] System.Type[] System.Type[] System.Type[] System.Type[] System.Type[] >>> Types = a.GetTypes() >>> for Types in Types: ... print Types ... Mapack.CholeskyDecomposition Mapack.EigenvalueDecomposition Mapack.LuDecomposition Mapack.Matrix Mapack.QrDecomposition Mapack.SingularValueDecomposition >>> Also, when running the debugger in VS, when it gets to the break point, it asks for the IronPython source code at: "z:\IronPython\Public\Src\IronPython\Runtime\FunctionEnvironment.cs" Should I be pointing something in VS at the IronPython source code? Or is this a bug? Thanks, Mitch _____ From: Dino Viehland [mailto:dinov at exchange.microsoft.com] Sent: May 30, 2006 8:44 AM To: Discussion of IronPython Subject: Re: [IronPython] IronPython support In Visual Studio 2005 April VSSDK? The two files that you see is being done through partial class support which is a language feature that both C# & VB support. Python doesn't have such a feature, and so we've been discussing internally ways we could do this - unfortunately we haven't come up with the ideal solution yet. Ultimately we want to have a very similar experience to C# & VB, but it certainly may not be the same. I believe our next round of VS integration work will enable the drop-down list for types & members. Debugging should work today, although you won't get the greatest display for your locals or classes always - but you can at least step through. I don't believe we have any specific plans to improve debugging immediately. You should be able to place your code anywhere in Form1.py. The CodeDom parser should just merge generated code in along w/ your code. If you run into any issues there let us know :-). Is the issue w/ the code the one Vagmi pointed out (types in types)? This should work. One suggestion would be to look in the Data property of the exception, and find the Python version of the exception - it may contain more meaningful information. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Lesley & Mitch Barnett Sent: Tuesday, May 30, 2006 5:02 AM To: users at lists.ironpython.com Subject: [IronPython] IronPython support In Visual Studio 2005 April VSSDK? Hi, using the April 2005 VSSDK, I am able fire up a new Visual Studio PythonProject (Experimental Hive) using the Windows Application template. I can drag and drop UI controls from the Toolbox onto the design surface. However, I notice the IronPython code being generated for both the designer and the form is placed in a single file called Form1.py. In a C# WinForm project, the code is separated into 2 files, Form1.cs and From1.Designer.cs. Is the plan to have IronPython fully integrated into Visual Studio in the same way as a C# project, including drop down list for types and members in the code editor? What about debugger support? I ask this as I am trying to build a simple IronPython Windows app and while being new to the Python language I am also finding it difficult to figure out exactly where I put my code in Form1.py cause the both the design code and "regular" code are in one place instead of separated as in a C# project. Finally, I cannot get some simple code to work as it throws an exception, "A first chance exception of type IronPython.Runtime.ArgumentTypeException' occurred in IronPython.dll. When I set the breakpoint to step through the code I get into disassembly and I am not good at reading IL. Then the program aborts with the error above. My project is real simple, has a Windows form and a listBox control. All I am doing is using System.Reflection to GetTypes from a DLL and put them in a listBox. In C# it looks like: private void GetMyTypes() { Assembly myAssembly = System.Reflection.Assembly.LoadFrom("mapack.dll"); Type[] types = myAssembly.GetTypes(); foreach (Type type in types) { listBox1.Items.Add(type); } } In IronPython: def GetMyTypes(): myAssembly = System.Reflection.Assembly.LoadFrom("mapack.dll") types = myAssembly.GetTypes() for types in types: _listBox1.Items.Add(types) In both cases, the method is being called right after InitializeComponent() Any ideas as to why this IronPython code won't run? Thanks in advance, Mitch http://softwareindustrialization.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Fri Jun 2 16:40:39 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Fri, 2 Jun 2006 07:40:39 -0700 Subject: [IronPython] Passing keyword arguments to dict subclass In-Reply-To: <5b0248170606020257u6576f662rbc8bb25e707c2fc8@mail.gmail.com> References: <5b0248170606020257u6576f662rbc8bb25e707c2fc8@mail.gmail.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E01E99F1578@df-foxhound-msg.exchange.corp.microsoft.com> Thanks for keeping the bug reports coming! I've filed this one, we should have it fixed for the next release. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Sanghyeon Seo Sent: Friday, June 02, 2006 2:57 AM To: Discussion of IronPython Subject: [IronPython] Passing keyword arguments to dict subclass # test.py class x(dict): pass print x(a=1)['a'] Found while testing Construct (http://pyconstruct.wikispaces.com/) with IronPython. Seo Sanghyeon _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at exchange.microsoft.com Fri Jun 2 16:48:16 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Fri, 2 Jun 2006 07:48:16 -0700 Subject: [IronPython] IronPython support In Visual Studio 2005 April VSSDK? In-Reply-To: <000001c68635$c0469e40$6401a8c0@NIS1861127372> References: <000f01c685a0$22c73520$6401a8c0@NIS1861127372> <000001c68635$c0469e40$6401a8c0@NIS1861127372> Message-ID: <4039D552ADAB094BB1EA670F3E96214E01E99F157A@df-foxhound-msg.exchange.corp.microsoft.com> On debugging: Are you debugging running the console, or did you put the code into a .py file and run it? The reason I ask is when you're running at the console we generate code in a mode that is essentially un-debuggable. The reason for this is that it's the only way the code is collectible by the GC. But if you put the code into a .py file and import it, then you'll get a much better experience - you should be able to step through the code at that point. As for getting the IronPython source files - you might be able to solve this using Just My Code (Tools->Options->Debugging->General->Enable Just My Code). Another option is tweaking the exception handling settings (Ctrl-Alt-E) so thrown CLR exceptions don't cause you to break in. You could point VS at the IronPython source code, but then you'd be stepping through tons of IP source code to understand your exception. So hopefully the Just My Code option will do the right thing for you. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Lesley & Mitch Barnett Sent: Friday, June 02, 2006 4:15 AM To: 'Discussion of IronPython' Subject: Re: [IronPython] IronPython support In Visual Studio 2005 April VSSDK? Fixed my own error: >>> from System.Reflection import * >>> a = Assembly.LoadFrom("mapack.dll") >>> Types = a.GetTypes() >>> for Type in Types: ... print Type ... Mapack.CholeskyDecomposition Mapack.EigenvalueDecomposition Mapack.LuDecomposition Mapack.Matrix Mapack.QrDecomposition Mapack.SingularValueDecomposition >>> Still have the VS debugging issue... ________________________________ From: Lesley & Mitch Barnett [mailto:mbarnett at uniserve.com] Sent: June 1, 2006 10:24 AM To: 'Discussion of IronPython' Subject: Re: [IronPython] IronPython support In Visual Studio 2005 April VSSDK? Here is the code in the interpreter to show Types in Types: does work or is it a bug? IronPython 1.0.2328 (Beta) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> from System.Reflection import * >>> a = Assembly.LoadFrom("mapack.dll") >>> Types = a.GetTypes() >>> for Type in Types: ... print Types ... System.Type[] System.Type[] System.Type[] System.Type[] System.Type[] System.Type[] >>> Types = a.GetTypes() >>> for Types in Types: ... print Types ... Mapack.CholeskyDecomposition Mapack.EigenvalueDecomposition Mapack.LuDecomposition Mapack.Matrix Mapack.QrDecomposition Mapack.SingularValueDecomposition >>> Also, when running the debugger in VS, when it gets to the break point, it asks for the IronPython source code at: "z:\IronPython\Public\Src\IronPython\Runtime\FunctionEnvironment.cs" Should I be pointing something in VS at the IronPython source code? Or is this a bug? Thanks, Mitch ________________________________ From: Dino Viehland [mailto:dinov at exchange.microsoft.com] Sent: May 30, 2006 8:44 AM To: Discussion of IronPython Subject: Re: [IronPython] IronPython support In Visual Studio 2005 April VSSDK? The two files that you see is being done through partial class support which is a language feature that both C# & VB support. Python doesn't have such a feature, and so we've been discussing internally ways we could do this - unfortunately we haven't come up with the ideal solution yet. Ultimately we want to have a very similar experience to C# & VB, but it certainly may not be the same. I believe our next round of VS integration work will enable the drop-down list for types & members. Debugging should work today, although you won't get the greatest display for your locals or classes always - but you can at least step through. I don't believe we have any specific plans to improve debugging immediately. You should be able to place your code anywhere in Form1.py. The CodeDom parser should just merge generated code in along w/ your code. If you run into any issues there let us know J. Is the issue w/ the code the one Vagmi pointed out (types in types)? This should work. One suggestion would be to look in the Data property of the exception, and find the Python version of the exception - it may contain more meaningful information. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Lesley & Mitch Barnett Sent: Tuesday, May 30, 2006 5:02 AM To: users at lists.ironpython.com Subject: [IronPython] IronPython support In Visual Studio 2005 April VSSDK? Hi, using the April 2005 VSSDK, I am able fire up a new Visual Studio PythonProject (Experimental Hive) using the Windows Application template. I can drag and drop UI controls from the Toolbox onto the design surface. However, I notice the IronPython code being generated for both the designer and the form is placed in a single file called Form1.py. In a C# WinForm project, the code is separated into 2 files, Form1.cs and From1.Designer.cs. Is the plan to have IronPython fully integrated into Visual Studio in the same way as a C# project, including drop down list for types and members in the code editor? What about debugger support? I ask this as I am trying to build a simple IronPython Windows app and while being new to the Python language I am also finding it difficult to figure out exactly where I put my code in Form1.py cause the both the design code and "regular" code are in one place instead of separated as in a C# project. Finally, I cannot get some simple code to work as it throws an exception, "A first chance exception of type IronPython.Runtime.ArgumentTypeException' occurred in IronPython.dll. When I set the breakpoint to step through the code I get into disassembly and I am not good at reading IL. Then the program aborts with the error above. My project is real simple, has a Windows form and a listBox control. All I am doing is using System.Reflection to GetTypes from a DLL and put them in a listBox. In C# it looks like: private void GetMyTypes() { Assembly myAssembly = System.Reflection.Assembly.LoadFrom("mapack.dll"); Type[] types = myAssembly.GetTypes(); foreach (Type type in types) { listBox1.Items.Add(type); } } In IronPython: def GetMyTypes(): myAssembly = System.Reflection.Assembly.LoadFrom("mapack.dll") types = myAssembly.GetTypes() for types in types: _listBox1.Items.Add(types) In both cases, the method is being called right after InitializeComponent() Any ideas as to why this IronPython code won't run? Thanks in advance, Mitch http://softwareindustrialization.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From aude at microsoft.com Fri Jun 2 18:18:53 2006 From: aude at microsoft.com (Aude Espesset) Date: Fri, 2 Jun 2006 09:18:53 -0700 Subject: [IronPython] Critical bug in binascii Message-ID: Hi all, I'm trying to read some fields in a binary file and convert them to hexadecimal numbers. The conversion seems to work most of the time but not always. It doesn't crash, it just returns the wrong answer:-( Here's an example: * In CPython : >>> import binascii >>> a = '\x00\x00\x10\x00' >>> b = binascii.b2a_hex(a) >>> b '00001000' >>> int(b,16) 4096 The same thing in IronPython (beta 7): >>> import binascii >>> a = '\x00\x00\x10\x00' >>> b = binascii.b2a_hex(a) >>> b '00100' >>> int(b,16) 256 Aude From dinov at exchange.microsoft.com Fri Jun 2 19:10:54 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Fri, 2 Jun 2006 10:10:54 -0700 Subject: [IronPython] Critical bug in binascii In-Reply-To: <1421F7433DA4144597E8578016CEE5EF01EAA27080@df-foxhound-msg.exchange.corp.microsoft.com> References: <1421F7433DA4144597E8578016CEE5EF01EAA27080@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E01E99F169C@df-foxhound-msg.exchange.corp.microsoft.com> Thanks for the bug report, we'll have this one fixed for the next release. The fix is actually quite trivial if you want to update your copy of IronPython & rebuild. In IronPython\Modules\binascii.cs the function EncodeHex needs to have its call to AppendFormat be replaced with: sb.AppendFormat("{0:x2}", (int)data[i]); (we're just missing the 2 which guarantees we right out 2 characters all the time). -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Aude Espesset Sent: Friday, June 02, 2006 9:19 AM To: users at lists.ironpython.com Subject: [IronPython] Critical bug in binascii Hi all, I'm trying to read some fields in a binary file and convert them to hexadecimal numbers. The conversion seems to work most of the time but not always. It doesn't crash, it just returns the wrong answer:-( Here's an example: * In CPython : >>> import binascii >>> a = '\x00\x00\x10\x00' >>> b = binascii.b2a_hex(a) >>> b '00001000' >>> int(b,16) 4096 The same thing in IronPython (beta 7): >>> import binascii >>> a = '\x00\x00\x10\x00' >>> b = binascii.b2a_hex(a) >>> b '00100' >>> int(b,16) 256 Aude _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From aude at microsoft.com Fri Jun 2 20:15:32 2006 From: aude at microsoft.com (Aude Espesset) Date: Fri, 2 Jun 2006 11:15:32 -0700 Subject: [IronPython] Critical bug in binascii References: <1421F7433DA4144597E8578016CEE5EF01EAA27080@df-foxhound-msg.exchange.corp.microsoft.com> <4039D552ADAB094BB1EA670F3E96214E01E99F169C@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: Thanks, it's fixed! ________________________________ From: users-bounces at lists.ironpython.com on behalf of Dino Viehland Sent: Fri 6/2/2006 10:10 AM To: Discussion of IronPython Subject: Re: [IronPython] Critical bug in binascii Thanks for the bug report, we'll have this one fixed for the next release. The fix is actually quite trivial if you want to update your copy of IronPython & rebuild. In IronPython\Modules\binascii.cs the function EncodeHex needs to have its call to AppendFormat be replaced with: sb.AppendFormat("{0:x2}", (int)data[i]); (we're just missing the 2 which guarantees we right out 2 characters all the time). -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Aude Espesset Sent: Friday, June 02, 2006 9:19 AM To: users at lists.ironpython.com Subject: [IronPython] Critical bug in binascii Hi all, I'm trying to read some fields in a binary file and convert them to hexadecimal numbers. The conversion seems to work most of the time but not always. It doesn't crash, it just returns the wrong answer:-( Here's an example: * In CPython : >>> import binascii >>> a = '\x00\x00\x10\x00' >>> b = binascii.b2a_hex(a) >>> b '00001000' >>> int(b,16) 4096 The same thing in IronPython (beta 7): >>> import binascii >>> a = '\x00\x00\x10\x00' >>> b = binascii.b2a_hex(a) >>> b '00100' >>> int(b,16) 256 Aude _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 5210 bytes Desc: not available URL: From aude at microsoft.com Fri Jun 2 23:00:11 2006 From: aude at microsoft.com (Aude Espesset) Date: Fri, 2 Jun 2006 14:00:11 -0700 Subject: [IronPython] How to update visual studio for Ironpython beta 7 & Infinite loop on package import Message-ID: Hi, I have the april 2006 version of Visual Studio which contains IronPython, but I don't know how to update it to work with beta 7. I'm guessing I should copy the new source code somewhere and rebuild but I don't know where to copy it. My second question is about infinite loops when importing packages. There is an old message regarding this issue: http://lists.ironpython.com/htdig.cgi/users-ironpython.com/2006-March/001884.html Is it still an active bug? One package gives me an infinite loop on import. Should I try to trace back where it falls into an infinite loop or are you aware of this bug and still working on it? Thanks, Aude From dinov at exchange.microsoft.com Fri Jun 2 23:14:17 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Fri, 2 Jun 2006 14:14:17 -0700 Subject: [IronPython] How to update visual studio for Ironpython beta 7 & Infinite loop on package import In-Reply-To: <1421F7433DA4144597E8578016CEE5EF01EAA27083@df-foxhound-msg.exchange.corp.microsoft.com> References: <1421F7433DA4144597E8578016CEE5EF01EAA27083@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E01E99F19E0@df-foxhound-msg.exchange.corp.microsoft.com> We're actually not aware of any issues w/ importing... do you have a simple repro, or does it repro w/ the same steps as the previous one for you? To update to beta 7 you should be able to replace the IronPython binaries that ship w/ VSIP. Those typically get deployed to: %ProgramFiles\Visual Studio 2005 SDK\(some date)\VisualStudioIntegration\Common\Assemblies Just replace those, then re-build the IronPython integration sample (%ProgramFiles%\Visual Studio 2005 SDK\(some date)\VisualStudioIntegration\Samples\IronPythonIntegration\) and then the project should be up-to-date and using beta 7. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Aude Espesset Sent: Friday, June 02, 2006 2:00 PM To: users at lists.ironpython.com Subject: [IronPython] How to update visual studio for Ironpython beta 7 & Infinite loop on package import Hi, I have the april 2006 version of Visual Studio which contains IronPython, but I don't know how to update it to work with beta 7. I'm guessing I should copy the new source code somewhere and rebuild but I don't know where to copy it. My second question is about infinite loops when importing packages. There is an old message regarding this issue: http://lists.ironpython.com/htdig.cgi/users-ironpython.com/2006-March/001884.html Is it still an active bug? One package gives me an infinite loop on import. Should I try to trace back where it falls into an infinite loop or are you aware of this bug and still working on it? Thanks, Aude _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From aude at microsoft.com Fri Jun 2 23:53:28 2006 From: aude at microsoft.com (Aude Espesset) Date: Fri, 2 Jun 2006 14:53:28 -0700 Subject: [IronPython] How to update visual studio for Ironpython beta 7 & Infinite loop on package import References: <1421F7433DA4144597E8578016CEE5EF01EAA27083@df-foxhound-msg.exchange.corp.microsoft.com> <4039D552ADAB094BB1EA670F3E96214E01E99F19E0@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: 1)The update didn't go too well. I get the following error: Error 1 The type or namespace name 'SimpleAstWalker' could not be found (are you missing a using directive or an assembly reference?) C:\Program Files\Visual Studio 2005 SDK\2006.04\VisualStudioIntegration\Samples\IronPythonIntegration\LanguageService\Engine\Locator.cs 18 28 LanguageService 2) For the infinite loop I don't think it is the same case as in the early message. I need to look at it more carefully.. well..on monday. Have a good week-end, Aude ________________________________ From: users-bounces at lists.ironpython.com on behalf of Dino Viehland Sent: Fri 6/2/2006 2:14 PM To: Discussion of IronPython Subject: Re: [IronPython] How to update visual studio for Ironpython beta 7 & Infinite loop on package import We're actually not aware of any issues w/ importing... do you have a simple repro, or does it repro w/ the same steps as the previous one for you? To update to beta 7 you should be able to replace the IronPython binaries that ship w/ VSIP. Those typically get deployed to: %ProgramFiles\Visual Studio 2005 SDK\(some date)\VisualStudioIntegration\Common\Assemblies Just replace those, then re-build the IronPython integration sample (%ProgramFiles%\Visual Studio 2005 SDK\(some date)\VisualStudioIntegration\Samples\IronPythonIntegration\) and then the project should be up-to-date and using beta 7. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Aude Espesset Sent: Friday, June 02, 2006 2:00 PM To: users at lists.ironpython.com Subject: [IronPython] How to update visual studio for Ironpython beta 7 & Infinite loop on package import Hi, I have the april 2006 version of Visual Studio which contains IronPython, but I don't know how to update it to work with beta 7. I'm guessing I should copy the new source code somewhere and rebuild but I don't know where to copy it. My second question is about infinite loops when importing packages. There is an old message regarding this issue: http://lists.ironpython.com/htdig.cgi/users-ironpython.com/2006-March/001884.html Is it still an active bug? One package gives me an infinite loop on import. Should I try to trace back where it falls into an infinite loop or are you aware of this bug and still working on it? Thanks, Aude _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 5893 bytes Desc: not available URL: From ivan.chollet at lynanda.com Sat Jun 3 00:08:12 2006 From: ivan.chollet at lynanda.com (ivan chollet) Date: Sat, 3 Jun 2006 00:08:12 +0200 Subject: [IronPython] How to update visual studio for Ironpython beta 7& Infinite loop on package import In-Reply-To: Message-ID: <20060602220809.38420461C9@smtp4-g19.free.fr> Eh ben dis donc ! _____ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Aude Espesset Sent: vendredi 2 juin 2006 23:53 To: Discussion of IronPython Subject: Re: [IronPython] How to update visual studio for Ironpython beta 7& Infinite loop on package import 1)The update didn't go too well. I get the following error: Error 1 The type or namespace name 'SimpleAstWalker' could not be found (are you missing a using directive or an assembly reference?) C:\Program Files\Visual Studio 2005 SDK\2006.04\VisualStudioIntegration\Samples\IronPythonIntegration\LanguageSe rvice\Engine\Locator.cs 18 28 LanguageService 2) For the infinite loop I don't think it is the same case as in the early message. I need to look at it more carefully.. well..on monday. Have a good week-end, Aude _____ From: users-bounces at lists.ironpython.com on behalf of Dino Viehland Sent: Fri 6/2/2006 2:14 PM To: Discussion of IronPython Subject: Re: [IronPython] How to update visual studio for Ironpython beta 7 & Infinite loop on package import We're actually not aware of any issues w/ importing... do you have a simple repro, or does it repro w/ the same steps as the previous one for you? To update to beta 7 you should be able to replace the IronPython binaries that ship w/ VSIP. Those typically get deployed to: %ProgramFiles\Visual Studio 2005 SDK\(some date)\VisualStudioIntegration\Common\Assemblies Just replace those, then re-build the IronPython integration sample (%ProgramFiles%\Visual Studio 2005 SDK\(some date)\VisualStudioIntegration\Samples\IronPythonIntegration\) and then the project should be up-to-date and using beta 7. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Aude Espesset Sent: Friday, June 02, 2006 2:00 PM To: users at lists.ironpython.com Subject: [IronPython] How to update visual studio for Ironpython beta 7 & Infinite loop on package import Hi, I have the april 2006 version of Visual Studio which contains IronPython, but I don't know how to update it to work with beta 7. I'm guessing I should copy the new source code somewhere and rebuild but I don't know where to copy it. My second question is about infinite loops when importing packages. There is an old message regarding this issue: http://lists.ironpython.com/htdig.cgi/users-ironpython.com/2006-March/001884 .html Is it still an active bug? One package gives me an infinite loop on import. Should I try to trace back where it falls into an infinite loop or are you aware of this bug and still working on it? Thanks, Aude _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 7342 bytes Desc: not available URL: From Aaron.Marten at microsoft.com Sat Jun 3 00:18:27 2006 From: Aaron.Marten at microsoft.com (Aaron Marten) Date: Fri, 2 Jun 2006 15:18:27 -0700 Subject: [IronPython] How to update visual studio for Ironpython beta 7 & Infinite loop on package import In-Reply-To: References: <1421F7433DA4144597E8578016CEE5EF01EAA27083@df-foxhound-msg.exchange.corp.microsoft.com> <4039D552ADAB094BB1EA670F3E96214E01E99F19E0@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <5FCAA6E21F110544B8CD0EEBB51B0AE802DF7C28@RED-MSG-20.redmond.corp.microsoft.com> Hi Aude, Yes, there are some breaking changes between some of the classes we used in the VS Integration code and IronPython between the time we shipped the April SDK and IP Beta 7. Our next CTP of the VSSDK (July 2006) will include changes at least up through Beta 7. This will be released in late June / early July. Till then, you can try to tweak the sample to get it all working, and get rid of all the build errors, but you're on your own for this as it's unsupported J. Hope that helps! Aaron Marten From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Aude Espesset Sent: Friday, June 02, 2006 2:53 PM To: Discussion of IronPython Subject: RE: [IronPython] How to update visual studio for Ironpython beta 7 & Infinite loop on package import 1)The update didn't go too well. I get the following error: Error 1 The type or namespace name 'SimpleAstWalker' could not be found (are you missing a using directive or an assembly reference?) C:\Program Files\Visual Studio 2005 SDK\2006.04\VisualStudioIntegration\Samples\IronPythonIntegration\Langua geService\Engine\Locator.cs 18 28 LanguageService 2) For the infinite loop I don't think it is the same case as in the early message. I need to look at it more carefully.. well..on monday. Have a good week-end, Aude ________________________________ From: users-bounces at lists.ironpython.com on behalf of Dino Viehland Sent: Fri 6/2/2006 2:14 PM To: Discussion of IronPython Subject: Re: [IronPython] How to update visual studio for Ironpython beta 7 & Infinite loop on package import We're actually not aware of any issues w/ importing... do you have a simple repro, or does it repro w/ the same steps as the previous one for you? To update to beta 7 you should be able to replace the IronPython binaries that ship w/ VSIP. Those typically get deployed to: %ProgramFiles\Visual Studio 2005 SDK\(some date)\VisualStudioIntegration\Common\Assemblies Just replace those, then re-build the IronPython integration sample (%ProgramFiles%\Visual Studio 2005 SDK\(some date)\VisualStudioIntegration\Samples\IronPythonIntegration\) and then the project should be up-to-date and using beta 7. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Aude Espesset Sent: Friday, June 02, 2006 2:00 PM To: users at lists.ironpython.com Subject: [IronPython] How to update visual studio for Ironpython beta 7 & Infinite loop on package import Hi, I have the april 2006 version of Visual Studio which contains IronPython, but I don't know how to update it to work with beta 7. I'm guessing I should copy the new source code somewhere and rebuild but I don't know where to copy it. My second question is about infinite loops when importing packages. There is an old message regarding this issue: http://lists.ironpython.com/htdig.cgi/users-ironpython.com/2006-March/00 1884.html Is it still an active bug? One package gives me an infinite loop on import. Should I try to trace back where it falls into an infinite loop or are you aware of this bug and still working on it? Thanks, Aude _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Harry.Pierson at microsoft.com Sat Jun 3 01:01:59 2006 From: Harry.Pierson at microsoft.com (Harry Pierson) Date: Fri, 2 Jun 2006 16:01:59 -0700 Subject: [IronPython] How to update visual studio for Ironpython beta 7& Infinite loop on package import In-Reply-To: <5FCAA6E21F110544B8CD0EEBB51B0AE802DF7C28@RED-MSG-20.redmond.corp.microsoft.com> References: <1421F7433DA4144597E8578016CEE5EF01EAA27083@df-foxhound-msg.exchange.corp.microsoft.com><4039D552ADAB094BB1EA670F3E96214E01E99F19E0@df-foxhound-msg.exchange.corp.microsoft.com> <5FCAA6E21F110544B8CD0EEBB51B0AE802DF7C28@RED-MSG-20.redmond.corp.microsoft.com> Message-ID: <92ED8A12D2BC094FAFCD16EC57E199FD3FD580@RED-MSG-81.redmond.corp.microsoft.com> The June CTP of the VSSDK just shipped. Does it have the changes you describe? From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Aaron Marten Sent: Friday, June 02, 2006 3:18 PM To: Discussion of IronPython Subject: Re: [IronPython] How to update visual studio for Ironpython beta 7& Infinite loop on package import Hi Aude, Yes, there are some breaking changes between some of the classes we used in the VS Integration code and IronPython between the time we shipped the April SDK and IP Beta 7. Our next CTP of the VSSDK (July 2006) will include changes at least up through Beta 7. This will be released in late June / early July. Till then, you can try to tweak the sample to get it all working, and get rid of all the build errors, but you're on your own for this as it's unsupported J. Hope that helps! Aaron Marten From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Aude Espesset Sent: Friday, June 02, 2006 2:53 PM To: Discussion of IronPython Subject: RE: [IronPython] How to update visual studio for Ironpython beta 7 & Infinite loop on package import 1)The update didn't go too well. I get the following error: Error 1 The type or namespace name 'SimpleAstWalker' could not be found (are you missing a using directive or an assembly reference?) C:\Program Files\Visual Studio 2005 SDK\2006.04\VisualStudioIntegration\Samples\IronPythonIntegration\Langua geService\Engine\Locator.cs 18 28 LanguageService 2) For the infinite loop I don't think it is the same case as in the early message. I need to look at it more carefully.. well..on monday. Have a good week-end, Aude ________________________________ From: users-bounces at lists.ironpython.com on behalf of Dino Viehland Sent: Fri 6/2/2006 2:14 PM To: Discussion of IronPython Subject: Re: [IronPython] How to update visual studio for Ironpython beta 7 & Infinite loop on package import We're actually not aware of any issues w/ importing... do you have a simple repro, or does it repro w/ the same steps as the previous one for you? To update to beta 7 you should be able to replace the IronPython binaries that ship w/ VSIP. Those typically get deployed to: %ProgramFiles\Visual Studio 2005 SDK\(some date)\VisualStudioIntegration\Common\Assemblies Just replace those, then re-build the IronPython integration sample (%ProgramFiles%\Visual Studio 2005 SDK\(some date)\VisualStudioIntegration\Samples\IronPythonIntegration\) and then the project should be up-to-date and using beta 7. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Aude Espesset Sent: Friday, June 02, 2006 2:00 PM To: users at lists.ironpython.com Subject: [IronPython] How to update visual studio for Ironpython beta 7 & Infinite loop on package import Hi, I have the april 2006 version of Visual Studio which contains IronPython, but I don't know how to update it to work with beta 7. I'm guessing I should copy the new source code somewhere and rebuild but I don't know where to copy it. My second question is about infinite loops when importing packages. There is an old message regarding this issue: http://lists.ironpython.com/htdig.cgi/users-ironpython.com/2006-March/00 1884.html Is it still an active bug? One package gives me an infinite loop on import. Should I try to trace back where it falls into an infinite loop or are you aware of this bug and still working on it? Thanks, Aude _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Aaron.Marten at microsoft.com Sat Jun 3 01:10:18 2006 From: Aaron.Marten at microsoft.com (Aaron Marten) Date: Fri, 2 Jun 2006 16:10:18 -0700 Subject: [IronPython] How to update visual studio for Ironpython beta7& Infinite loop on package import In-Reply-To: <92ED8A12D2BC094FAFCD16EC57E199FD3FD580@RED-MSG-81.redmond.corp.microsoft.com> References: <1421F7433DA4144597E8578016CEE5EF01EAA27083@df-foxhound-msg.exchange.corp.microsoft.com><4039D552ADAB094BB1EA670F3E96214E01E99F19E0@df-foxhound-msg.exchange.corp.microsoft.com><5FCAA6E21F110544B8CD0EEBB51B0AE802DF7C28@RED-MSG-20.redmond.corp.microsoft.com> <92ED8A12D2BC094FAFCD16EC57E199FD3FD580@RED-MSG-81.redmond.corp.microsoft.com> Message-ID: <5FCAA6E21F110544B8CD0EEBB51B0AE802DF7CFA@RED-MSG-20.redmond.corp.microsoft.com> Unfortunately, no. We did not integrate any new changes from the IronPython code base before we released the June CTP. For IronPython.dll in the VSSDK, April == June. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Harry Pierson Sent: Friday, June 02, 2006 4:02 PM To: Discussion of IronPython Subject: Re: [IronPython] How to update visual studio for Ironpython beta7& Infinite loop on package import The June CTP of the VSSDK just shipped. Does it have the changes you describe? From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Aaron Marten Sent: Friday, June 02, 2006 3:18 PM To: Discussion of IronPython Subject: Re: [IronPython] How to update visual studio for Ironpython beta 7& Infinite loop on package import Hi Aude, Yes, there are some breaking changes between some of the classes we used in the VS Integration code and IronPython between the time we shipped the April SDK and IP Beta 7. Our next CTP of the VSSDK (July 2006) will include changes at least up through Beta 7. This will be released in late June / early July. Till then, you can try to tweak the sample to get it all working, and get rid of all the build errors, but you're on your own for this as it's unsupported J. Hope that helps! Aaron Marten From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Aude Espesset Sent: Friday, June 02, 2006 2:53 PM To: Discussion of IronPython Subject: RE: [IronPython] How to update visual studio for Ironpython beta 7 & Infinite loop on package import 1)The update didn't go too well. I get the following error: Error 1 The type or namespace name 'SimpleAstWalker' could not be found (are you missing a using directive or an assembly reference?) C:\Program Files\Visual Studio 2005 SDK\2006.04\VisualStudioIntegration\Samples\IronPythonIntegration\Langua geService\Engine\Locator.cs 18 28 LanguageService 2) For the infinite loop I don't think it is the same case as in the early message. I need to look at it more carefully.. well..on monday. Have a good week-end, Aude ________________________________ From: users-bounces at lists.ironpython.com on behalf of Dino Viehland Sent: Fri 6/2/2006 2:14 PM To: Discussion of IronPython Subject: Re: [IronPython] How to update visual studio for Ironpython beta 7 & Infinite loop on package import We're actually not aware of any issues w/ importing... do you have a simple repro, or does it repro w/ the same steps as the previous one for you? To update to beta 7 you should be able to replace the IronPython binaries that ship w/ VSIP. Those typically get deployed to: %ProgramFiles\Visual Studio 2005 SDK\(some date)\VisualStudioIntegration\Common\Assemblies Just replace those, then re-build the IronPython integration sample (%ProgramFiles%\Visual Studio 2005 SDK\(some date)\VisualStudioIntegration\Samples\IronPythonIntegration\) and then the project should be up-to-date and using beta 7. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Aude Espesset Sent: Friday, June 02, 2006 2:00 PM To: users at lists.ironpython.com Subject: [IronPython] How to update visual studio for Ironpython beta 7 & Infinite loop on package import Hi, I have the april 2006 version of Visual Studio which contains IronPython, but I don't know how to update it to work with beta 7. I'm guessing I should copy the new source code somewhere and rebuild but I don't know where to copy it. My second question is about infinite loops when importing packages. There is an old message regarding this issue: http://lists.ironpython.com/htdig.cgi/users-ironpython.com/2006-March/00 1884.html Is it still an active bug? One package gives me an infinite loop on import. Should I try to trace back where it falls into an infinite loop or are you aware of this bug and still working on it? Thanks, Aude _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From joesox at gmail.com Sat Jun 3 01:50:33 2006 From: joesox at gmail.com (JoeSox) Date: Sat, 3 Jun 2006 08:50:33 +0900 Subject: [IronPython] sys.path.append bug? Message-ID: <785694cd0606021650l2f7e4b84ted731860cafc0894@mail.gmail.com> Please take a look at some IronPython behavior I have observed using MS C# Express 2005 and IronPython beta7..... MyClass.cs:.... public static string myapppath = Application.StartupPath; .... mymethod()..... ipEngine1.Execute("import sys"); ipEngine1.Execute(@"sys.path.append('" + Paths.MiscDirs.myapppath + "')"); ======= IronPython creases the string: + SyncRoot {['C:\\Documents and Settings\\Administrator\\My Documents\\Visual Studio 2005\\Projects\\CNU2Demo\\CNU2Demo\x08in\\Debug']} object {IronPython.Runtime.List} ======= It appears the "CNU2Demo\x08in\\Debug" should read "CNU2Demo\\bin\\Debug" Any ideas? -- Later, Joe From fuzzyman at voidspace.org.uk Sat Jun 3 02:24:52 2006 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sat, 03 Jun 2006 01:24:52 +0100 Subject: [IronPython] IronPython & Windows Forms IV Message-ID: <4480D6D4.9090108@voidspace.org.uk> Hello all, Next part of IronPython and Windows Forms is up : http://www.voidspace.org.uk/python/weblog/arch_d7_2006_06_03.shtml#e351 Comments and corrections appreciated. It covers Panels and Styles, but doesn't cover any new (useful) widgets, so there's still a way to go. :-) Michael Foord http://www.voidspace.org.uk/python/index.shtml From sanxiyn at gmail.com Sat Jun 3 02:31:00 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Sat, 3 Jun 2006 09:31:00 +0900 Subject: [IronPython] IronPython & Windows Forms IV In-Reply-To: <4480D6D4.9090108@voidspace.org.uk> References: <4480D6D4.9090108@voidspace.org.uk> Message-ID: <5b0248170606021731r379a397cuf2edbd0932c89737@mail.gmail.com> 2006/6/3, Michael Foord : > http://www.voidspace.org.uk/python/weblog/arch_d7_2006_06_03.shtml#e351 > Comments and corrections appreciated. The title says "Part IV", but the note says "This is part three in a series of blog entries". Seo Sanghyeon From fuzzyman at voidspace.org.uk Sat Jun 3 02:39:33 2006 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sat, 03 Jun 2006 01:39:33 +0100 Subject: [IronPython] IronPython & Windows Forms IV In-Reply-To: <5b0248170606021731r379a397cuf2edbd0932c89737@mail.gmail.com> References: <4480D6D4.9090108@voidspace.org.uk> <5b0248170606021731r379a397cuf2edbd0932c89737@mail.gmail.com> Message-ID: <4480DA45.9020600@voidspace.org.uk> Sanghyeon Seo wrote: > 2006/6/3, Michael Foord : > >> http://www.voidspace.org.uk/python/weblog/arch_d7_2006_06_03.shtml#e351 >> Comments and corrections appreciated. >> > > The title says "Part IV", but the note says "This is part three in a > series of blog entries". > > Thanks :-) Damn copy and paste. I'd be happy to post mono screenshots by the way. Michael > Seo Sanghyeon > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > From sanxiyn at gmail.com Sat Jun 3 02:39:50 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Sat, 3 Jun 2006 09:39:50 +0900 Subject: [IronPython] sys.path.append bug? In-Reply-To: <785694cd0606021650l2f7e4b84ted731860cafc0894@mail.gmail.com> References: <785694cd0606021650l2f7e4b84ted731860cafc0894@mail.gmail.com> Message-ID: <5b0248170606021739x7f2c73e9m231874bb74519401@mail.gmail.com> 2006/6/3, JoeSox : > It appears the "CNU2Demo\x08in\\Debug" should read "CNU2Demo\\bin\\Debug" Well, >>> '\b' '\x08' If you use PythonEngine.Execute, you should escape Python string. Seo Sanghyeon From sanxiyn at gmail.com Sat Jun 3 05:07:24 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Sat, 3 Jun 2006 12:07:24 +0900 Subject: [IronPython] IronPython & Windows Forms IV In-Reply-To: <4480DA45.9020600@voidspace.org.uk> References: <4480D6D4.9090108@voidspace.org.uk> <5b0248170606021731r379a397cuf2edbd0932c89737@mail.gmail.com> <4480DA45.9020600@voidspace.org.uk> Message-ID: <5b0248170606022007g2564068fm237ecc5622e114fa@mail.gmail.com> 2006/6/3, Michael Foord : > Thanks :-) > Damn copy and paste. I'd be happy to post mono screenshots by the way. Uploaded to the usual place. http://sparcs.kaist.ac.kr/~tinuviel/fepy/winforms/ I have a question. Why do you substract 15 from the height? This line of code doesn't seem to be explained in the blog entry: self.panel1.Height = (self.Height / 2) - 15 And I think this accounts for 30 pixels empty area at the bottom in Mono screenshots. My screen is 1280x1024. This accounts for size difference with your screenshots, since a third of your screen differs from my screen apparently. Seo Sanghyeon From joesox at gmail.com Sat Jun 3 11:40:52 2006 From: joesox at gmail.com (JoeSox) Date: Sat, 3 Jun 2006 18:40:52 +0900 Subject: [IronPython] sys.path.append bug? In-Reply-To: <5b0248170606021739x7f2c73e9m231874bb74519401@mail.gmail.com> References: <785694cd0606021650l2f7e4b84ted731860cafc0894@mail.gmail.com> <5b0248170606021739x7f2c73e9m231874bb74519401@mail.gmail.com> Message-ID: <785694cd0606030240jf5536a5gafa14a4997251436@mail.gmail.com> On 6/3/06, Sanghyeon Seo wrote: > 2006/6/3, JoeSox : > > It appears the "CNU2Demo\x08in\\Debug" should read "CNU2Demo\\bin\\Debug" > > Well, > > >>> '\b' > '\x08' > > If you use PythonEngine.Execute, you should escape Python string. Seo, I don't understand what you are saying because I used .Execute and it stored the value incorrectly. Later, Joe From fuzzyman at voidspace.org.uk Sat Jun 3 11:57:31 2006 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sat, 03 Jun 2006 10:57:31 +0100 Subject: [IronPython] IronPython & Windows Forms IV In-Reply-To: <5b0248170606022007g2564068fm237ecc5622e114fa@mail.gmail.com> References: <4480D6D4.9090108@voidspace.org.uk> <5b0248170606021731r379a397cuf2edbd0932c89737@mail.gmail.com> <4480DA45.9020600@voidspace.org.uk> <5b0248170606022007g2564068fm237ecc5622e114fa@mail.gmail.com> Message-ID: <44815D0B.3000708@voidspace.org.uk> Sanghyeon Seo wrote: > 2006/6/3, Michael Foord : > >> Thanks :-) >> Damn copy and paste. I'd be happy to post mono screenshots by the way. >> > > Uploaded to the usual place. > http://sparcs.kaist.ac.kr/~tinuviel/fepy/winforms/ > > I have a question. Why do you substract 15 from the height? This line > of code doesn't seem to be explained in the blog entry: > > self.panel1.Height = (self.Height / 2) - 15 > > And I think this accounts for 30 pixels empty area at the bottom in > Mono screenshots. > *We take the 15 pixels off the height of the form to account for the title bar.* On windows ``self.Height`` includes the title bar - so the two panels have to be a bit less than half the height of the form. I couldn't see a Form property that would tell me the *visible* height of the form. It looks like it would be better on Mono with just : (self.Height / 2) (Which is more sensible) Can you take screenshots of that and I'll include a note. Fuzzyman http://www.voidspace.org.uk/python/index.shtml > My screen is 1280x1024. This accounts for size difference with your > screenshots, since a third of your screen differs from my screen > apparently. > > Seo Sanghyeon > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > From sanxiyn at gmail.com Sat Jun 3 16:25:04 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Sat, 3 Jun 2006 23:25:04 +0900 Subject: [IronPython] IronPython & Windows Forms IV In-Reply-To: <44815D0B.3000708@voidspace.org.uk> References: <4480D6D4.9090108@voidspace.org.uk> <5b0248170606021731r379a397cuf2edbd0932c89737@mail.gmail.com> <4480DA45.9020600@voidspace.org.uk> <5b0248170606022007g2564068fm237ecc5622e114fa@mail.gmail.com> <44815D0B.3000708@voidspace.org.uk> Message-ID: <5b0248170606030725u492b825cw6caccae2bbf05ff4@mail.gmail.com> 2006/6/3, Michael Foord : > *We take the 15 pixels off the height of the form to account for the > title bar.* Oops. Missed that. > On windows ``self.Height`` includes the title bar - so the two panels > have to be a bit less than half the height of the form. I couldn't see a > Form property that would tell me the *visible* height of the form. I see. On X-based systems, apps have no business dealing with the title bar or the window decoration -- that's the job of window managers. > It looks like it would be better on Mono with just : > (self.Height / 2) > (Which is more sensible) Can you take screenshots of that and I'll > include a note. Done. Uploaded to the same place. As I have 1024x768 screen this time and the form wouldn't fit with 1/3 of screen width and height, I changed it to 1/2 as you suggested. Seo Sanghyeon From smppms2002 at yahoo.com.cn Sat Jun 3 17:03:49 2006 From: smppms2002 at yahoo.com.cn (smppms2002) Date: Sat, 3 Jun 2006 23:03:49 +0800 (CST) Subject: [IronPython] IronPython 1.0 Beta7 can't import module from zip archive? Message-ID: <20060603150349.30518.qmail@web15705.mail.cnb.yahoo.com> test.zip include a.py and b.py. bellowing is the test.py import sys import nt print sys.version sys.path.append( nt.getcwd() + "\\" + "test.zip" ) from a import * from b import * a() b() bellowing is test result: D:\IronPython\IronPython-1.0-Beta7>python test.py 2.3.5 (#62, Feb 9 2005, 16:17:08) [MSC v.1200 32 bit (Intel)] this is a this is b D:\IronPython\IronPython-1.0-Beta7>IronPythonConsole test.py IronPython 1.0.60523 (Beta) on .NET 2.0.50727.42 Traceback (most recent call last): File D:\IronPython\IronPython-1.0-Beta7\test.py, line 8, in Initialize File , line 0, in __import__##3 ImportError: No module named a __________________________________________________ ??????????????? http://cn.mail.yahoo.com From sanxiyn at gmail.com Sat Jun 3 17:07:26 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Sun, 4 Jun 2006 00:07:26 +0900 Subject: [IronPython] IronPython & Windows Forms IV In-Reply-To: <44815D0B.3000708@voidspace.org.uk> References: <4480D6D4.9090108@voidspace.org.uk> <5b0248170606021731r379a397cuf2edbd0932c89737@mail.gmail.com> <4480DA45.9020600@voidspace.org.uk> <5b0248170606022007g2564068fm237ecc5622e114fa@mail.gmail.com> <44815D0B.3000708@voidspace.org.uk> Message-ID: <5b0248170606030807u6b08317bs4b2c8aec744a822b@mail.gmail.com> 2006/6/3, Michael Foord : > On windows ``self.Height`` includes the title bar - so the two panels > have to be a bit less than half the height of the form. I couldn't see a > Form property that would tell me the *visible* height of the form. By the way, ClientRectangle property seems to do the job. Seo Sanghyeon From fuzzyman at voidspace.org.uk Sat Jun 3 17:19:33 2006 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sat, 03 Jun 2006 16:19:33 +0100 Subject: [IronPython] Bug With Packages Message-ID: <4481A885.7040501@voidspace.org.uk> Hello all, I get a bug when importing names that don't exist from a package. I created a package directory (called package), and place an empty "__init__.py" file in it. I then created a file called "module.py", with nothing in it except : print "hello" Below is an IronPython (beta 7) console session using these files : IronPython 1.0.60523 (Beta) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> from package.module import module hello >>> type(module) >>> You can see the 'hello' from when the module is imported. It should raise an "ImportError" when trying to import the name module. Instead it returns a "module" object. Below is the same session in CPython : Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from package.module import module hello Traceback (most recent call last): File "", line 1, in ? ImportError: cannot import name module >>> Michael Foord http://www.voidspace.org.uk/python/index.shtml http://www.resolversystems.com From fuzzyman at voidspace.org.uk Sat Jun 3 19:10:10 2006 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sat, 03 Jun 2006 18:10:10 +0100 Subject: [IronPython] IronPython & Windows Forms IV In-Reply-To: <5b0248170606030807u6b08317bs4b2c8aec744a822b@mail.gmail.com> References: <4480D6D4.9090108@voidspace.org.uk> <5b0248170606021731r379a397cuf2edbd0932c89737@mail.gmail.com> <4480DA45.9020600@voidspace.org.uk> <5b0248170606022007g2564068fm237ecc5622e114fa@mail.gmail.com> <44815D0B.3000708@voidspace.org.uk> <5b0248170606030807u6b08317bs4b2c8aec744a822b@mail.gmail.com> Message-ID: <4481C272.2030005@voidspace.org.uk> Sanghyeon Seo wrote: > 2006/6/3, Michael Foord : > >> On windows ``self.Height`` includes the title bar - so the two panels >> have to be a bit less than half the height of the form. I couldn't see a >> Form property that would tell me the *visible* height of the form. >> > > By the way, ClientRectangle property seems to do the job. > Entry updated to use ClientRectangle (works fine - but probably worth testing on Mono). The Mono screenshots are also included : http://www.voidspace.org.uk/python/weblog/arch_d7_2006_06_03.shtml#e351 Thanks Michael Foord > Seo Sanghyeon > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > From sanxiyn at gmail.com Sun Jun 4 03:16:16 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Sun, 4 Jun 2006 10:16:16 +0900 Subject: [IronPython] IronPython & Windows Forms IV In-Reply-To: <4481C272.2030005@voidspace.org.uk> References: <4480D6D4.9090108@voidspace.org.uk> <5b0248170606021731r379a397cuf2edbd0932c89737@mail.gmail.com> <4480DA45.9020600@voidspace.org.uk> <5b0248170606022007g2564068fm237ecc5622e114fa@mail.gmail.com> <44815D0B.3000708@voidspace.org.uk> <5b0248170606030807u6b08317bs4b2c8aec744a822b@mail.gmail.com> <4481C272.2030005@voidspace.org.uk> Message-ID: <5b0248170606031816vd3aef36w65934ffbefed8cf9@mail.gmail.com> 2006/6/4, Michael Foord : > Entry updated to use ClientRectangle (works fine - but probably worth > testing on Mono). Works fine on Mono too. Seo Sanghyeon From sanxiyn at gmail.com Sun Jun 4 03:18:35 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Sun, 4 Jun 2006 10:18:35 +0900 Subject: [IronPython] IronPython 1.0 Beta7 can't import module from zip archive? In-Reply-To: <20060603150349.30518.qmail@web15705.mail.cnb.yahoo.com> References: <20060603150349.30518.qmail@web15705.mail.cnb.yahoo.com> Message-ID: <5b0248170606031818k3d0d55d6g90730d644931e229@mail.gmail.com> 2006/6/4, smppms2002 : > IronPython 1.0 Beta 7 can't import module from zip archive? No, it can't. I think this is a known problem. Seo Sanghyeon From fuzzyman at voidspace.org.uk Sun Jun 4 09:40:30 2006 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sun, 04 Jun 2006 08:40:30 +0100 Subject: [IronPython] IronPython & Windows Forms Message-ID: <44828E6E.8050402@voidspace.org.uk> Hello all, Another bout of insomnia, so I've done a new entry on IronPython & Windows Forms : http://www.voidspace.org.uk/python/weblog/arch_d7_2006_06_03.shtml#e352 This is on the "The TextBox Widget". Comments appreciated - particularly if you pick up on any mistakes. All the best, Michael Foord http://www.voidspace.org.uk/python/index.shtml From joesox at gmail.com Sun Jun 4 11:13:32 2006 From: joesox at gmail.com (JoeSox) Date: Sun, 4 Jun 2006 18:13:32 +0900 Subject: [IronPython] import array Message-ID: <785694cd0606040213v128506ck7a15d4f5656c92dc@mail.gmail.com> I need to import the array module. Is there a workaround or do I need to create a custom module? Thanks -- Later, Joe From sanxiyn at gmail.com Sun Jun 4 15:18:01 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Sun, 4 Jun 2006 22:18:01 +0900 Subject: [IronPython] IronPython & Windows Forms In-Reply-To: <44828E6E.8050402@voidspace.org.uk> References: <44828E6E.8050402@voidspace.org.uk> Message-ID: <5b0248170606040618x5651e0f0md82b6b00903393fd@mail.gmail.com> 2006/6/4, Michael Foord : > Another bout of insomnia, so I've done a new entry on IronPython & > Windows Forms : Insomnia is good! I've done the shots: http://sparcs.kaist.ac.kr/~tinuviel/fepy/winforms/ Watch out! The text used is *slightly* different! :) Seo Sanghyeon From anoyomouse at petermiller.co.za Thu Jun 1 19:40:06 2006 From: anoyomouse at petermiller.co.za (David-John Miller) Date: Thu, 1 Jun 2006 19:40:06 +0200 Subject: [IronPython] IronPython support In Visual Studio 2005 AprilVSSDK? In-Reply-To: <000f01c685a0$22c73520$6401a8c0@NIS1861127372> Message-ID: <002c01c685a2$742c1500$9d0f1b05@styx> Hi, just spotted a quick error! >>> from System.Reflection import * >>> a = Assembly.LoadFrom("mapack.dll") >>> Types = a.GetTypes() >>> for Type in Types: ... print Types ... Try this instead >>> from System.Reflection import * >>> a = Assembly.LoadFrom("mapack.dll") >>> Types = a.GetTypes() >>> for Type in Types: ... print Type ... It should function the same _____ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Lesley & Mitch Barnett Sent: 01 June 2006 07:24 PM To: 'Discussion of IronPython' Subject: Re: [IronPython] IronPython support In Visual Studio 2005 AprilVSSDK? Here is the code in the interpreter to show Types in Types: does work or is it a bug? IronPython 1.0.2328 (Beta) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> from System.Reflection import * >>> a = Assembly.LoadFrom("mapack.dll") >>> Types = a.GetTypes() >>> for Type in Types: ... print Types ... System.Type[] System.Type[] System.Type[] System.Type[] System.Type[] System.Type[] >>> Types = a.GetTypes() >>> for Types in Types: ... print Types ... Mapack.CholeskyDecomposition Mapack.EigenvalueDecomposition Mapack.LuDecomposition Mapack.Matrix Mapack.QrDecomposition Mapack.SingularValueDecomposition >>> Also, when running the debugger in VS, when it gets to the break point, it asks for the IronPython source code at: "z:\IronPython\Public\Src\IronPython\Runtime\FunctionEnvironment.cs" Should I be pointing something in VS at the IronPython source code? Or is this a bug? Thanks, Mitch _____ From: Dino Viehland [mailto:dinov at exchange.microsoft.com] Sent: May 30, 2006 8:44 AM To: Discussion of IronPython Subject: Re: [IronPython] IronPython support In Visual Studio 2005 April VSSDK? The two files that you see is being done through partial class support which is a language feature that both C# & VB support. Python doesn't have such a feature, and so we've been discussing internally ways we could do this - unfortunately we haven't come up with the ideal solution yet. Ultimately we want to have a very similar experience to C# & VB, but it certainly may not be the same. I believe our next round of VS integration work will enable the drop-down list for types & members. Debugging should work today, although you won't get the greatest display for your locals or classes always - but you can at least step through. I don't believe we have any specific plans to improve debugging immediately. You should be able to place your code anywhere in Form1.py. The CodeDom parser should just merge generated code in along w/ your code. If you run into any issues there let us know :-). Is the issue w/ the code the one Vagmi pointed out (types in types)? This should work. One suggestion would be to look in the Data property of the exception, and find the Python version of the exception - it may contain more meaningful information. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Lesley & Mitch Barnett Sent: Tuesday, May 30, 2006 5:02 AM To: users at lists.ironpython.com Subject: [IronPython] IronPython support In Visual Studio 2005 April VSSDK? Hi, using the April 2005 VSSDK, I am able fire up a new Visual Studio PythonProject (Experimental Hive) using the Windows Application template. I can drag and drop UI controls from the Toolbox onto the design surface. However, I notice the IronPython code being generated for both the designer and the form is placed in a single file called Form1.py. In a C# WinForm project, the code is separated into 2 files, Form1.cs and From1.Designer.cs. Is the plan to have IronPython fully integrated into Visual Studio in the same way as a C# project, including drop down list for types and members in the code editor? What about debugger support? I ask this as I am trying to build a simple IronPython Windows app and while being new to the Python language I am also finding it difficult to figure out exactly where I put my code in Form1.py cause the both the design code and "regular" code are in one place instead of separated as in a C# project. Finally, I cannot get some simple code to work as it throws an exception, "A first chance exception of type IronPython.Runtime.ArgumentTypeException' occurred in IronPython.dll. When I set the breakpoint to step through the code I get into disassembly and I am not good at reading IL. Then the program aborts with the error above. My project is real simple, has a Windows form and a listBox control. All I am doing is using System.Reflection to GetTypes from a DLL and put them in a listBox. In C# it looks like: private void GetMyTypes() { Assembly myAssembly = System.Reflection.Assembly.LoadFrom("mapack.dll"); Type[] types = myAssembly.GetTypes(); foreach (Type type in types) { listBox1.Items.Add(type); } } In IronPython: def GetMyTypes(): myAssembly = System.Reflection.Assembly.LoadFrom("mapack.dll") types = myAssembly.GetTypes() for types in types: _listBox1.Items.Add(types) In both cases, the method is being called right after InitializeComponent() Any ideas as to why this IronPython code won't run? Thanks in advance, Mitch http://softwareindustrialization.com -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3046 bytes Desc: not available URL: From KBjorke at nvidia.com Sun Jun 4 20:12:38 2006 From: KBjorke at nvidia.com (Kevin Bjorke) Date: Sun, 4 Jun 2006 11:12:38 -0700 Subject: [IronPython] IronPython versus Tkinter... Message-ID: <590FCAE72E27D54CA1EADE7293BB444F04422A7E@hqemmail04.nvidia.com> Any clues on running this under Beta7, or is it currently non-functional? I want to be able to run a GUI under both IronPython and Cpython since my app's intent targets two different kinds of host machine. Current behavior: I have a Tkinter app called "smtk" which I call from this shell: import sys addThesePaths = ['c:\\Python24\\lib', 'c:\\Python24\\lib\\plat-win', 'c:\\Python24\\lib\\lib-tk', 'c:\\Python24', 'c:\\Python24\\lib\\site-packages'] for p in addThesePaths: print "Adding %s" % (p) sys.path.append(p) import smtk Which works fine in cpython but under IronPython I get: Adding c:\Python24\lib Adding c:\Python24\lib\plat-win Adding c:\Python24\lib\lib-tk Adding c:\Python24 Adding c:\Python24\lib\site-packages Traceback (most recent call last): File e:\devrel\Playpen\kbjorke\python\ipsm.py, line 13, in Initialize File , line 0, in __import__##3 File e:\devrel\Playpen\kbjorke\python\smtk.py, line 3, in Initialize File , line 0, in __import__##3 File c:\Python24\lib\lib-tk\Tkinter.py, line 38, in Initialize File , line 0, in __import__##3 ImportError: No module named _tkinter Am I missing some important path or step? Thanks KB: ----------------------------------------------------------------------------------- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ----------------------------------------------------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Sun Jun 4 22:01:00 2006 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sun, 04 Jun 2006 21:01:00 +0100 Subject: [IronPython] IronPython versus Tkinter... In-Reply-To: <590FCAE72E27D54CA1EADE7293BB444F04422A7E@hqemmail04.nvidia.com> References: <590FCAE72E27D54CA1EADE7293BB444F04422A7E@hqemmail04.nvidia.com> Message-ID: <44833BFC.5070303@voidspace.org.uk> Kevin Bjorke wrote: > > Any clues on running this under Beta7, or is it currently non-functional? > > I want to be able to run a GUI under both IronPython and Cpython since > my app's intent targets two different kinds of host machine. > > Current behavior: > > I have a Tkinter app called "smtk" which I call from this shell: > Tkinter is a C extension "_tkinter.pyd". C extensions are not currently supported (nor likely to be supported) by IronPython. A cross-platform GUI for IronPython/CPython doesn't currently exist - perhaps you can build an abstraction layer over the top of your GUI code which detects the underlying platform ? Michael Foord http://www.voidspace.org.uk/python/index.shtml > import sys > > addThesePaths = ['c:\\Python24\\lib', > 'c:\\Python24\\lib\\plat-win', > 'c:\\Python24\\lib\\lib-tk', > 'c:\\Python24', > 'c:\\Python24\\lib\\site-packages'] > > for p in addThesePaths: > print "Adding %s" % (p) > sys.path.append(p) > > import smtk > > Which works fine in cpython but under IronPython I get: > > Adding c:\Python24\lib > Adding c:\Python24\lib\plat-win > Adding c:\Python24\lib\lib-tk > Adding c:\Python24 > Adding c:\Python24\lib\site-packages > Traceback (most recent call last): > File e:\devrel\Playpen\kbjorke\python\ipsm.py, line 13, in Initialize > File , line 0, in __import__##3 > File e:\devrel\Playpen\kbjorke\python\smtk.py, line 3, in Initialize > File , line 0, in __import__##3 > File c:\Python24\lib\lib-tk\Tkinter.py, line 38, in Initialize > File , line 0, in __import__##3 > ImportError: No module named _tkinter > > Am I missing some important path or step? > > Thanks > KB: > > ------------------------------------------------------------------------ > This email message is for the sole use of the intended recipient(s) > and may contain confidential information. Any unauthorized review, > use, disclosure or distribution is prohibited. If you are not the > intended recipient, please contact the sender by reply email and > destroy all copies of the original message. > ------------------------------------------------------------------------ > ------------------------------------------------------------------------ > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From fuzzyman at voidspace.org.uk Sun Jun 4 23:54:43 2006 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sun, 04 Jun 2006 22:54:43 +0100 Subject: [IronPython] IronPython & Windows Forms In-Reply-To: <5b0248170606040618x5651e0f0md82b6b00903393fd@mail.gmail.com> References: <44828E6E.8050402@voidspace.org.uk> <5b0248170606040618x5651e0f0md82b6b00903393fd@mail.gmail.com> Message-ID: <448356A3.1090402@voidspace.org.uk> Sanghyeon Seo wrote: > 2006/6/4, Michael Foord : > >> Another bout of insomnia, so I've done a new entry on IronPython & >> Windows Forms : >> > > Insomnia is good! I've done the shots: > http://sparcs.kaist.ac.kr/~tinuviel/fepy/winforms/ > > Watch out! The text used is *slightly* different! :) > Entry updated. :-) Thanks Michael Foord http://www.voidspace.org.uk/python/index.shtml > Seo Sanghyeon > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > From KBjorke at nvidia.com Mon Jun 5 06:09:34 2006 From: KBjorke at nvidia.com (Kevin Bjorke) Date: Sun, 4 Jun 2006 21:09:34 -0700 Subject: [IronPython] IronPython & Windows Forms Message-ID: <590FCAE72E27D54CA1EADE7293BB444F04422A7F@hqemmail04.nvidia.com> There are only .png files in this dir, no html? -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Sunday, June 04, 2006 2:55 PM To: Discussion of IronPython Subject: Re: [IronPython] IronPython & Windows Forms Sanghyeon Seo wrote: > 2006/6/4, Michael Foord : > >> Another bout of insomnia, so I've done a new entry on IronPython & >> Windows Forms : >> > > Insomnia is good! I've done the shots: > http://sparcs.kaist.ac.kr/~tinuviel/fepy/winforms/ > > Watch out! The text used is *slightly* different! :) > Entry updated. :-) Thanks Michael Foord http://www.voidspace.org.uk/python/index.shtml > Seo Sanghyeon > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com ----------------------------------------------------------------------------------- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ----------------------------------------------------------------------------------- From KBjorke at nvidia.com Mon Jun 5 06:11:43 2006 From: KBjorke at nvidia.com (Kevin Bjorke) Date: Sun, 4 Jun 2006 21:11:43 -0700 Subject: [IronPython] IronPython versus Tkinter... Message-ID: <590FCAE72E27D54CA1EADE7293BB444F04422A80@hqemmail04.nvidia.com> That is bizarre, considering that Tk works fine under windows. Theu underlying purpose of python seems to be subverted by the lack of what most folks think of as basic python services, no? kb -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Sunday, June 04, 2006 1:01 PM To: Discussion of IronPython Subject: Re: [IronPython] IronPython versus Tkinter... Kevin Bjorke wrote: > > Any clues on running this under Beta7, or is it currently non-functional? > > I want to be able to run a GUI under both IronPython and Cpython since > my app's intent targets two different kinds of host machine. > > Current behavior: > > I have a Tkinter app called "smtk" which I call from this shell: > Tkinter is a C extension "_tkinter.pyd". C extensions are not currently supported (nor likely to be supported) by IronPython. A cross-platform GUI for IronPython/CPython doesn't currently exist - perhaps you can build an abstraction layer over the top of your GUI code which detects the underlying platform ? Michael Foord http://www.voidspace.org.uk/python/index.shtml > import sys > > addThesePaths = ['c:\\Python24\\lib', > 'c:\\Python24\\lib\\plat-win', > 'c:\\Python24\\lib\\lib-tk', > 'c:\\Python24', > 'c:\\Python24\\lib\\site-packages'] > > for p in addThesePaths: > print "Adding %s" % (p) > sys.path.append(p) > > import smtk > > Which works fine in cpython but under IronPython I get: > > Adding c:\Python24\lib > Adding c:\Python24\lib\plat-win > Adding c:\Python24\lib\lib-tk > Adding c:\Python24 > Adding c:\Python24\lib\site-packages > Traceback (most recent call last): > File e:\devrel\Playpen\kbjorke\python\ipsm.py, line 13, in Initialize > File , line 0, in __import__##3 > File e:\devrel\Playpen\kbjorke\python\smtk.py, line 3, in Initialize > File , line 0, in __import__##3 > File c:\Python24\lib\lib-tk\Tkinter.py, line 38, in Initialize > File , line 0, in __import__##3 > ImportError: No module named _tkinter > > Am I missing some important path or step? > > Thanks > KB: > > ------------------------------------------------------------------------ > This email message is for the sole use of the intended recipient(s) > and may contain confidential information. Any unauthorized review, > use, disclosure or distribution is prohibited. If you are not the > intended recipient, please contact the sender by reply email and > destroy all copies of the original message. > ------------------------------------------------------------------------ > ------------------------------------------------------------------------ > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From sanxiyn at gmail.com Mon Jun 5 07:08:41 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Mon, 5 Jun 2006 14:08:41 +0900 Subject: [IronPython] IronPython & Windows Forms In-Reply-To: <590FCAE72E27D54CA1EADE7293BB444F04422A7F@hqemmail04.nvidia.com> References: <590FCAE72E27D54CA1EADE7293BB444F04422A7F@hqemmail04.nvidia.com> Message-ID: <5b0248170606042208q5fdde54at10020691f8936cb7@mail.gmail.com> 2006/6/5, Kevin Bjorke : > There are only .png files in this dir, no html? The entry is at Michael Foord's blog: http://www.voidspace.org.uk/python/weblog/arch_d7_2006_06_03.shtml#e352 Seo Sanghyeon From kurtharriger at comcast.net Mon Jun 5 07:11:23 2006 From: kurtharriger at comcast.net (Kurt Harriger) Date: Sun, 4 Jun 2006 23:11:23 -0600 Subject: [IronPython] IronPython versus Tkinter... In-Reply-To: <590FCAE72E27D54CA1EADE7293BB444F04422A80@hqemmail04.nvidia.com> Message-ID: <01b101c6885e$7d874c00$6800a8c0@khhost> Sounds like you're just using the wrong tool for the task at hand. If CPython has what you need and you don't want or need to use .Net then why not just use CPython? Sorry, I couldn't help but point that out :). I agree that it would be nice to be able to use more of the existing python libraries without additional modification. I had a small issue myself experimenting with PLY as it apparently depends on md5, but in that case I it turned out to be rather trivial to replace with the .net implementation. Although IronPython doesn't support C extensions, perhaps you can use a C# class to wrap the win32 calls and import that, seems like it could work. If all else fails you could use CPython - it's just a bit slower :) - Kurt > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Kevin Bjorke > Sent: Sunday, June 04, 2006 10:12 PM > To: Discussion of IronPython > Subject: Re: [IronPython] IronPython versus Tkinter... > > That is bizarre, considering that Tk works fine under windows. Theu > underlying purpose of python seems to be subverted by the lack of what > most folks think of as basic python services, no? > > kb > > -----Original Message----- > From: users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Sunday, June 04, 2006 1:01 PM > To: Discussion of IronPython > Subject: Re: [IronPython] IronPython versus Tkinter... > > Kevin Bjorke wrote: > > > > Any clues on running this under Beta7, or is it currently > non-functional? > > > > I want to be able to run a GUI under both IronPython and Cpython since > > > my app's intent targets two different kinds of host machine. > > > > Current behavior: > > > > I have a Tkinter app called "smtk" which I call from this shell: > > > Tkinter is a C extension "_tkinter.pyd". > > C extensions are not currently supported (nor likely to be supported) by > > IronPython. > > A cross-platform GUI for IronPython/CPython doesn't currently exist - > perhaps you can build an abstraction layer over the top of your GUI code > > which detects the underlying platform ? > > Michael Foord > http://www.voidspace.org.uk/python/index.shtml > > > import sys > > > > addThesePaths = ['c:\\Python24\\lib', > > 'c:\\Python24\\lib\\plat-win', > > 'c:\\Python24\\lib\\lib-tk', > > 'c:\\Python24', > > 'c:\\Python24\\lib\\site-packages'] > > > > for p in addThesePaths: > > print "Adding %s" % (p) > > sys.path.append(p) > > > > import smtk > > > > Which works fine in cpython but under IronPython I get: > > > > Adding c:\Python24\lib > > Adding c:\Python24\lib\plat-win > > Adding c:\Python24\lib\lib-tk > > Adding c:\Python24 > > Adding c:\Python24\lib\site-packages > > Traceback (most recent call last): > > File e:\devrel\Playpen\kbjorke\python\ipsm.py, line 13, in > Initialize > > File , line 0, in __import__##3 > > File e:\devrel\Playpen\kbjorke\python\smtk.py, line 3, in Initialize > > File , line 0, in __import__##3 > > File c:\Python24\lib\lib-tk\Tkinter.py, line 38, in Initialize > > File , line 0, in __import__##3 > > ImportError: No module named _tkinter > > > > Am I missing some important path or step? > > > > Thanks > > KB: > > > > > ------------------------------------------------------------------------ > > This email message is for the sole use of the intended recipient(s) > > and may contain confidential information. Any unauthorized review, > > use, disclosure or distribution is prohibited. If you are not the > > intended recipient, please contact the sender by reply email and > > destroy all copies of the original message. > > > ------------------------------------------------------------------------ > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > users mailing list > > users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From KBjorke at nvidia.com Mon Jun 5 17:50:55 2006 From: KBjorke at nvidia.com (Kevin Bjorke) Date: Mon, 5 Jun 2006 08:50:55 -0700 Subject: [IronPython] IronPython versus Tkinter... Message-ID: <590FCAE72E27D54CA1EADE7293BB444F04422A81@hqemmail04.nvidia.com> You're right Kurt if the script (app) was the *entire* app, but in my case that's not true, the choice of "which python" is not mine... My constraint is that my app (script) runs within other apps. I have one host app that's got integrated IronPython scripting support, and another that has integrated Cpython scripting support, and a desire to write one app that shares as much as possible between the two (though I anticipated that this might be a problem, and did keep the UI code well-partitioned away from the underlying functions). Supporting two different UI paths is... Well, twice as much work! Back in the ancient days, I recall that one of the python-advocate battle cries was that the language was less important than the readily-available, easy-to-use, and platform-agnostic modules. I suspect that a lot of folks other than myself expect "python *plus* .NET services" and perceive "python" as meaning "python and its typical modules" -- rather than ".NET services *instead of* the python stuff you thought you already knew and could leverage." Thanks for the strategy ideas, I'll have to look at the options a bit harder. (Why can't everything just be perfect? :) ) KB -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kurt Harriger Sent: Sunday, June 04, 2006 10:11 PM To: 'Discussion of IronPython' Subject: Re: [IronPython] IronPython versus Tkinter... Sounds like you're just using the wrong tool for the task at hand. If CPython has what you need and you don't want or need to use .Net then why not just use CPython? Sorry, I couldn't help but point that out :). I agree that it would be nice to be able to use more of the existing python libraries without additional modification. I had a small issue myself experimenting with PLY as it apparently depends on md5, but in that case I it turned out to be rather trivial to replace with the .net implementation. Although IronPython doesn't support C extensions, perhaps you can use a C# class to wrap the win32 calls and import that, seems like it could work. If all else fails you could use CPython - it's just a bit slower :) - Kurt > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Kevin Bjorke > Sent: Sunday, June 04, 2006 10:12 PM > To: Discussion of IronPython > Subject: Re: [IronPython] IronPython versus Tkinter... > > That is bizarre, considering that Tk works fine under windows. Theu > underlying purpose of python seems to be subverted by the lack of what > most folks think of as basic python services, no? > > kb > > -----Original Message----- > From: users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Sunday, June 04, 2006 1:01 PM > To: Discussion of IronPython > Subject: Re: [IronPython] IronPython versus Tkinter... > > Kevin Bjorke wrote: > > > > Any clues on running this under Beta7, or is it currently > non-functional? > > > > I want to be able to run a GUI under both IronPython and Cpython since > > > my app's intent targets two different kinds of host machine. > > > > Current behavior: > > > > I have a Tkinter app called "smtk" which I call from this shell: > > > Tkinter is a C extension "_tkinter.pyd". > > C extensions are not currently supported (nor likely to be supported) by > > IronPython. > > A cross-platform GUI for IronPython/CPython doesn't currently exist - > perhaps you can build an abstraction layer over the top of your GUI code > > which detects the underlying platform ? > > Michael Foord > http://www.voidspace.org.uk/python/index.shtml > > > import sys > > > > addThesePaths = ['c:\\Python24\\lib', > > 'c:\\Python24\\lib\\plat-win', > > 'c:\\Python24\\lib\\lib-tk', > > 'c:\\Python24', > > 'c:\\Python24\\lib\\site-packages'] > > > > for p in addThesePaths: > > print "Adding %s" % (p) > > sys.path.append(p) > > > > import smtk > > > > Which works fine in cpython but under IronPython I get: > > > > Adding c:\Python24\lib > > Adding c:\Python24\lib\plat-win > > Adding c:\Python24\lib\lib-tk > > Adding c:\Python24 > > Adding c:\Python24\lib\site-packages > > Traceback (most recent call last): > > File e:\devrel\Playpen\kbjorke\python\ipsm.py, line 13, in > Initialize > > File , line 0, in __import__##3 > > File e:\devrel\Playpen\kbjorke\python\smtk.py, line 3, in Initialize > > File , line 0, in __import__##3 > > File c:\Python24\lib\lib-tk\Tkinter.py, line 38, in Initialize > > File , line 0, in __import__##3 > > ImportError: No module named _tkinter > > > > Am I missing some important path or step? > > > > Thanks > > KB: > > > > > ------------------------------------------------------------------------ > > This email message is for the sole use of the intended recipient(s) > > and may contain confidential information. Any unauthorized review, > > use, disclosure or distribution is prohibited. If you are not the > > intended recipient, please contact the sender by reply email and > > destroy all copies of the original message. > > > ------------------------------------------------------------------------ > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > users mailing list > > users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From curt at hagenlocher.org Mon Jun 5 18:02:38 2006 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 5 Jun 2006 09:02:38 -0700 Subject: [IronPython] IronPython versus Tkinter... In-Reply-To: <590FCAE72E27D54CA1EADE7293BB444F04422A81@hqemmail04.nvidia.com> References: <590FCAE72E27D54CA1EADE7293BB444F04422A81@hqemmail04.nvidia.com> Message-ID: On 6/5/06, Kevin Bjorke wrote: > > I suspect that a lot of folks other than myself expect "python *plus* > .NET services" and perceive "python" as meaning "python and its typical > modules" -- rather than ".NET services *instead of* the python stuff you > thought you already knew and could leverage." Any non-C implementation of the Python language is almost certainly not going to be binary-compatible with CPython for what seem like obvious reasons. If you want CPython plus .NET services, you should look into Python for .NET instead. That project uses the existing CPython engine, and is therefore compatible with existing C-based extensions. The website is at http://pythonnet.sourceforge.net/ -- Curt Hagenlocher curt at hagenlocher.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Mon Jun 5 18:22:22 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 5 Jun 2006 09:22:22 -0700 Subject: [IronPython] import array In-Reply-To: <785694cd0606040213v128506ck7a15d4f5656c92dc@mail.gmail.com> References: <785694cd0606040213v128506ck7a15d4f5656c92dc@mail.gmail.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E01EA28B842@df-foxhound-msg.exchange.corp.microsoft.com> We don't currently have an array module implemented and there's a good chance we may not get to it for 1.0, so for the time being it seems like you'll need to implement a custom module. I've gone ahead and opened a bug on this, and I'll update you if it looks like we'll get it done for 1.0. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of JoeSox Sent: Sunday, June 04, 2006 2:14 AM To: Discussion of IronPython Subject: [IronPython] import array I need to import the array module. Is there a workaround or do I need to create a custom module? Thanks -- Later, Joe _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at exchange.microsoft.com Mon Jun 5 18:25:12 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 5 Jun 2006 09:25:12 -0700 Subject: [IronPython] Bug With Packages In-Reply-To: <4481A885.7040501@voidspace.org.uk> References: <4481A885.7040501@voidspace.org.uk> Message-ID: <4039D552ADAB094BB1EA670F3E96214E01EA28B84F@df-foxhound-msg.exchange.corp.microsoft.com> Thanks for the bug report. I've filed the bug and we'll work on getting this one fixed for the next release. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Saturday, June 03, 2006 8:20 AM To: Discussion of IronPython Subject: [IronPython] Bug With Packages Hello all, I get a bug when importing names that don't exist from a package. I created a package directory (called package), and place an empty "__init__.py" file in it. I then created a file called "module.py", with nothing in it except : print "hello" Below is an IronPython (beta 7) console session using these files : IronPython 1.0.60523 (Beta) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> from package.module import module hello >>> type(module) >>> You can see the 'hello' from when the module is imported. It should raise an "ImportError" when trying to import the name module. Instead it returns a "module" object. Below is the same session in CPython : Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from package.module import module hello Traceback (most recent call last): File "", line 1, in ? ImportError: cannot import name module >>> Michael Foord http://www.voidspace.org.uk/python/index.shtml http://www.resolversystems.com _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at exchange.microsoft.com Mon Jun 5 18:28:53 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 5 Jun 2006 09:28:53 -0700 Subject: [IronPython] sys.path.append bug? In-Reply-To: <785694cd0606030240jf5536a5gafa14a4997251436@mail.gmail.com> References: <785694cd0606021650l2f7e4b84ted731860cafc0894@mail.gmail.com> <5b0248170606021739x7f2c73e9m231874bb74519401@mail.gmail.com> <785694cd0606030240jf5536a5gafa14a4997251436@mail.gmail.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E01EA28B859@df-foxhound-msg.exchange.corp.microsoft.com> Seo's pointing out that you're building up a string as-if the user had typed it into the console, and that string contains non-escaped characters. So you're putting in the equivalent of: sys.path.append(' 'C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\CNU2Demo\CNU2Demo\Bin\Debug') If you typed this at the console then the \B in \Bin\Debug would turn into the backspace escape character, and the path wouldn't be correct. If you change this to: ipEngine1.Execute("sys.path.append(r'" + Paths.MiscDirs.myapppath + "')"); then you should get the right behavior (note you have the @ don't escape character for C#, and I just moved that to being in the embedded string that you're passing to Python (the r string form). You could also still have the @ but in the sample code you're not really using it. Alternately you could do the escaping yourself. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of JoeSox Sent: Saturday, June 03, 2006 2:41 AM To: Discussion of IronPython Subject: Re: [IronPython] sys.path.append bug? On 6/3/06, Sanghyeon Seo wrote: > 2006/6/3, JoeSox : > > It appears the "CNU2Demo\x08in\\Debug" should read "CNU2Demo\\bin\\Debug" > > Well, > > >>> '\b' > '\x08' > > If you use PythonEngine.Execute, you should escape Python string. Seo, I don't understand what you are saying because I used .Execute and it stored the value incorrectly. Later, Joe _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From benblair at gmail.com Mon Jun 5 22:32:54 2006 From: benblair at gmail.com (Ben Blair) Date: Mon, 5 Jun 2006 15:32:54 -0500 Subject: [IronPython] Improving performance with stronger typing Message-ID: <3daacac60606051332s27188475p23fbd94fe766dec6@mail.gmail.com> Hi, One of the things I'm using IP for is to allow users to define functions on CLR objects. Overall, this works great, but I'd like to improve the performance as much as possible, since sometimes these functions are evaluated many thousands of times per second. I'd like to know if there's a better way to get the performance I want from IP the way it is, or if not how I can best contribute some optimizations to the project. It looks like internally, most CLR type instances are passed around as objects. When a particular type is needed, it is checked for, then the instance is cast to the desired type. For example, evaluating "4+5" calls Ops.Add(object x, object y), which does a bunch of type checking and casting before doing an add. Ideally, when the input types are known, IL should be emitted to just do the add operation. This would be especially useful when calling the generic PythonEngine.Evaluate<> method to get a strongly typed delegate for a python function. In that case, the types will all be known at the time Evaluate is called, so a type-specific version of the function could be generated. Because that type information is already passed to Evaluate<> (but currently discarded), I don't think any public interfaces would have to change. There are a couple of approaches I could try, but before I get started I wanted to see if there were any existing ideas out there about how to do this. Thanks, - Ben Blair From aude at microsoft.com Mon Jun 5 23:05:49 2006 From: aude at microsoft.com (Aude Espesset) Date: Mon, 5 Jun 2006 14:05:49 -0700 Subject: [IronPython] Infinite loop on package import References: <1421F7433DA4144597E8578016CEE5EF01EAA27083@df-foxhound-msg.exchange.corp.microsoft.com> <4039D552ADAB094BB1EA670F3E96214E01E99F19E0@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: Hi, I get an infinite loop when importing a package with the following files : __init__.py reads: from a import * a.py reads: import b b.py reads: import a ________________________________ From: users-bounces at lists.ironpython.com on behalf of Dino Viehland Sent: Fri 6/2/2006 2:14 PM To: Discussion of IronPython Subject: Re: [IronPython] How to update visual studio for Ironpython beta 7 & Infinite loop on package import We're actually not aware of any issues w/ importing... do you have a simple repro, or does it repro w/ the same steps as the previous one for you? To update to beta 7 you should be able to replace the IronPython binaries that ship w/ VSIP. Those typically get deployed to: %ProgramFiles\Visual Studio 2005 SDK\(some date)\VisualStudioIntegration\Common\Assemblies Just replace those, then re-build the IronPython integration sample (%ProgramFiles%\Visual Studio 2005 SDK\(some date)\VisualStudioIntegration\Samples\IronPythonIntegration\) and then the project should be up-to-date and using beta 7. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Aude Espesset Sent: Friday, June 02, 2006 2:00 PM To: users at lists.ironpython.com Subject: [IronPython] How to update visual studio for Ironpython beta 7 & Infinite loop on package import Hi, I have the april 2006 version of Visual Studio which contains IronPython, but I don't know how to update it to work with beta 7. I'm guessing I should copy the new source code somewhere and rebuild but I don't know where to copy it. My second question is about infinite loops when importing packages. There is an old message regarding this issue: http://lists.ironpython.com/htdig.cgi/users-ironpython.com/2006-March/001884.html Is it still an active bug? One package gives me an infinite loop on import. Should I try to trace back where it falls into an infinite loop or are you aware of this bug and still working on it? Thanks, Aude _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 5620 bytes Desc: not available URL: From Martin.Maly at microsoft.com Tue Jun 6 01:22:04 2006 From: Martin.Maly at microsoft.com (Martin Maly) Date: Mon, 5 Jun 2006 16:22:04 -0700 Subject: [IronPython] Infinite loop on package import In-Reply-To: Message-ID: <5C0A6F919D675745BB1DBA7412DB68F503A646F642@df-foxhound-msg.exchange.corp.microsoft.com> You are right. It is a bug. Thanks for reporting it, we'll try to get it fixed as soon as possible. Martin ________________________________ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Aude Espesset Sent: Monday, June 05, 2006 2:06 PM To: Discussion of IronPython Subject: [IronPython] Infinite loop on package import Hi, I get an infinite loop when importing a package with the following files : __init__.py reads: from a import * a.py reads: import b b.py reads: import a ________________________________ From: users-bounces at lists.ironpython.com on behalf of Dino Viehland Sent: Fri 6/2/2006 2:14 PM To: Discussion of IronPython Subject: Re: [IronPython] How to update visual studio for Ironpython beta 7 & Infinite loop on package import We're actually not aware of any issues w/ importing... do you have a simple repro, or does it repro w/ the same steps as the previous one for you? To update to beta 7 you should be able to replace the IronPython binaries that ship w/ VSIP. Those typically get deployed to: %ProgramFiles\Visual Studio 2005 SDK\(some date)\VisualStudioIntegration\Common\Assemblies Just replace those, then re-build the IronPython integration sample (%ProgramFiles%\Visual Studio 2005 SDK\(some date)\VisualStudioIntegration\Samples\IronPythonIntegration\) and then the project should be up-to-date and using beta 7. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Aude Espesset Sent: Friday, June 02, 2006 2:00 PM To: users at lists.ironpython.com Subject: [IronPython] How to update visual studio for Ironpython beta 7 & Infinite loop on package import Hi, I have the april 2006 version of Visual Studio which contains IronPython, but I don't know how to update it to work with beta 7. I'm guessing I should copy the new source code somewhere and rebuild but I don't know where to copy it. My second question is about infinite loops when importing packages. There is an old message regarding this issue: http://lists.ironpython.com/htdig.cgi/users-ironpython.com/2006-March/001884.html Is it still an active bug? One package gives me an infinite loop on import. Should I try to trace back where it falls into an infinite loop or are you aware of this bug and still working on it? Thanks, Aude _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From brian at sweetapp.com Tue Jun 6 09:46:01 2006 From: brian at sweetapp.com (Brian Quinlan) Date: Tue, 06 Jun 2006 09:46:01 +0200 Subject: [IronPython] Avalon example application In-Reply-To: <5C0A6F919D675745BB1DBA7412DB68F503A646F642@df-foxhound-msg.exchange.corp.microsoft.com> References: <5C0A6F919D675745BB1DBA7412DB68F503A646F642@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <448532B9.5010500@sweetapp.com> I wrote a simple Windows Presentation Foundation (a.k.a. Avalon) application to drill me in German vocabulary. While the (limited) interface is in German, the code is written in English (and the comments would be too, if there were any). It uses XAML for the GUI (including some really ugly animation). If anyone is interested, I've put the code up here: http://www.sweetapp.com/avalon/ And feel free to ask me if you find any problems. Cheers, Brian From kfarmer at thuban.org Tue Jun 6 10:58:43 2006 From: kfarmer at thuban.org (Keith J. Farmer) Date: Tue, 6 Jun 2006 01:58:43 -0700 Subject: [IronPython] Improving performance with stronger typing In-Reply-To: <3daacac60606051332s27188475p23fbd94fe766dec6@mail.gmail.com> References: <3daacac60606051332s27188475p23fbd94fe766dec6@mail.gmail.com> Message-ID: I can see it for primitive types, but not in general. ----- Keith J. Farmer // kfarmer at thuban.org -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ben Blair add. Ideally, when the input types are known, IL should be emitted to just do the add operation. From fuzzyman at voidspace.org.uk Tue Jun 6 11:02:20 2006 From: fuzzyman at voidspace.org.uk (Fuzzyman) Date: Tue, 06 Jun 2006 10:02:20 +0100 Subject: [IronPython] Improving performance with stronger typing In-Reply-To: References: <3daacac60606051332s27188475p23fbd94fe766dec6@mail.gmail.com> Message-ID: <4485449C.7070507@voidspace.org.uk> Keith J. Farmer wrote: >I can see it for primitive types, but not in general. > > > It sounds very interesting though. For circumstances where you are prepared to guarantee the type of objects (and the range of operations permitted on them), sacrificing dynamicity for speed sounds like a good trade off. I've half had it in mind to write a compiler for a Python subset (as an IronPython extension) that works similarly. Having no academic background in the subject anything I did would be quite naive... Michael Foord http://www.voidspace.org.uk/python/index.shtml >----- >Keith J. Farmer // kfarmer at thuban.org >-----Original Message----- >From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ben Blair > >add. Ideally, when the input types are known, IL should be emitted to just do the add operation. > >_______________________________________________ >users mailing list >users at lists.ironpython.com >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > From andrew at adersoftware.com Tue Jun 6 18:04:37 2006 From: andrew at adersoftware.com (Andrew Deren) Date: Tue, 6 Jun 2006 11:04:37 -0500 Subject: [IronPython] Improving performance with stronger typing In-Reply-To: <4485449C.7070507@voidspace.org.uk> References: <3daacac60606051332s27188475p23fbd94fe766dec6@mail.gmail.com> <4485449C.7070507@voidspace.org.uk> Message-ID: <000001c68982$e96741d0$bc35c570$@com> I also have interest in this subject. I'm working on another language that is as dynamic as python (even more so) and figuring out types is not easy. You can do some advanced code analysis to find some cases where you can guarantee the types, but that is not the most of the time. PHP added type hints to class methods, so with those you can do it. Another good example is boo language which looks similar to python but has strong typing, but you can do "duck" typing too. Andrew -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Fuzzyman Sent: Tuesday, June 06, 2006 4:02 AM To: Discussion of IronPython Subject: Re: [IronPython] Improving performance with stronger typing Keith J. Farmer wrote: >I can see it for primitive types, but not in general. > > > It sounds very interesting though. For circumstances where you are prepared to guarantee the type of objects (and the range of operations permitted on them), sacrificing dynamicity for speed sounds like a good trade off. I've half had it in mind to write a compiler for a Python subset (as an IronPython extension) that works similarly. Having no academic background in the subject anything I did would be quite naive... Michael Foord http://www.voidspace.org.uk/python/index.shtml >----- >Keith J. Farmer // kfarmer at thuban.org >-----Original Message----- >From: users-bounces at lists.ironpython.com >[mailto:users-bounces at lists.ironpython.com] On Behalf Of Ben Blair > >add. Ideally, when the input types are known, IL should be emitted to just do the add operation. > >_______________________________________________ >users mailing list >users at lists.ironpython.com >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From Harry.Pierson at microsoft.com Tue Jun 6 19:32:59 2006 From: Harry.Pierson at microsoft.com (Harry Pierson) Date: Tue, 6 Jun 2006 10:32:59 -0700 Subject: [IronPython] Improving performance with stronger typing References: <3daacac60606051332s27188475p23fbd94fe766dec6@mail.gmail.com> <4485449C.7070507@voidspace.org.uk> <000001c68982$e96741d0$bc35c570$@com> Message-ID: <92ED8A12D2BC094FAFCD16EC57E199FD03BF76@RED-MSG-81.redmond.corp.microsoft.com> VB.NET supports this kind of strong duck typing today. Furthermore, the next version of VB will support interface based duck typing, which combines strong typing benefits like intellisense with traditional duck typing benefits. Under the covers, the VB.NET compiler is generating reflection code to make the duck typed calls. Check out the "Dynamic Interfaces" section of http://msdn.microsoft.com/library/en-us/dnvs05/html/vb9overview.asp for more details. Harry Pierson Architect Microsoft Architecture Strategy Team email: hpierson at microsoft.com IM/email: harrypierson at hotmail.com weblog: http://devhawk.net phone: 425/705.6045 Make Trouble and Good Things Will Happen ________________________________ From: users-bounces at lists.ironpython.com on behalf of Andrew Deren Sent: Tue 6/6/2006 9:04 AM To: 'Discussion of IronPython' Subject: Re: [IronPython] Improving performance with stronger typing I also have interest in this subject. I'm working on another language that is as dynamic as python (even more so) and figuring out types is not easy. You can do some advanced code analysis to find some cases where you can guarantee the types, but that is not the most of the time. PHP added type hints to class methods, so with those you can do it. Another good example is boo language which looks similar to python but has strong typing, but you can do "duck" typing too. Andrew -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Fuzzyman Sent: Tuesday, June 06, 2006 4:02 AM To: Discussion of IronPython Subject: Re: [IronPython] Improving performance with stronger typing Keith J. Farmer wrote: >I can see it for primitive types, but not in general. > > > It sounds very interesting though. For circumstances where you are prepared to guarantee the type of objects (and the range of operations permitted on them), sacrificing dynamicity for speed sounds like a good trade off. I've half had it in mind to write a compiler for a Python subset (as an IronPython extension) that works similarly. Having no academic background in the subject anything I did would be quite naive... Michael Foord http://www.voidspace.org.uk/python/index.shtml >----- >Keith J. Farmer // kfarmer at thuban.org >-----Original Message----- >From: users-bounces at lists.ironpython.com >[mailto:users-bounces at lists.ironpython.com] On Behalf Of Ben Blair > >add. Ideally, when the input types are known, IL should be emitted to just do the add operation. > >_______________________________________________ >users mailing list >users at lists.ironpython.com >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From hostetlerm at gmail.com Tue Jun 6 21:05:16 2006 From: hostetlerm at gmail.com (Mike Hostetler) Date: Tue, 6 Jun 2006 14:05:16 -0500 Subject: [IronPython] Beta7 goodness Message-ID: I admit that I haven't used IronPython since Beta1, but today I had a chance to bang on Beta7 for a while. For a big test, I copied over the standard lib and the most-excellent path module, which combines all sorts of standard modules into one. You can get it here: http://www.jorendorff.com/articles/python/path/ Since the path module imports sys, os, fnmatch, glob, shutil, and codecs, it follows that those will work, too. And since those modules depend on other standard modules . . . well, you get the idea. And life looks good: IronPython 1.0.60523 (Beta) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> from path import path >>> parent = path(\"..\") >>> for dll in parent.glob(\"*.dll\"): ... print dll ... ..\IronMath.dll ..\IronPython.dll ..\MSEDAF.dll ..\MSEL.dll ..\WPOBJAPILib.dll >>> Also, right now I have IronPy talking web services to a .Net 1.1 server and running fine. Great work guys! -- Mike Hostetler http://mike.hostetlerhome.com/ From sanxiyn at gmail.com Tue Jun 6 21:11:28 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Wed, 7 Jun 2006 04:11:28 +0900 Subject: [IronPython] Beta7 goodness In-Reply-To: References: Message-ID: <5b0248170606061211x34dd6102q4e50d4b39c060ac6@mail.gmail.com> 2006/6/7, Mike Hostetler : > I admit that I haven't used IronPython since Beta1, but today I had a > chance to bang on Beta7 for a while. For a big test, I copied over > the standard lib and the most-excellent path module, which combines > all sorts of standard modules into one. You can get it here: > http://www.jorendorff.com/articles/python/path/ > > And life looks good: Hehe. That's partly because I tested IronPython against path.py and reported all problems I found. :) For example, (note: codecs was implemented since then) http://lists.ironpython.com/pipermail/users-ironpython.com/2006-February/001729.html Seo Sanghyeon From Ed.Butler at wellsfargo.com Tue Jun 6 22:42:38 2006 From: Ed.Butler at wellsfargo.com (Ed.Butler at wellsfargo.com) Date: Tue, 6 Jun 2006 15:42:38 -0500 Subject: [IronPython] Improving performance with stronger typing Message-ID: Have you heard of the .Net language "Boo"? ( http://boo.codehaus.org/ ) It seems to be a bit like Python with optional static typing. (Or maybe static typing is the default and "Duck" typing is optional. I haven't explored it that deeply.) --Ed B. From hernan at orgmf.com.ar Wed Jun 7 11:38:20 2006 From: hernan at orgmf.com.ar (Hernan Martinez Foffani) Date: Wed, 7 Jun 2006 11:38:20 +0200 Subject: [IronPython] Improving performance with stronger typing In-Reply-To: <000001c68982$e96741d0$bc35c570$@com> References: <3daacac60606051332s27188475p23fbd94fe766dec6@mail.gmail.com> <4485449C.7070507@voidspace.org.uk> <000001c68982$e96741d0$bc35c570$@com> Message-ID: <11fab4bc0606070238w16ab0d48u2ccd60de337baaa3@mail.gmail.com> There are several works in the field of type inference for dynamic languages. Many of them are focus on Python. I can remember now Brett Canon's overview and PyPy's. http://www.ocf.berkeley.edu/~bac/thesis.pdf and http://codespeak.net/pypy/dist/pypy/doc/translation.html#the-annotation-pass The first one has some bibliography links. Both are easy to read. BTW, both are mentioned in a recent LtU blog. http://lambda-the-ultimate.org/node/1519 Regards, -H. On 6/6/06, Andrew Deren wrote: > I also have interest in this subject. I'm working on another language that > is as dynamic as python (even more so) and figuring out types is not easy. > You can do some advanced code analysis to find some cases where you can > guarantee the types, but that is not the most of the time. > PHP added type hints to class methods, so with those you can do it. Another > good example is boo language which looks similar to python but has strong > typing, but you can do "duck" typing too. > Andrew > > -----Original Message----- > From: users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] On Behalf Of Fuzzyman > Sent: Tuesday, June 06, 2006 4:02 AM > To: Discussion of IronPython > Subject: Re: [IronPython] Improving performance with stronger typing > > Keith J. Farmer wrote: > > >I can see it for primitive types, but not in general. > > > > > > > It sounds very interesting though. For circumstances where you are prepared > to guarantee the type of objects (and the range of operations permitted on > them), sacrificing dynamicity for speed sounds like a good trade off. > > I've half had it in mind to write a compiler for a Python subset (as an > IronPython extension) that works similarly. Having no academic background in > the subject anything I did would be quite naive... > > Michael Foord > http://www.voidspace.org.uk/python/index.shtml > > >----- > >Keith J. Farmer // kfarmer at thuban.org > >-----Original Message----- > >From: users-bounces at lists.ironpython.com > >[mailto:users-bounces at lists.ironpython.com] On Behalf Of Ben Blair > > > >add. Ideally, when the input types are known, IL should be emitted to just > do the add operation. > > > >_______________________________________________ > >users mailing list > >users at lists.ironpython.com > >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From mbarnett at uniserve.com Wed Jun 7 13:58:10 2006 From: mbarnett at uniserve.com (Lesley & Mitch Barnett) Date: Wed, 7 Jun 2006 04:58:10 -0700 Subject: [IronPython] IronPython support In Visual Studio 2005 April VSSDK? In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E01E99F157A@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <000201c68a29$a9c85ad0$6401a8c0@NIS1861127372> Thanks Dino. I am debugging in Form.py in VS, just like a C# program. With your suggestions, I am able to step through the code, thanks. Mitch http://softwareindustrialization.com _____ From: Dino Viehland [mailto:dinov at exchange.microsoft.com] Sent: June 2, 2006 7:48 AM To: Discussion of IronPython Subject: Re: [IronPython] IronPython support In Visual Studio 2005 April VSSDK? On debugging: Are you debugging running the console, or did you put the code into a .py file and run it? The reason I ask is when you're running at the console we generate code in a mode that is essentially un-debuggable. The reason for this is that it's the only way the code is collectible by the GC. But if you put the code into a .py file and import it, then you'll get a much better experience - you should be able to step through the code at that point. As for getting the IronPython source files - you might be able to solve this using Just My Code (Tools->Options->Debugging->General->Enable Just My Code). Another option is tweaking the exception handling settings (Ctrl-Alt-E) so thrown CLR exceptions don't cause you to break in. You could point VS at the IronPython source code, but then you'd be stepping through tons of IP source code to understand your exception. So hopefully the Just My Code option will do the right thing for you. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Lesley & Mitch Barnett Sent: Friday, June 02, 2006 4:15 AM To: 'Discussion of IronPython' Subject: Re: [IronPython] IronPython support In Visual Studio 2005 April VSSDK? Fixed my own error: >>> from System.Reflection import * >>> a = Assembly.LoadFrom("mapack.dll") >>> Types = a.GetTypes() >>> for Type in Types: ... print Type ... Mapack.CholeskyDecomposition Mapack.EigenvalueDecomposition Mapack.LuDecomposition Mapack.Matrix Mapack.QrDecomposition Mapack.SingularValueDecomposition >>> Still have the VS debugging issue. _____ snip -------------- next part -------------- An HTML attachment was scrubbed... URL: From kburke at global.co.za Wed Jun 7 18:44:43 2006 From: kburke at global.co.za (Ken Burke) Date: Wed, 7 Jun 2006 18:44:43 +0200 Subject: [IronPython] Serial comms with IronPython Message-ID: <000001c68a51$ae424300$0a00000a@hpnx5000> Does anyone have an example of how to use System.IO.Ports.SerialPort from IronPython? Regards Ken Burke -------------- next part -------------- An HTML attachment was scrubbed... URL: From kurtharriger at comcast.net Thu Jun 8 04:21:16 2006 From: kurtharriger at comcast.net (kurtharriger at comcast.net) Date: Thu, 08 Jun 2006 02:21:16 +0000 Subject: [IronPython] prefix postfix bug Message-ID: <060820060221.11351.4487899C0003E1E300002C5722070215739D0A09079D9D0E089B9D9A05@comcast.net> a = 2; b=6; print a++ + ++b #prints 8 print ++b #prints 6 print a++ #syntax error (at least when using console) - Kurt -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Thu Jun 8 04:33:16 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Wed, 7 Jun 2006 19:33:16 -0700 Subject: [IronPython] prefix postfix bug In-Reply-To: <060820060221.11351.4487899C0003E1E300002C5722070215739D0A09079D9D0E089B9D9A05@comcast.net> References: <060820060221.11351.4487899C0003E1E300002C5722070215739D0A09079D9D0E089B9D9A05@comcast.net> Message-ID: <4039D552ADAB094BB1EA670F3E96214E01F5D30595@df-foxhound-msg.exchange.corp.microsoft.com> Have you tried this in Cpython? ++ doesn't exist in Python. So what you're really doing is: print a + (+(+(+(+b)))) Yep, b sure is positive! and ++b is the same thing +(+b) and a++ of course makes no sense, because there's no right hand side to the plus operator. This might make more sense if you replace b with a number, like 1, where might almost occasionally expect the + operator to be used in front of it, for some reason. Results from CPython: >>> a =2 ; b = 6 >>> print a++ + ++b 8 >>> print ++b 6 >>> print a++ File "", line 1 print a++ ^ SyntaxError: invalid syntax >>> import sys >>> sys.version '2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)]' >>> ________________________________ From: users-bounces at lists.ironpython.com On Behalf Of kurtharriger at comcast.net Sent: Wednesday, June 07, 2006 7:21 PM To: users at lists.ironpython.com Subject: [IronPython] prefix postfix bug a = 2; b=6; print a++ + ++b #prints 8 print ++b #prints 6 print a++ #syntax error (at least when using console) - Kurt -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 6063 bytes Desc: not available URL: From sanxiyn at gmail.com Thu Jun 8 05:26:31 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Thu, 8 Jun 2006 12:26:31 +0900 Subject: [IronPython] str, repr and getattr Message-ID: <5b0248170606072026g79fc59ecqddf016b96ac9bfbc@mail.gmail.com> See the attachment. # CPython C I am C D I am D # IronPython C I am C D AttributeError: __str__ Seo Sanghyeon -------------- next part -------------- A non-text attachment was scrubbed... Name: test.py Type: text/x-python Size: 203 bytes Desc: not available URL: From sanxiyn at gmail.com Thu Jun 8 05:27:59 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Thu, 8 Jun 2006 12:27:59 +0900 Subject: [IronPython] str, repr and getattr In-Reply-To: <5b0248170606072026g79fc59ecqddf016b96ac9bfbc@mail.gmail.com> References: <5b0248170606072026g79fc59ecqddf016b96ac9bfbc@mail.gmail.com> Message-ID: <5b0248170606072027j6334cf0bg900ea5e3221e3641@mail.gmail.com> 2006/6/8, Sanghyeon Seo : > See the attachment. Oops, sorry. Wrong file. Seo Sanghyeon -------------- next part -------------- A non-text attachment was scrubbed... Name: test.py Type: text/x-python Size: 421 bytes Desc: not available URL: From kurtharriger at comcast.net Thu Jun 8 05:40:34 2006 From: kurtharriger at comcast.net (Kurt Harriger) Date: Wed, 7 Jun 2006 21:40:34 -0600 Subject: [IronPython] prefix postfix bug In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E01F5D30595@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <024f01c68aad$4cb2cf40$6800a8c0@khhost> Okay, that makes sense. I wouldn't normally use the prefix operator in an expression, and I'm guessing not many people do so I wasn't all that surprised no one had found it yet. I just kind of stumbled on it by accident and thought the behavior unusual; I would have expected a syntax error if ++ wasn't supported (and I did get an error when trying postfix at the end of the line but it didn't occur to me it was because ++ wasn't a valid operator)! Thanks, - Kurt > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Dino Viehland > Sent: Wednesday, June 07, 2006 8:33 PM > To: Discussion of IronPython > Subject: Re: [IronPython] prefix postfix bug > > Have you tried this in Cpython? ++ doesn't exist in Python. So what > you're really doing is: > > print a + (+(+(+(+b)))) > > Yep, b sure is positive! > > and ++b is the same thing +(+b) > > and a++ of course makes no sense, because there's no right hand side to > the plus operator. > > This might make more sense if you replace b with a number, like 1, where > might almost occasionally expect the + operator to be used in front of it, > for some reason. > > Results from CPython: > >>> a =2 ; b = 6 > >>> print a++ + ++b > 8 > >>> print ++b > 6 > >>> print a++ > File "", line 1 > print a++ > ^ > SyntaxError: invalid syntax > >>> import sys > >>> sys.version > '2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)]' > >>> > ________________________________ > From: users-bounces at lists.ironpython.com On Behalf Of > kurtharriger at comcast.net > Sent: Wednesday, June 07, 2006 7:21 PM > To: users at lists.ironpython.com > Subject: [IronPython] prefix postfix bug > > a = 2; b=6; > print a++ + ++b #prints 8 > print ++b #prints 6 > print a++ #syntax error (at least when using console) > > > - Kurt From dinov at exchange.microsoft.com Thu Jun 8 05:53:18 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Wed, 7 Jun 2006 20:53:18 -0700 Subject: [IronPython] str, repr and getattr In-Reply-To: <5b0248170606072027j6334cf0bg900ea5e3221e3641@mail.gmail.com> References: <5b0248170606072026g79fc59ecqddf016b96ac9bfbc@mail.gmail.com>, <5b0248170606072027j6334cf0bg900ea5e3221e3641@mail.gmail.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E01F5D30596@df-foxhound-msg.exchange.corp.microsoft.com> Thanks for the report. We'll fix this for the next release. The fix is actually pretty simple (wrap the Ops.Call & return true in in OldClass.cs in OldInstance.TryGetAttr w/ a try/catch MissingMemberException, right after the 2nd TryRawGetAttr) if you want to work around it until then. I'll have to do some further exploration to make sure we don't have similar issues w/ not trapping AttributeError (which we map to MissingMemberException). ________________________________________ From: users-bounces at lists.ironpython.com On Behalf Of Sanghyeon Seo Sent: Wednesday, June 07, 2006 8:27 PM To: Discussion of IronPython Subject: Re: [IronPython] str, repr and getattr 2006/6/8, Sanghyeon Seo : > See the attachment. Oops, sorry. Wrong file. Seo Sanghyeon -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 4114 bytes Desc: not available URL: From sanxiyn at gmail.com Thu Jun 8 07:00:23 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Thu, 8 Jun 2006 14:00:23 +0900 Subject: [IronPython] ctypes for IronPython (preliminary) Message-ID: <5b0248170606072200k111bc8acw649d06ee2511713@mail.gmail.com> ctypes is a popular CPython extension planned for inclusion in Python 2.5. It is a foreign function interface library. Homepage: http://starship.python.net/crew/theller/ctypes/ Documentation: http://docs.python.org/dev/lib/module-ctypes.html I would like to announce a preliminary implementation of ctypes for IronPython using .NET's P/Invoke machinery. Code is here: http://sparcs.kaist.ac.kr/~tinuviel/fepy/lib/ctypes.py Example is here: http://sparcs.kaist.ac.kr/~tinuviel/fepy/example/ctypes_test.py The example can be run on IronPython as well as on CPython. What's missing: * Many primitive types * .value on primitive types * Buffers and .raw * Pointer and .contents * Reference * Array * Structure and union and .offset * Recursive type * Callback * External value * Windows goodies In short, everything except those needed to demo anything interesting. :-) But you can do this now: IronPython 1.0.60523 (Beta) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> from ctypes import * >>> print cdll.msvcrt.strlen('hello') 5 >>> Enjoy! Seo Sanghyeon From sanxiyn at gmail.com Thu Jun 8 08:25:32 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Thu, 8 Jun 2006 15:25:32 +0900 Subject: [IronPython] str, repr and getattr In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E01F5D30596@df-foxhound-msg.exchange.corp.microsoft.com> References: <5b0248170606072026g79fc59ecqddf016b96ac9bfbc@mail.gmail.com> <5b0248170606072027j6334cf0bg900ea5e3221e3641@mail.gmail.com> <4039D552ADAB094BB1EA670F3E96214E01F5D30596@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <5b0248170606072325x5dbad168g7c60f56a071b861b@mail.gmail.com> 2006/6/8, Dino Viehland : Thanks for the report. We'll fix this for the next release. The fix is actually pretty simple (wrap the Ops.Call & return true in in OldClass.cs in OldInstance.TryGetAttr w/ a try/catch MissingMemberException, right after the 2nd TryRawGetAttr) if you want to work around it until then. In case that others have similar issue, here's a patch you can apply. Seo Sanghyeon -------------- next part -------------- --- IronPython/Runtime/OldClass.cs.orig 2006-06-08 15:22:40.000000000 +0900 +++ IronPython/Runtime/OldClass.cs 2006-06-08 15:21:22.000000000 +0900 @@ -482,7 +482,11 @@ if (name.Id != SymbolTable.GetAttrId) { object getattr; if (TryRawGetAttr(SymbolTable.GetAttr, out getattr)) { - value = Ops.Call(getattr, SymbolTable.IdToString(name)); + try { + value = Ops.Call(getattr, SymbolTable.IdToString(name)); + } catch (MissingMemberException) { + return false; + } return true; } } From fuzzyman at voidspace.org.uk Thu Jun 8 10:52:20 2006 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Thu, 08 Jun 2006 09:52:20 +0100 Subject: [IronPython] ctypes for IronPython (preliminary) In-Reply-To: <5b0248170606072200k111bc8acw649d06ee2511713@mail.gmail.com> References: <5b0248170606072200k111bc8acw649d06ee2511713@mail.gmail.com> Message-ID: <4487E544.5030107@voidspace.org.uk> Sanghyeon Seo wrote: > ctypes is a popular CPython extension planned for inclusion in Python > 2.5. It is a foreign function interface library. > > Homepage: http://starship.python.net/crew/theller/ctypes/ > Documentation: http://docs.python.org/dev/lib/module-ctypes.html > > I would like to announce a preliminary implementation of ctypes for > IronPython using .NET's P/Invoke machinery. > > Code is here: http://sparcs.kaist.ac.kr/~tinuviel/fepy/lib/ctypes.py > Example is here: http://sparcs.kaist.ac.kr/~tinuviel/fepy/example/ctypes_test.py > > The example can be run on IronPython as well as on CPython. > > Wow. Given that one of the google SoC projects is to implement some of the Python C extensions for PyPy using ctypes, this opens new possibilities. Great. Michael Foord http://www.voidspace.org.uk/python/index.shtml http://www.resolversystems.com > What's missing: > * Many primitive types > * .value on primitive types > * Buffers and .raw > * Pointer and .contents > * Reference > * Array > * Structure and union and .offset > * Recursive type > * Callback > * External value > * Windows goodies > > In short, everything except those needed to demo anything interesting. > :-) But you can do this now: > > IronPython 1.0.60523 (Beta) on .NET 2.0.50727.42 > Copyright (c) Microsoft Corporation. All rights reserved. > >>>> from ctypes import * >>>> print cdll.msvcrt.strlen('hello') >>>> > 5 > > > Enjoy! > > Seo Sanghyeon > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > From sanxiyn at gmail.com Thu Jun 8 13:19:04 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Thu, 8 Jun 2006 20:19:04 +0900 Subject: [IronPython] CPython reflector (work-in-progress) Message-ID: <5b0248170606080419j6222ba31u5c50096041b503f8@mail.gmail.com> This is a CPython reflector, using ctypes. With ctypes for IronPython I posted today, this can be run both on CPython and on IronPython. When finished, this should allow importing CPython native modules in IronPython. There's something wrong with memory management, as I couldn't get strings working. (Segfault on free.) So I cheated by using PyImport_ImportModule instead of PyImport_Import, etc. (The former takes char *, the later takes Python string object.) Seo Sanghyeon -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: reflect.txt URL: From korpse-ironpython at kaydash.za.net Thu Jun 8 16:02:46 2006 From: korpse-ironpython at kaydash.za.net (Jonathan Jacobs) Date: Thu, 08 Jun 2006 16:02:46 +0200 Subject: [IronPython] CPython reflector (work-in-progress) In-Reply-To: <5b0248170606080419j6222ba31u5c50096041b503f8@mail.gmail.com> References: <5b0248170606080419j6222ba31u5c50096041b503f8@mail.gmail.com> Message-ID: <44882E06.8090401@kaydash.za.net> Sanghyeon Seo wrote: > This is a CPython reflector, using ctypes. With ctypes for IronPython > I posted today, this can be run both on CPython and on IronPython. > > When finished, this should allow importing CPython native modules in IronPython. This is a very cool idea, except I'm running into an issue. I've made a modification to reflect.txt, I changed the DLL name from "libpython2.3.so" to "python24.dll". (creflect.py is your reflect.txt attachment with my modification, ctypes.py is http://sparcs.kaist.ac.kr/~tinuviel/fepy/lib/ctypes.py) >>> import creflect Traceback (most recent call last): File , line 0, in PyInt_AsLong File , line 0, in ##5 File , line 0, in __import__##3 File C:\Documents and Settings\JJ\Desktop\IronPython-1.0-Beta7\creflect.py, line 64, in Initialize File C:\Documents and Settings\JJ\Desktop\IronPython-1.0-Beta7\creflect.py, line 62, in cimport File C:\Documents and Settings\JJ\Desktop\IronPython-1.0-Beta7\creflect.py, line 47, in unwrap File ctypes, line unknown, in __call__ File C:\Documents and Settings\JJ\Desktop\IronPython-1.0-Beta7\ctypes.py, line 84, in __call__ StandardError: Exception has been thrown by the target of an invocation. (Bit of a bizarrely structured stack trace!) -- Jonathan When you meet a master swordsman, show him your sword. When you meet a man who is not a poet, do not show him your poem. -- Rinzai, ninth century Zen master From dinov at exchange.microsoft.com Thu Jun 8 17:25:13 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Thu, 8 Jun 2006 08:25:13 -0700 Subject: [IronPython] CPython reflector (work-in-progress) In-Reply-To: <44882E06.8090401@kaydash.za.net> References: <5b0248170606080419j6222ba31u5c50096041b503f8@mail.gmail.com> <44882E06.8090401@kaydash.za.net> Message-ID: <4039D552ADAB094BB1EA670F3E96214E01F55BAFD3@df-foxhound-msg.exchange.corp.microsoft.com> To get a better stack trace I would suggest you run w/ -X:ExceptionDetail command line option which will give you the raw exception info thrown by the CLR. By default we exclude all of the IronPython, mscorlib, etc... frames and just give you the frames that you presumably would be interested in (and that would be the same as what CPython displays). But -X:ExceptionDetail will flip that off. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jonathan Jacobs Sent: Thursday, June 08, 2006 7:03 AM To: Discussion of IronPython Subject: Re: [IronPython] CPython reflector (work-in-progress) Sanghyeon Seo wrote: > This is a CPython reflector, using ctypes. With ctypes for IronPython > I posted today, this can be run both on CPython and on IronPython. > > When finished, this should allow importing CPython native modules in IronPython. This is a very cool idea, except I'm running into an issue. I've made a modification to reflect.txt, I changed the DLL name from "libpython2.3.so" to "python24.dll". (creflect.py is your reflect.txt attachment with my modification, ctypes.py is http://sparcs.kaist.ac.kr/~tinuviel/fepy/lib/ctypes.py) >>> import creflect Traceback (most recent call last): File , line 0, in PyInt_AsLong File , line 0, in ##5 File , line 0, in __import__##3 File C:\Documents and Settings\JJ\Desktop\IronPython-1.0-Beta7\creflect.py, line 64, in Initialize File C:\Documents and Settings\JJ\Desktop\IronPython-1.0-Beta7\creflect.py, line 62, in cimport File C:\Documents and Settings\JJ\Desktop\IronPython-1.0-Beta7\creflect.py, line 47, in unwrap File ctypes, line unknown, in __call__ File C:\Documents and Settings\JJ\Desktop\IronPython-1.0-Beta7\ctypes.py, line 84, in __call__ StandardError: Exception has been thrown by the target of an invocation. (Bit of a bizarrely structured stack trace!) -- Jonathan When you meet a master swordsman, show him your sword. When you meet a man who is not a poet, do not show him your poem. -- Rinzai, ninth century Zen master _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From korpse-ironpython at kaydash.za.net Thu Jun 8 18:10:56 2006 From: korpse-ironpython at kaydash.za.net (Jonathan Jacobs) Date: Thu, 08 Jun 2006 18:10:56 +0200 Subject: [IronPython] CPython reflector (work-in-progress) In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E01F55BAFD3@df-foxhound-msg.exchange.corp.microsoft.com> References: <5b0248170606080419j6222ba31u5c50096041b503f8@mail.gmail.com> <44882E06.8090401@kaydash.za.net> <4039D552ADAB094BB1EA670F3E96214E01F55BAFD3@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <44884C10.2050106@kaydash.za.net> Dino Viehland wrote: > To get a better stack trace I would suggest you run w/ -X:ExceptionDetail > command line option which will give you the raw exception info thrown by > the CLR. By default we exclude all of the IronPython, mscorlib, etc... > frames and just give you the frames that you presumably would be interested > in (and that would be the same as what CPython displays). But > -X:ExceptionDetail will flip that off. I've attached the spew from -X:ExceptionDetail. -- Jonathan -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: splat.txt URL: From dinov at exchange.microsoft.com Fri Jun 9 21:31:15 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Fri, 9 Jun 2006 12:31:15 -0700 Subject: [IronPython] IronPython Live on CodePlex! Message-ID: <4039D552ADAB094BB1EA670F3E96214E020224FEFF@df-foxhound-msg.exchange.corp.microsoft.com> We have successfully completed the first stage of our migration to CodePlex. You can download and view the latest sources. If you had reported a bug, you can try the latest sources to see if the problem has been fixed. We are in the process of porting bugs from our internal database to CodePlex. We have 20 odd bugs ported, but the full process will take a while. We encourage you open new bugs directly on CodePlex. For the mailing list, we are not yet switching to CodePlex discussion forums as they do not support receiving emails directly in your Inbox. We will take a look at this again in the near future. We will be announcing this on Monday at TechEd and expect to keep on making improvements to it in the near future. Links of Interest: CodePlex - www.codeplex.com IronPython on CodePlex http://www.codeplex.com/Wiki/View.aspx?ProjectName=IronPython Bugs http://www.codeplex.com/WorkItem/List.aspx?ProjectName=IronPython Up-To-Date Source: http://www.codeplex.com/SourceControl/ListDownloadableCommits.aspx?ProjectName=IronPython From beppler at gmail.com Fri Jun 9 22:27:05 2006 From: beppler at gmail.com (Carlos Alberto Costa Beppler) Date: Fri, 9 Jun 2006 17:27:05 -0300 Subject: [IronPython] IronPython Live on CodePlex! In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E020224FEFF@df-foxhound-msg.exchange.corp.microsoft.com> References: <4039D552ADAB094BB1EA670F3E96214E020224FEFF@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: Cool, but how to "view" the source code? 2006/6/9, Dino Viehland : > We have successfully completed the first stage of our migration to CodePlex. You can download and view the latest sources. If you had reported a bug, you can try the latest sources to see if the problem has been fixed. > From pef at fluent.com Fri Jun 9 23:17:41 2006 From: pef at fluent.com (Paul Felix) Date: Fri, 09 Jun 2006 17:17:41 -0400 Subject: [IronPython] IronPython at TechEd 2006? Message-ID: <4489E575.1060004@fluent.com> Hi, Will there be any way to get "virtual" access to the IronPython breakout session or to presentation materials? Paul From dinov at exchange.microsoft.com Fri Jun 9 23:39:12 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Fri, 9 Jun 2006 14:39:12 -0700 Subject: [IronPython] IronPython Live on CodePlex! In-Reply-To: References: <4039D552ADAB094BB1EA670F3E96214E020224FEFF@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E0202250065@df-foxhound-msg.exchange.corp.microsoft.com> If you go to this page: http://www.codeplex.com/SourceControl/ListDownloadableCommits.aspx?ProjectName=IronPython You can browse the recent checkins and download all the code associated w/ a change. You can also get Team Explorer (see http://www.codeplex.com/Wiki/View.aspx?ProjectName=CodePlex&title=Obtaining%20the%20Team%20Explorer%20Client for directions) and install that into VS. That gives you the ability to sync to particular changes, submit work items via Visual Studio, and generally have an integrated experience there. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Carlos Alberto Costa Beppler Sent: Friday, June 09, 2006 1:27 PM To: Discussion of IronPython Subject: Re: [IronPython] IronPython Live on CodePlex! Cool, but how to "view" the source code? 2006/6/9, Dino Viehland : > We have successfully completed the first stage of our migration to CodePlex. You can download and view the latest sources. If you had reported a bug, you can try the latest sources to see if the problem has been fixed. > _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From beppler at gmail.com Sat Jun 10 03:00:03 2006 From: beppler at gmail.com (Carlos Alberto Costa Beppler) Date: Fri, 9 Jun 2006 22:00:03 -0300 Subject: [IronPython] IronPython Live on CodePlex! In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E0202250065@df-foxhound-msg.exchange.corp.microsoft.com> References: <4039D552ADAB094BB1EA670F3E96214E020224FEFF@df-foxhound-msg.exchange.corp.microsoft.com> <4039D552ADAB094BB1EA670F3E96214E0202250065@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: Thanks, I did not understand that tab (maybe because I got accustomed to Subversion over http). Now I?m downloading the VSTS client. 2006/6/9, Dino Viehland : > If you go to this page: http://www.codeplex.com/SourceControl/ListDownloadableCommits.aspx?ProjectName=IronPython > > You can browse the recent checkins and download all the code associated w/ a change. > > You can also get Team Explorer (see http://www.codeplex.com/Wiki/View.aspx?ProjectName=CodePlex&title=Obtaining%20the%20Team%20Explorer%20Client for directions) and install that into VS. That gives you the ability to sync to particular changes, submit work items via Visual Studio, and generally have an integrated experience there. > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Carlos Alberto Costa Beppler > Sent: Friday, June 09, 2006 1:27 PM > To: Discussion of IronPython > Subject: Re: [IronPython] IronPython Live on CodePlex! > > Cool, but how to "view" the source code? > > 2006/6/9, Dino Viehland : > > We have successfully completed the first stage of our migration to CodePlex. You can download and view the latest sources. If you had reported a bug, you can try the latest sources to see if the problem has been fixed. > > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From sanxiyn at gmail.com Sat Jun 10 05:49:02 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Sat, 10 Jun 2006 12:49:02 +0900 Subject: [IronPython] IronPython Live on CodePlex! In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E020224FEFF@df-foxhound-msg.exchange.corp.microsoft.com> References: <4039D552ADAB094BB1EA670F3E96214E020224FEFF@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <5b0248170606092049y4b9ee40frec39a77abd123b4a@mail.gmail.com> Releases tab says, "Release 1.0 Beta 7 Beta". Well, one doesn't need to be told it is a beta, twice. Seo Sanghyeon From sanxiyn at gmail.com Sat Jun 10 06:19:35 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Sat, 10 Jun 2006 13:19:35 +0900 Subject: [IronPython] IronPython Live on CodePlex! In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E0202250065@df-foxhound-msg.exchange.corp.microsoft.com> References: <4039D552ADAB094BB1EA670F3E96214E020224FEFF@df-foxhound-msg.exchange.corp.microsoft.com> <4039D552ADAB094BB1EA670F3E96214E0202250065@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <5b0248170606092119w26b201ffo85ab90e9f1abb86f@mail.gmail.com> Carlos Alberto Costa Beppler wrote: > Cool, but how to "view" the source code? Dino Viehland wrote: > If you go to this page (Source Code tab) you can browse the recent checkins > and download all the code associated w/ a change. I think he meant something like this: http://svn.python.org/view/ Where you can view the source of each file without downloading everything, can view the commit log of each file, diff between revisions with coloring, jump to the specific revision, etc. CodePlex doesn't seem to provide anything similar on the web. Seo Sanghyeon From sanxiyn at gmail.com Sat Jun 10 06:44:34 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Sat, 10 Jun 2006 13:44:34 +0900 Subject: [IronPython] IronPython Live on CodePlex! In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E020224FEFF@df-foxhound-msg.exchange.corp.microsoft.com> References: <4039D552ADAB094BB1EA670F3E96214E020224FEFF@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <5b0248170606092144x3b5e0d54wf22b4d881ee0a6fd@mail.gmail.com> 2006/6/10, Dino Viehland : > We are in the process of porting bugs from our internal database to CodePlex. > We have 20 odd bugs ported, but the full process will take a while. We > encourage you open new bugs directly on CodePlex. This is grand! I already opened workitem #391, taken from the mailing list: http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&WorkItemId=391 Now I think about it, I don't want to report duplicates if the bug migration is incomplete. Any ETA of the complete migration? Will I get mail notifications from workitem updates? Can I subscribe to workitems I am interested in, to receive any further updates? Seo Sanghyeon From sanxiyn at gmail.com Sat Jun 10 06:59:51 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Sat, 10 Jun 2006 13:59:51 +0900 Subject: [IronPython] Accessing CodePlex VSTS with Teamprise (or not) Message-ID: <5b0248170606092159m441c4316j706f86897b5ce1d5@mail.gmail.com> I hope I don't get banned for blatant advertising. :-) Teamprise http://teamprise.com/ is a client for accessing VSTS from outside of the Visual Studio or Windows, for example, from Linux, Mac, or Eclipse. I was obviously interested, so I downloaded the trial version and tried. Unfortunately, it doesn't seem to work currently. I asked the support forum, and got this reply: http://support.teamprise.com/viewtopic.php?t=5 "Hi Seo, I'm currently talking with the CodePlex team to figure out a way ahead. Basically, there were a couple of problems - the main one is a limitation in that we do not currently support NTLMv2 which is what the CodePlex system requires for authentication. Both teams are very keen that we solve this problem so I'm confident that we can. I'll post back when I have more to report." This is encouraging. Seo Sanghyeon From Shri.Borde at microsoft.com Sat Jun 10 21:17:12 2006 From: Shri.Borde at microsoft.com (Shri Borde) Date: Sat, 10 Jun 2006 12:17:12 -0700 Subject: [IronPython] IronPython Live on CodePlex! - Migration of previously reported bugs In-Reply-To: <5b0248170606092144x3b5e0d54wf22b4d881ee0a6fd@mail.gmail.com> Message-ID: We will be working on the migration over the next couple of weeks. You need not bother opening workitems on CodePlex for previously reported issues as we had already captured all reported issues, and these will eventually make their way to CodePlex automatically. But do open new bugs directly on CodePlex! There is no way to subscribe to workitems. This does sound like a very useful feature, and I have passed this on to the CodePlex team. Also, the request for viewing source files directly on the web. Thanks Shri Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038) -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Sanghyeon Seo Sent: Friday, June 09, 2006 9:45 PM To: Discussion of IronPython Subject: Re: [IronPython] IronPython Live on CodePlex! 2006/6/10, Dino Viehland : > We are in the process of porting bugs from our internal database to CodePlex. > We have 20 odd bugs ported, but the full process will take a while. We > encourage you open new bugs directly on CodePlex. This is grand! I already opened workitem #391, taken from the mailing list: http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&WorkItemId=391 Now I think about it, I don't want to report duplicates if the bug migration is incomplete. Any ETA of the complete migration? Will I get mail notifications from workitem updates? Can I subscribe to workitems I am interested in, to receive any further updates? Seo Sanghyeon _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From sanxiyn at gmail.com Sun Jun 11 14:11:16 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Sun, 11 Jun 2006 21:11:16 +0900 Subject: [IronPython] clr.GetPythonType? Message-ID: <5b0248170606110511l293c20do47599f1e8ce61f14@mail.gmail.com> I think the reverse of clr.GetClrType, maybe named clr.GetPythonType, would be useful. What do you think? It could be implemented as an one-liner calling IronPython.Runtime.Ops.GetDynamicTypeFromType. Seo Sanghyeon From sanxiyn at gmail.com Sun Jun 11 14:43:32 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Sun, 11 Jun 2006 21:43:32 +0900 Subject: [IronPython] ctypes for IronPython update Message-ID: <5b0248170606110543l5f6f09e6n983cf5e142259377@mail.gmail.com> I updated my ctypes module a bit: http://sparcs.kaist.ac.kr/~tinuviel/fepy/lib/ctypes.py * .value on primitive types is implemented * Beginning of byref() implementation, using MakeByRefType() * Improved __repr__() of ctypes types A short demo showing all changes since the last update follows: >>> from ctypes import * >>> t = c_int() >>> t c_int(0) >>> t.value 0 >>> p = byref(t) >>> p byref(c_int(0)) >>> libc = CDLL('libc.so.6') >>> libc >>> libc.time(p) 1150029601 >>> libc.time.method Int32 time(System.Int32 ByRef) >>> t # This is wrong! c_int(0) Seo Sanghyeon From jvm_cop at spamcop.net Sun Jun 11 19:18:37 2006 From: jvm_cop at spamcop.net (J. Merrill) Date: Sun, 11 Jun 2006 13:18:37 -0400 Subject: [IronPython] clr.GetPythonType? In-Reply-To: <5b0248170606110511l293c20do47599f1e8ce61f14@mail.gmail.com > References: <5b0248170606110511l293c20do47599f1e8ce61f14@mail.gmail.com> Message-ID: <7.0.1.0.2.20060611131819.08942e88@wheresmymailserver.com> +1 (or +5 if that's allowed) At 08:11 AM 6/11/2006, Sanghyeon Seo wrote >I think the reverse of clr.GetClrType, maybe named clr.GetPythonType, >would be useful. What do you think? > >It could be implemented as an one-liner calling >IronPython.Runtime.Ops.GetDynamicTypeFromType. J. Merrill / Analytical Software Corp From dinov at exchange.microsoft.com Mon Jun 12 17:33:03 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 12 Jun 2006 08:33:03 -0700 Subject: [IronPython] IronPython Live on CodePlex! - Migration of previously reported bugs In-Reply-To: <2D38793E06D9DE44928514640720269206DB213811@df-foxhound-msg.exchange.corp.microsoft.com> References: <5b0248170606092144x3b5e0d54wf22b4d881ee0a6fd@mail.gmail.com> <2D38793E06D9DE44928514640720269206DB213811@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E02022503B8@df-foxhound-msg.exchange.corp.microsoft.com> The RSS feed (which is how all updates are currently driven) does appear to include changes to bugs, so that's one way you can get this information pushed down instead of having to poll. There's a also a CodePlex bug to improve the RSS feeds as well to make them more granular (I've added a request to that bug to be able to have RSS-bug feed queries). -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Shri Borde Sent: Saturday, June 10, 2006 12:17 PM To: Discussion of IronPython Subject: Re: [IronPython] IronPython Live on CodePlex! - Migration of previously reported bugs We will be working on the migration over the next couple of weeks. You need not bother opening workitems on CodePlex for previously reported issues as we had already captured all reported issues, and these will eventually make their way to CodePlex automatically. But do open new bugs directly on CodePlex! There is no way to subscribe to workitems. This does sound like a very useful feature, and I have passed this on to the CodePlex team. Also, the request for viewing source files directly on the web. Thanks Shri Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038) -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Sanghyeon Seo Sent: Friday, June 09, 2006 9:45 PM To: Discussion of IronPython Subject: Re: [IronPython] IronPython Live on CodePlex! 2006/6/10, Dino Viehland : > We are in the process of porting bugs from our internal database to CodePlex. > We have 20 odd bugs ported, but the full process will take a while. We > encourage you open new bugs directly on CodePlex. This is grand! I already opened workitem #391, taken from the mailing list: http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&WorkItemId=391 Now I think about it, I don't want to report duplicates if the bug migration is incomplete. Any ETA of the complete migration? Will I get mail notifications from workitem updates? Can I subscribe to workitems I am interested in, to receive any further updates? Seo Sanghyeon _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at exchange.microsoft.com Mon Jun 12 17:34:49 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 12 Jun 2006 08:34:49 -0700 Subject: [IronPython] clr.GetPythonType? In-Reply-To: <7.0.1.0.2.20060611131819.08942e88@wheresmymailserver.com> References: <5b0248170606110511l293c20do47599f1e8ce61f14@mail.gmail.com> <7.0.1.0.2.20060611131819.08942e88@wheresmymailserver.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E02022503B9@df-foxhound-msg.exchange.corp.microsoft.com> This seems like a good idea - I've added it to the CodePlex issue tracker. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of J. Merrill Sent: Sunday, June 11, 2006 10:19 AM To: Discussion of IronPython Subject: Re: [IronPython] clr.GetPythonType? +1 (or +5 if that's allowed) At 08:11 AM 6/11/2006, Sanghyeon Seo wrote >I think the reverse of clr.GetClrType, maybe named clr.GetPythonType, >would be useful. What do you think? > >It could be implemented as an one-liner calling >IronPython.Runtime.Ops.GetDynamicTypeFromType. J. Merrill / Analytical Software Corp _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From cculver at bitshifters.org Mon Jun 12 03:51:46 2006 From: cculver at bitshifters.org (Clay Culver) Date: Sun, 11 Jun 2006 18:51:46 -0700 Subject: [IronPython] Problem Loading DirectX? Message-ID: <448CC8B2.3080304@bitshifters.org> I'm having a problem loading DirectX (MDX) 2.0. Here is what I am trying: >>> import clr >>> clr.LoadAssemblyByPartialName("Microsoft.DirectX") Microsoft.DirectX, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 >>> import Microsoft.DirectX Traceback (most recent call last): File , line 0, in ##17 File , line 0, in __import__##4 ImportError: cannot import DirectX from Microsoft Does anyone know what is wrong with this? Thanks! From dinov at exchange.microsoft.com Mon Jun 12 23:17:23 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 12 Jun 2006 14:17:23 -0700 Subject: [IronPython] Problem Loading DirectX? In-Reply-To: <448CC8B2.3080304@bitshifters.org> References: <448CC8B2.3080304@bitshifters.org> Message-ID: <4039D552ADAB094BB1EA670F3E96214E020225079F@df-foxhound-msg.exchange.corp.microsoft.com> You want to either do a clr.AddReference* (ByPartialName, or one of the other variants), or use the returned assembly object returned from the Load functions. If you use AddReference then the import statement will work as you have it here. If you just use the returned assembly object, you'll want something like: >>> dx = clr.LoadAssemblyByPartialName("Microsoft.DirectX") >>> x = dx.Microsoft.DirectX x is now the DirectX namespace, and you can access types out of it using x.SomeType() -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Clay Culver Sent: Sunday, June 11, 2006 6:52 PM To: users at lists.ironpython.com Subject: [IronPython] Problem Loading DirectX? I'm having a problem loading DirectX (MDX) 2.0. Here is what I am trying: >>> import clr >>> clr.LoadAssemblyByPartialName("Microsoft.DirectX") Microsoft.DirectX, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 >>> import Microsoft.DirectX Traceback (most recent call last): File , line 0, in ##17 File , line 0, in __import__##4 ImportError: cannot import DirectX from Microsoft Does anyone know what is wrong with this? Thanks! _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From sanxiyn at gmail.com Tue Jun 13 07:16:20 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Tue, 13 Jun 2006 14:16:20 +0900 Subject: [IronPython] CodePlex downloader Message-ID: <5b0248170606122216q3fed335ak8d44331dc51ad871@mail.gmail.com> In my copious free time, I wrote a CodePlex downloader: http://sparcs.kaist.ac.kr/~tinuviel/fepy/util/codeplex.py This scraps CodePlex website, determines the latest revision, confirm the license to the user, and try downloading sources by incrementing revision number by one from the last downloaded revision, and discard a revision if it's of the same size as the previous one. If you start from scratch, it will take a long time. So create a directory ("IronPython" in this case) and download the latest source by hand. After that, running "codeplex.py IronPython" will download sources from that revision. I already checked all the revisions from 1 upto 454 and downloaded them. They are available here: http://sparcs.kaist.ac.kr/~tinuviel/download/IronPython/ Writing a tool to diff between revision archives is left as an exercise to the reader. Seo Sanghyeon From sanxiyn at gmail.com Wed Jun 14 03:39:04 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Wed, 14 Jun 2006 10:39:04 +0900 Subject: [IronPython] Latest IronPython on Mono Message-ID: <5b0248170606131839j570e8b7by2a07ae81d3370034@mail.gmail.com> If you want to compile the latest IronPython source downloaded off CodePlex on Mono, you need to edit a bit. Currently Mono C# compiler can't switch on nullable types, and seems to have a problem with delegate conversion. Switch problem is tracked as Mono bug #78630. See the attachment for a patch. Seo Sanghyeon -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: mono-workaround.txt URL: From ralph.soons.asml at hotmail.com Wed Jun 14 09:09:57 2006 From: ralph.soons.asml at hotmail.com (Ralph Soons) Date: Wed, 14 Jun 2006 09:09:57 +0200 Subject: [IronPython] remoting from IronPython Message-ID: Hi all, I am trying to call an function on a server via remoting, using IronPython. First I created a c# server/client to test everything. In the C# client I have the following code: RemotingConfiguration.Configure("executablename.exe.config", false); RemoteObject object = new RemoteObject(); I can now reach my remote object from the client. There after I used IronPython to do the same in python: System.Runtime.Remoting.RemotingConfiguration.Configure("IronPythonTest.exe.config", 0) s = NameSpace.RemoteObject() I now get the following error: Cannot load type 'clr:IronPython.Runtime.IDynamicObject, IronPython I also tried: s = System.Activator.GetObject( System.Type.GetType(NameSpace.RemoteObject), "http://localhost:9000/mytest" ) I then get this error: # File , line 0, in GetObject##10 # File mscorlib, line unknown, in GetObject #SystemError: Trying to create a proxy to an unbound type. Can someone tell me if its possible to use remoting from IronPython or does any one has an idea what I am doing wrong? Many thanks! Ralph Soons _________________________________________________________________ Play online games with your friends with MSN Messenger http://www.join.msn.com/messenger/overview From bashmohandes at gmail.com Wed Jun 14 14:03:04 2006 From: bashmohandes at gmail.com (Mohammed Hossam) Date: Wed, 14 Jun 2006 15:03:04 +0300 Subject: [IronPython] remoting from IronPython In-Reply-To: References: Message-ID: <18bfce840606140503r758d0d38pf164df54cc9dcaa9@mail.gmail.com> I got a similar problem when I used Iron Python with Windows Workflow, because any API that accepts a System.Type argument when it is used with Iron Python fails, On 6/14/06, Ralph Soons wrote: > > Hi all, > > I am trying to call an function on a server via remoting, using > IronPython. > First I created a c# server/client to test everything. > > In the C# client I have the following code: > RemotingConfiguration.Configure("executablename.exe.config", false); > RemoteObject object = new RemoteObject(); > I can now reach my remote object from the client. > > There after I used IronPython to do the same in python: > System.Runtime.Remoting.RemotingConfiguration.Configure(" > IronPythonTest.exe.config", > 0) > s = NameSpace.RemoteObject() > I now get the following error: > Cannot load type 'clr:IronPython.Runtime.IDynamicObject, IronPython > > I also tried: > s = System.Activator.GetObject( System.Type.GetType(NameSpace.RemoteObject > ), > "http://localhost:9000/mytest" ) > I then get this error: > # File , line 0, in GetObject##10 > # File mscorlib, line unknown, in GetObject > #SystemError: Trying to create a proxy to an unbound type. > > Can someone tell me if its possible to use remoting from IronPython or > does > any one has an idea what I am doing wrong? > > Many thanks! > Ralph Soons > > _________________________________________________________________ > Play online games with your friends with MSN Messenger > http://www.join.msn.com/messenger/overview > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- =-=-=-=-=-=-=-=-=-=-=-= Mohammed Hossam Eldin bashmohandes at gmail.com mobile: +2012 3818978 www.SilverKey.us -------------------------------------------------------- Technical Blogs http://www.Bashmohandes.com -------------------------------------------------------- Personal Blogs http://spaces.msn.com/bashmohandes =-=-=-=-=-=-=-=-=-=-=-=-= -------------- next part -------------- An HTML attachment was scrubbed... URL: From ralph.soons.asml at hotmail.com Wed Jun 14 15:57:28 2006 From: ralph.soons.asml at hotmail.com (Ralph Soons) Date: Wed, 14 Jun 2006 15:57:28 +0200 Subject: [IronPython] remoting from IronPython In-Reply-To: Message-ID: Hi again, I searched a little further and found out the following: When using remoting - server activated objects: and s = NameSpace.RemoteObject() I discovered the "Cannot load type 'clr:IronPython.Runtime.IDynamicObject, IronPython...." exception occurs on the following location: namespace: IronPython.Runtime file: Ops.cs funtion: public static DynamicType GetDynamicType(object o) { Line: if (dt != null) return dt.GetDynamicType(); (line 562) during debuging I discovered that 'object o' (input of the function) is of type MarshalByRefObject so I guess its my remote object. The first line in the function is IDynamicObject dt = o as IDynamicObject;. dt is not null after executing this line. This is strange because its being casted to IDynamicObject, which isn't implemented by my remote object. There after when the next line is executed if (dt != null) return dt.GetDynamicType();, the exception occurs. Can anyone tell me why this is going wrong? I also tried to use client activated objects. In that case the remoting call is working correctly. Thanks for your help again. Ralph Soons >From: "Ralph Soons" >Reply-To: Discussion of IronPython >To: users at lists.ironpython.com >Subject: [IronPython] remoting from IronPython >Date: Wed, 14 Jun 2006 09:09:57 +0200 > >Hi all, > >I am trying to call an function on a server via remoting, using IronPython. >First I created a c# server/client to test everything. > >In the C# client I have the following code: >RemotingConfiguration.Configure("executablename.exe.config", false); >RemoteObject object = new RemoteObject(); >I can now reach my remote object from the client. > >There after I used IronPython to do the same in python: >System.Runtime.Remoting.RemotingConfiguration.Configure("IronPythonTest.exe.config", >0) >s = NameSpace.RemoteObject() >I now get the following error: >Cannot load type 'clr:IronPython.Runtime.IDynamicObject, IronPython > >I also tried: >s = System.Activator.GetObject( >System.Type.GetType(NameSpace.RemoteObject), >"http://localhost:9000/mytest" ) >I then get this error: ># File , line 0, in GetObject##10 ># File mscorlib, line unknown, in GetObject >#SystemError: Trying to create a proxy to an unbound type. > >Can someone tell me if its possible to use remoting from IronPython or does >any one has an idea what I am doing wrong? > >Many thanks! >Ralph Soons > >_________________________________________________________________ >Play online games with your friends with MSN Messenger >http://www.join.msn.com/messenger/overview > >_______________________________________________ >users mailing list >users at lists.ironpython.com >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _________________________________________________________________ MSN Search, for accurate results! http://search.msn.nl From michael.foord at resolversystems.com Wed Jun 14 16:03:08 2006 From: michael.foord at resolversystems.com (Michael Foord) Date: Wed, 14 Jun 2006 15:03:08 +0100 Subject: [IronPython] Tuple Hashing and Dictionaries Message-ID: <4490171C.6090300@resolversystems.com> Hello all, We have created a custom object which we wanted to use as a dictionary key as part of a tuple. To make sure that equivalent instances of our class can be used as keys we overloaded the __hash__ method. This works in CPython, but not in IronPython. The following test sessions both use the following class : class Test(object): def __hash__(self): return hash("fish") def __eq__(self, other): return type(other) == type(self) CPython : Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> a = Test() >>> b = Test() >>> a == b True >>> c = {} >>> c[(a, 1, 2)] = 3 >>> c[(b, 1, 2)] 3 IronPython : IronPython 1.0.60420 (Beta) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> a = Test() >>> b = Test() >>> a == b True >>> c = {} >>> c[(a, 1, 2)] = 3 >>> c[(b, 1, 2)] Traceback (most recent call last): File , line 0, in input##22 KeyError: '(, 1, 2)' All the best, Michael Foord http://www.resolversystems.com http://www.voidspace.org.uk/python/index.shtml From clay at bitshifters.org Wed Jun 14 16:27:55 2006 From: clay at bitshifters.org (Clay Culver) Date: Wed, 14 Jun 2006 07:27:55 -0700 Subject: [IronPython] Problem Loading DirectX? In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E020225079F@df-foxhound-msg.exchange.corp.microsoft.com> References: <448CC8B2.3080304@bitshifters.org> <4039D552ADAB094BB1EA670F3E96214E020225079F@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <44901CEB.60504@bitshifters.org> Ahhh ok, thanks. Sorry, I was being very dense that day. Things are working great now. Dino Viehland wrote: > You want to either do a clr.AddReference* (ByPartialName, or one of the other variants), or use the returned assembly object returned from the Load functions. > > If you use AddReference then the import statement will work as you have it here. If you just use the returned assembly object, you'll want something like: > > >>>> dx = clr.LoadAssemblyByPartialName("Microsoft.DirectX") >>>> x = dx.Microsoft.DirectX >>>> > > x is now the DirectX namespace, and you can access types out of it using x.SomeType() > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Clay Culver > Sent: Sunday, June 11, 2006 6:52 PM > To: users at lists.ironpython.com > Subject: [IronPython] Problem Loading DirectX? > > I'm having a problem loading DirectX (MDX) 2.0. Here is what I am trying: > > >>> import clr > >>> clr.LoadAssemblyByPartialName("Microsoft.DirectX") > Microsoft.DirectX, Version=2.0.0.0, Culture=neutral, > PublicKeyToken=31bf3856ad364e35 > >>> import Microsoft.DirectX > Traceback (most recent call last): > File , line 0, in ##17 > File , line 0, in __import__##4 > ImportError: cannot import DirectX from Microsoft > > Does anyone know what is wrong with this? > > Thanks! > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Thu Jun 15 02:16:03 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Wed, 14 Jun 2006 17:16:03 -0700 Subject: [IronPython] remoting from IronPython In-Reply-To: References: Message-ID: <4039D552ADAB094BB1EA670F3E96214E0202B542AB@df-foxhound-msg.exchange.corp.microsoft.com> Are you remoting to another process, or to another app domain? Does the other process have access to IronPython.dll ? One thing you might want to try doing is installing IronPython into the GAC (assuming this is beta 7, or if you re-built w/ the Signed Release or Signed Debug build modes w/ your own key), and then try this. This would ensure that the type would be loadable in both app domains, even if the files aren't readily available. It's also go a long way to making sure we're getting loaded into the correct loader context. Another helpful debugging tip for debugging CLR interaction issues is running IronPythonConsole w/ the -X:ExceptionDetail option. That will get you a much better stack trace about where the issue is occurring. I'd need to get some time to setup a repro to be able to say much more about this - but it's definitely something we'll want to make works (or understand why it doesn't if it's impossible to make work) before 1.0. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ralph Soons Sent: Wednesday, June 14, 2006 6:57 AM To: users at lists.ironpython.com Subject: Re: [IronPython] remoting from IronPython Hi again, I searched a little further and found out the following: When using remoting - server activated objects: and s = NameSpace.RemoteObject() I discovered the "Cannot load type 'clr:IronPython.Runtime.IDynamicObject, IronPython...." exception occurs on the following location: namespace: IronPython.Runtime file: Ops.cs funtion: public static DynamicType GetDynamicType(object o) { Line: if (dt != null) return dt.GetDynamicType(); (line 562) during debuging I discovered that 'object o' (input of the function) is of type MarshalByRefObject so I guess its my remote object. The first line in the function is IDynamicObject dt = o as IDynamicObject;. dt is not null after executing this line. This is strange because its being casted to IDynamicObject, which isn't implemented by my remote object. There after when the next line is executed if (dt != null) return dt.GetDynamicType();, the exception occurs. Can anyone tell me why this is going wrong? I also tried to use client activated objects. In that case the remoting call is working correctly. Thanks for your help again. Ralph Soons >From: "Ralph Soons" >Reply-To: Discussion of IronPython >To: users at lists.ironpython.com >Subject: [IronPython] remoting from IronPython >Date: Wed, 14 Jun 2006 09:09:57 +0200 > >Hi all, > >I am trying to call an function on a server via remoting, using IronPython. >First I created a c# server/client to test everything. > >In the C# client I have the following code: >RemotingConfiguration.Configure("executablename.exe.config", false); >RemoteObject object = new RemoteObject(); I can now reach my remote >object from the client. > >There after I used IronPython to do the same in python: >System.Runtime.Remoting.RemotingConfiguration.Configure("IronPythonTest >.exe.config", >0) >s = NameSpace.RemoteObject() >I now get the following error: >Cannot load type 'clr:IronPython.Runtime.IDynamicObject, IronPython > >I also tried: >s = System.Activator.GetObject( >System.Type.GetType(NameSpace.RemoteObject), >"http://localhost:9000/mytest" ) >I then get this error: ># File , line 0, in GetObject##10 ># File mscorlib, line unknown, in GetObject >#SystemError: Trying to create a proxy to an unbound type. > >Can someone tell me if its possible to use remoting from IronPython or >does any one has an idea what I am doing wrong? > >Many thanks! >Ralph Soons > >_________________________________________________________________ >Play online games with your friends with MSN Messenger >http://www.join.msn.com/messenger/overview > >_______________________________________________ >users mailing list >users at lists.ironpython.com >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _________________________________________________________________ MSN Search, for accurate results! http://search.msn.nl _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at exchange.microsoft.com Thu Jun 15 02:22:18 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Wed, 14 Jun 2006 17:22:18 -0700 Subject: [IronPython] remoting from IronPython In-Reply-To: References: Message-ID: <4039D552ADAB094BB1EA670F3E96214E0202B542B9@df-foxhound-msg.exchange.corp.microsoft.com> I've also opened an issue on CodePlex to track this (#470) -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ralph Soons Sent: Wednesday, June 14, 2006 6:57 AM To: users at lists.ironpython.com Subject: Re: [IronPython] remoting from IronPython Hi again, I searched a little further and found out the following: When using remoting - server activated objects: and s = NameSpace.RemoteObject() I discovered the "Cannot load type 'clr:IronPython.Runtime.IDynamicObject, IronPython...." exception occurs on the following location: namespace: IronPython.Runtime file: Ops.cs funtion: public static DynamicType GetDynamicType(object o) { Line: if (dt != null) return dt.GetDynamicType(); (line 562) during debuging I discovered that 'object o' (input of the function) is of type MarshalByRefObject so I guess its my remote object. The first line in the function is IDynamicObject dt = o as IDynamicObject;. dt is not null after executing this line. This is strange because its being casted to IDynamicObject, which isn't implemented by my remote object. There after when the next line is executed if (dt != null) return dt.GetDynamicType();, the exception occurs. Can anyone tell me why this is going wrong? I also tried to use client activated objects. In that case the remoting call is working correctly. Thanks for your help again. Ralph Soons >From: "Ralph Soons" >Reply-To: Discussion of IronPython >To: users at lists.ironpython.com >Subject: [IronPython] remoting from IronPython >Date: Wed, 14 Jun 2006 09:09:57 +0200 > >Hi all, > >I am trying to call an function on a server via remoting, using IronPython. >First I created a c# server/client to test everything. > >In the C# client I have the following code: >RemotingConfiguration.Configure("executablename.exe.config", false); >RemoteObject object = new RemoteObject(); I can now reach my remote >object from the client. > >There after I used IronPython to do the same in python: >System.Runtime.Remoting.RemotingConfiguration.Configure("IronPythonTest >.exe.config", >0) >s = NameSpace.RemoteObject() >I now get the following error: >Cannot load type 'clr:IronPython.Runtime.IDynamicObject, IronPython > >I also tried: >s = System.Activator.GetObject( >System.Type.GetType(NameSpace.RemoteObject), >"http://localhost:9000/mytest" ) >I then get this error: ># File , line 0, in GetObject##10 ># File mscorlib, line unknown, in GetObject >#SystemError: Trying to create a proxy to an unbound type. > >Can someone tell me if its possible to use remoting from IronPython or >does any one has an idea what I am doing wrong? > >Many thanks! >Ralph Soons > >_________________________________________________________________ >Play online games with your friends with MSN Messenger >http://www.join.msn.com/messenger/overview > >_______________________________________________ >users mailing list >users at lists.ironpython.com >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _________________________________________________________________ MSN Search, for accurate results! http://search.msn.nl _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at exchange.microsoft.com Thu Jun 15 02:22:32 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Wed, 14 Jun 2006 17:22:32 -0700 Subject: [IronPython] Tuple Hashing and Dictionaries In-Reply-To: <4490171C.6090300@resolversystems.com> References: <4490171C.6090300@resolversystems.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E0202B542BA@df-foxhound-msg.exchange.corp.microsoft.com> I've also opened an issue to track this on CodePlex (#469) -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Wednesday, June 14, 2006 7:03 AM To: Discussion of IronPython Subject: [IronPython] Tuple Hashing and Dictionaries Hello all, We have created a custom object which we wanted to use as a dictionary key as part of a tuple. To make sure that equivalent instances of our class can be used as keys we overloaded the __hash__ method. This works in CPython, but not in IronPython. The following test sessions both use the following class : class Test(object): def __hash__(self): return hash("fish") def __eq__(self, other): return type(other) == type(self) CPython : Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> a = Test() >>> b = Test() >>> a == b True >>> c = {} >>> c[(a, 1, 2)] = 3 >>> c[(b, 1, 2)] 3 IronPython : IronPython 1.0.60420 (Beta) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> a = Test() >>> b = Test() >>> a == b True >>> c = {} >>> c[(a, 1, 2)] = 3 >>> c[(b, 1, 2)] Traceback (most recent call last): File , line 0, in input##22 KeyError: '(, 1, 2)' All the best, Michael Foord http://www.resolversystems.com http://www.voidspace.org.uk/python/index.shtml _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From jsacksteder at gmail.com Thu Jun 15 07:04:15 2006 From: jsacksteder at gmail.com (jeff sacksteder) Date: Thu, 15 Jun 2006 01:04:15 -0400 Subject: [IronPython] compiling standalone programs Message-ID: <51c8a7be0606142204q43805dd8xf9433f61c9c362de@mail.gmail.com> So what is the status of compiling to standalone IL programs? Last thing I heard was that it was rather experimental. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ralph.soons.asml at hotmail.com Thu Jun 15 09:43:39 2006 From: ralph.soons.asml at hotmail.com (Ralph Soons) Date: Thu, 15 Jun 2006 09:43:39 +0200 Subject: [IronPython] remoting from IronPython Message-ID: I am using a seperate process. After I include IronPython.dll in the library where my remote object is implemented, I get the following exception: "Attempted to call a method declared on type 'IronPython.Runtime.IDynamicObject' on an object which exposes 'RemotingServerClient.ServerTalk'." (RemotingServerClient.ServerTalk is my remote object) If you need the stacktrace, see the attachment. I also have another problem. I was trying to get an event via remoting from the server back to my client (using client activated objects setting). I include a library in both the server as the python client in which my remote object is implemented. This also contains a delegate to be used for the event. When I try to register a delegate from the python client, I get the following exception: Cannot serialize delegates over unmanaged function pointers, dynamic methods or methods outside the delegate creator's assembly. When using a c# client, this works ok. Thanks for your help. Ralph Soons >From: Dino Viehland >Reply-To: Discussion of IronPython >To: Discussion of IronPython >Subject: Re: [IronPython] remoting from IronPython >Date: Wed, 14 Jun 2006 17:16:03 -0700 > >Are you remoting to another process, or to another app domain? Does the >other process have access to IronPython.dll ? > >One thing you might want to try doing is installing IronPython into the GAC >(assuming this is beta 7, or if you re-built w/ the Signed Release or >Signed Debug build modes w/ your own key), and then try this. This would >ensure that the type would be loadable in both app domains, even if the >files aren't readily available. It's also go a long way to making sure >we're getting loaded into the correct loader context. > >Another helpful debugging tip for debugging CLR interaction issues is >running IronPythonConsole w/ the -X:ExceptionDetail option. That will get >you a much better stack trace about where the issue is occurring. > >I'd need to get some time to setup a repro to be able to say much more >about this - but it's definitely something we'll want to make works (or >understand why it doesn't if it's impossible to make work) before 1.0. > > >-----Original Message----- >From: users-bounces at lists.ironpython.com >[mailto:users-bounces at lists.ironpython.com] On Behalf Of Ralph Soons >Sent: Wednesday, June 14, 2006 6:57 AM >To: users at lists.ironpython.com >Subject: Re: [IronPython] remoting from IronPython > >Hi again, > >I searched a little further and found out the following: > >When using remoting - server activated objects: >and s = NameSpace.RemoteObject() >I discovered the "Cannot load type 'clr:IronPython.Runtime.IDynamicObject, >IronPython...." exception occurs on the following location: >namespace: IronPython.Runtime >file: Ops.cs >funtion: public static DynamicType GetDynamicType(object o) { >Line: if (dt != null) return dt.GetDynamicType(); (line 562) > >during debuging I discovered that 'object o' (input of the function) is of >type MarshalByRefObject so I guess its my remote object. The first line in >the function is IDynamicObject dt = o as IDynamicObject;. dt is not null >after executing this line. This is strange because its being casted to >IDynamicObject, which isn't implemented by my remote object. There after >when the next line is executed if (dt != null) return dt.GetDynamicType();, >the exception occurs. >Can anyone tell me why this is going wrong? > >I also tried to use client activated objects. In that case the remoting >call is working correctly. > >Thanks for your help again. >Ralph Soons > > >From: "Ralph Soons" > >Reply-To: Discussion of IronPython > >To: users at lists.ironpython.com > >Subject: [IronPython] remoting from IronPython > >Date: Wed, 14 Jun 2006 09:09:57 +0200 > > > >Hi all, > > > >I am trying to call an function on a server via remoting, using >IronPython. > >First I created a c# server/client to test everything. > > > >In the C# client I have the following code: > >RemotingConfiguration.Configure("executablename.exe.config", false); > >RemoteObject object = new RemoteObject(); I can now reach my remote > >object from the client. > > > >There after I used IronPython to do the same in python: > >System.Runtime.Remoting.RemotingConfiguration.Configure("IronPythonTest > >.exe.config", > >0) > >s = NameSpace.RemoteObject() > >I now get the following error: > >Cannot load type 'clr:IronPython.Runtime.IDynamicObject, IronPython > > > >I also tried: > >s = System.Activator.GetObject( > >System.Type.GetType(NameSpace.RemoteObject), > >"http://localhost:9000/mytest" ) > >I then get this error: > ># File , line 0, in GetObject##10 > ># File mscorlib, line unknown, in GetObject > >#SystemError: Trying to create a proxy to an unbound type. > > > >Can someone tell me if its possible to use remoting from IronPython or > >does any one has an idea what I am doing wrong? > > > >Many thanks! > >Ralph Soons > > > >_________________________________________________________________ > >Play online games with your friends with MSN Messenger > >http://www.join.msn.com/messenger/overview > > > >_______________________________________________ > >users mailing list > >users at lists.ironpython.com > >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > >_________________________________________________________________ >MSN Search, for accurate results! http://search.msn.nl > >_______________________________________________ >users mailing list >users at lists.ironpython.com >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >_______________________________________________ >users mailing list >users at lists.ironpython.com >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _________________________________________________________________ Play online games with your friends with MSN Messenger http://www.join.msn.com/messenger/overview -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: stacktrace.txt URL: From dinov at exchange.microsoft.com Thu Jun 15 17:19:33 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Thu, 15 Jun 2006 08:19:33 -0700 Subject: [IronPython] remoting from IronPython In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E0202B542AB@df-foxhound-msg.exchange.corp.microsoft.com> References: <4039D552ADAB094BB1EA670F3E96214E0202B542AB@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03256E94F7@df-foxhound-msg.exchange.corp.microsoft.com> Ok, I've looked into this some more now... Turns out that all my previous advice was useless. The problem here is actually that MarshalByRefObject's will happily cast to any interface you ask for. For example in C# if you try and cast some random MBR to IComparable, it works. Only when you call it does it fail (likewise doing a Console.WriteLine fails because the MBR isn't an IFormattable, but it seems to say it is). The work around for this is to always call through the known-type, rather than calling through the object. For example if your type is Test you do: Test.HelloWorld(myObj) Instead of: myObj.HelloWorld() and we'll do the right thing. Here's a helper class to provide a wrapper so you don't need to do this all the time: class typedproxy(object): __slots__ = ['obj', 'proxyType'] def __init__(self, obj, proxyType): self.obj = obj self.proxyType = proxyType def __getattribute__(self, attr): proxyType = object.__getattribute__(self, 'proxyType') obj = object.__getattribute__(self, 'obj') return getattr(proxyType, attr).__get__(obj, proxyType) just do: test = typedproxy(System.Activator.GetObject(RemoteTest, 'http://localhost:8000/RemoteTest'), RemoteTest) then you can do: test.HelloWorld() and it'll all work fine. I suspect that we won't be fixing this for IP 1.0, because there isn't really much we can do automatically on your behalf. It might be worth including a built-in typedproxy class. This hasn't been the only time calling through the type instead of the instance is necessary (for example it can be necessary w/ explicit interface implementations that collide w/ other methods in the type). Does anyone else have any thoughts on the usefulness of this? -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: Wednesday, June 14, 2006 5:16 PM To: Discussion of IronPython Subject: Re: [IronPython] remoting from IronPython Are you remoting to another process, or to another app domain? Does the other process have access to IronPython.dll ? One thing you might want to try doing is installing IronPython into the GAC (assuming this is beta 7, or if you re-built w/ the Signed Release or Signed Debug build modes w/ your own key), and then try this. This would ensure that the type would be loadable in both app domains, even if the files aren't readily available. It's also go a long way to making sure we're getting loaded into the correct loader context. Another helpful debugging tip for debugging CLR interaction issues is running IronPythonConsole w/ the -X:ExceptionDetail option. That will get you a much better stack trace about where the issue is occurring. I'd need to get some time to setup a repro to be able to say much more about this - but it's definitely something we'll want to make works (or understand why it doesn't if it's impossible to make work) before 1.0. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ralph Soons Sent: Wednesday, June 14, 2006 6:57 AM To: users at lists.ironpython.com Subject: Re: [IronPython] remoting from IronPython Hi again, I searched a little further and found out the following: When using remoting - server activated objects: and s = NameSpace.RemoteObject() I discovered the "Cannot load type 'clr:IronPython.Runtime.IDynamicObject, IronPython...." exception occurs on the following location: namespace: IronPython.Runtime file: Ops.cs funtion: public static DynamicType GetDynamicType(object o) { Line: if (dt != null) return dt.GetDynamicType(); (line 562) during debuging I discovered that 'object o' (input of the function) is of type MarshalByRefObject so I guess its my remote object. The first line in the function is IDynamicObject dt = o as IDynamicObject;. dt is not null after executing this line. This is strange because its being casted to IDynamicObject, which isn't implemented by my remote object. There after when the next line is executed if (dt != null) return dt.GetDynamicType();, the exception occurs. Can anyone tell me why this is going wrong? I also tried to use client activated objects. In that case the remoting call is working correctly. Thanks for your help again. Ralph Soons >From: "Ralph Soons" >Reply-To: Discussion of IronPython >To: users at lists.ironpython.com >Subject: [IronPython] remoting from IronPython >Date: Wed, 14 Jun 2006 09:09:57 +0200 > >Hi all, > >I am trying to call an function on a server via remoting, using IronPython. >First I created a c# server/client to test everything. > >In the C# client I have the following code: >RemotingConfiguration.Configure("executablename.exe.config", false); >RemoteObject object = new RemoteObject(); I can now reach my remote >object from the client. > >There after I used IronPython to do the same in python: >System.Runtime.Remoting.RemotingConfiguration.Configure("IronPythonTest >.exe.config", >0) >s = NameSpace.RemoteObject() >I now get the following error: >Cannot load type 'clr:IronPython.Runtime.IDynamicObject, IronPython > >I also tried: >s = System.Activator.GetObject( >System.Type.GetType(NameSpace.RemoteObject), >"http://localhost:9000/mytest" ) >I then get this error: ># File , line 0, in GetObject##10 ># File mscorlib, line unknown, in GetObject >#SystemError: Trying to create a proxy to an unbound type. > >Can someone tell me if its possible to use remoting from IronPython or >does any one has an idea what I am doing wrong? > >Many thanks! >Ralph Soons > >_________________________________________________________________ >Play online games with your friends with MSN Messenger >http://www.join.msn.com/messenger/overview > >_______________________________________________ >users mailing list >users at lists.ironpython.com >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _________________________________________________________________ MSN Search, for accurate results! http://search.msn.nl _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From kranar at hotmail.com Thu Jun 15 18:26:38 2006 From: kranar at hotmail.com (Kranar Drogin) Date: Thu, 15 Jun 2006 12:26:38 -0400 Subject: [IronPython] compiling standalone programs In-Reply-To: <51c8a7be0606142204q43805dd8xf9433f61c9c362de@mail.gmail.com> Message-ID: To compile a Python source file to an executable, you can use the ?X:SaveAssemblies option in the IronPython console. Given a file source.py, you would just do: IronPythonConsole ?X:SaveAssemblies source.py And this will produce a source.exe file. The executable, however, will still need the IronPython.dll reference. Kamal Mansouri > >So what is the status of compiling to standalone IL programs? Last thing I >heard was that it was rather experimental. >_______________________________________________ >users mailing list >users at lists.ironpython.com >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From jvm_cop at spamcop.net Thu Jun 15 18:40:39 2006 From: jvm_cop at spamcop.net (J. Merrill) Date: Thu, 15 Jun 2006 12:40:39 -0400 Subject: [IronPython] remoting from IronPython References: Message-ID: <7.0.1.0.2.20060615122804.08b152c8@wheresmymailserver.com> It could also help to use Fuslogvw.exe to watch the binding failure -- http://msdn2.microsoft.com/en-us/library/e74a18c4.aspx At 08:16 PM 6/14/2006, Dino Viehland wrote >Are you remoting to another process, or to another app domain? Does the other process have access to IronPython.dll ? > >One thing you might want to try doing is installing IronPython into the GAC (assuming this is beta 7, or if you re-built w/ the Signed Release or Signed Debug build modes w/ your own key), and then try this. This would ensure that the type would be loadable in both app domains, even if the files aren't readily available. It's also go a long way to making sure we're getting loaded into the correct loader context. > >Another helpful debugging tip for debugging CLR interaction issues is running IronPythonConsole w/ the -X:ExceptionDetail option. That will get you a much better stack trace about where the issue is occurring. > >I'd need to get some time to setup a repro to be able to say much more about this - but it's definitely something we'll want to make works (or understand why it doesn't if it's impossible to make work) before 1.0. > > >-----Original Message----- >From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ralph Soons >Sent: Wednesday, June 14, 2006 6:57 AM >To: users at lists.ironpython.com >Subject: Re: [IronPython] remoting from IronPython > >Hi again, > >I searched a little further and found out the following: > >When using remoting - server activated objects: >and s = NameSpace.RemoteObject() >I discovered the "Cannot load type 'clr:IronPython.Runtime.IDynamicObject, >IronPython...." exception occurs on the following location: >namespace: IronPython.Runtime >file: Ops.cs >funtion: public static DynamicType GetDynamicType(object o) { >Line: if (dt != null) return dt.GetDynamicType(); (line 562) > >during debuging I discovered that 'object o' (input of the function) is of type MarshalByRefObject so I guess its my remote object. The first line in the function is IDynamicObject dt = o as IDynamicObject;. dt is not null after executing this line. This is strange because its being casted to IDynamicObject, which isn't implemented by my remote object. There after when the next line is executed if (dt != null) return dt.GetDynamicType();, the exception occurs. >Can anyone tell me why this is going wrong? > >I also tried to use client activated objects. In that case the remoting call is working correctly. > >Thanks for your help again. >Ralph Soons > >>From: "Ralph Soons" >>Reply-To: Discussion of IronPython >>To: users at lists.ironpython.com >>Subject: [IronPython] remoting from IronPython >>Date: Wed, 14 Jun 2006 09:09:57 +0200 >> >>Hi all, >> >>I am trying to call an function on a server via remoting, using IronPython. >>First I created a c# server/client to test everything. >> >>In the C# client I have the following code: >>RemotingConfiguration.Configure("executablename.exe.config", false); >>RemoteObject object = new RemoteObject(); I can now reach my remote >>object from the client. >> >>There after I used IronPython to do the same in python: >>System.Runtime.Remoting.RemotingConfiguration.Configure("IronPythonTest >>.exe.config", >>0) >>s = NameSpace.RemoteObject() >>I now get the following error: >>Cannot load type 'clr:IronPython.Runtime.IDynamicObject, IronPython >> >>I also tried: >>s = System.Activator.GetObject( >>System.Type.GetType(NameSpace.RemoteObject), >>"http://localhost:9000/mytest" ) >>I then get this error: >># File , line 0, in GetObject##10 >># File mscorlib, line unknown, in GetObject >>#SystemError: Trying to create a proxy to an unbound type. >> >>Can someone tell me if its possible to use remoting from IronPython or >>does any one has an idea what I am doing wrong? >> >>Many thanks! >>Ralph Soons J. Merrill / Analytical Software Corp From sanxiyn at gmail.com Fri Jun 16 04:14:42 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Fri, 16 Jun 2006 11:14:42 +0900 Subject: [IronPython] IronPython News Feeds Message-ID: <5b0248170606151914k2fdf378ek6312b8b7ca87344c@mail.gmail.com> What is the plan regarding "News Feeds" tab of IronPython homepage on CodePlex? It could aggregate Jim Hugunin's blog and other IronPython crew blogs, for example. http://blogs.msdn.com/hugunin/ An example of "News Feeds" tab in action: http://www.codeplex.com/Project/NewsFeeds.aspx?ProjectName=CodePlex I doubt this would be of interest to anybody, but here's a feed for IronPython tag on KLDP (Korean developer community). I've done some translations of IronPython release notes. http://kldp.org/taxonomy/term/295 Seo Sanghyeon From jsacksteder at gmail.com Fri Jun 16 05:37:28 2006 From: jsacksteder at gmail.com (jeff sacksteder) Date: Thu, 15 Jun 2006 23:37:28 -0400 Subject: [IronPython] compiling standalone programs In-Reply-To: References: <51c8a7be0606142204q43805dd8xf9433f61c9c362de@mail.gmail.com> Message-ID: <51c8a7be0606152037v3524ffddyc2c2d646e0d95c1b@mail.gmail.com> > > And this will produce a source.exe file. The executable, however, will > still need the IronPython.dll reference. That appears to still create a console window at runtime. Can that be disabled? I know that Py2exe can create 'console' or 'windows' applications optionally. -------------- next part -------------- An HTML attachment was scrubbed... URL: From sanxiyn at gmail.com Fri Jun 16 06:04:20 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Fri, 16 Jun 2006 13:04:20 +0900 Subject: [IronPython] compiling standalone programs In-Reply-To: <51c8a7be0606152037v3524ffddyc2c2d646e0d95c1b@mail.gmail.com> References: <51c8a7be0606142204q43805dd8xf9433f61c9c362de@mail.gmail.com> <51c8a7be0606152037v3524ffddyc2c2d646e0d95c1b@mail.gmail.com> Message-ID: <5b0248170606152104l334d00fckd64799a01b34f56@mail.gmail.com> 2006/6/16, jeff sacksteder : > > That appears to still create a console window at runtime. Can that be > disabled? I know that Py2exe can create 'console' or 'windows' applications > optionally. This is the issue #346 and it seems that it will be fixed in 1.0 Beta 8. http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&WorkItemId=346 Essentialy, it amounts to compiling with /target:winexe instead of /target:exe. Seo Sanghyeon From korpse-ironpython at kaydash.za.net Fri Jun 16 12:25:09 2006 From: korpse-ironpython at kaydash.za.net (Jonathan Jacobs) Date: Fri, 16 Jun 2006 12:25:09 +0200 Subject: [IronPython] Choosing the right overload Message-ID: <44928705.6070609@kaydash.za.net> Hi, I'm wondering how to call a specific overload, more specifically one that in C# would take an out parameter but in IronPython does/can not. Here are the available overloads: >>> print Direct3D.Mesh.FromFile.__doc__ static (Mesh, array_EffectInstance) FromFile(str filename, MeshFlags options, Device device) static (Mesh, GraphicsStream, array_EffectInstance) FromFile(str filename, MeshFlags options, Device device) static (Mesh, array_ExtendedMaterial, array_EffectInstance) FromFile(str filename, MeshFlags options, Device device) static Mesh FromFile(str filename, MeshFlags options, Device device) static (Mesh, GraphicsStream) FromFile(str filename, MeshFlags options, Device device) static (Mesh, array_ExtendedMaterial) FromFile(str filename, MeshFlags options, Device device) static (Mesh, GraphicsStream, array_ExtendedMaterial) FromFile(str filename, MeshFlags options, Device device) static (Mesh, GraphicsStream, array_ExtendedMaterial, array_EffectInstance) FromFile(str filename, MeshFlags options, Device device) I want to call: static (Mesh, array_ExtendedMaterial) FromFile(str filename, MeshFlags options, Device device) I've tried using __overloads__: >>> print Direct3D.Mesh.FromFile.__overloads__[(str, Direct3D.MeshFlags, Direct3D.Device)].__doc__ static Mesh FromFile(str filename, MeshFlags options, Device device) I'm going to assume that I'd need some way to specify the return type, which also makes me wonder how you'd specify an object of type array_ExtendedMaterial? So, is there a way I can do this without resorting to writing a C# helper function? I'd also like to suggest that the representation of the "keys" in __overloads__ change to look something a little more like what you need to pass. For instance: 'static (Mesh, array_EffectInstance) FromFile(str filename, MeshFlags options, Device device)': would be more easily understood (IMO) if it looked like: (str, MeshFlags, Device): Regards -- Jonathan When you meet a master swordsman, show him your sword. When you meet a man who is not a poet, do not show him your poem. -- Rinzai, ninth century Zen master From michael.foord at resolversystems.com Fri Jun 16 12:42:53 2006 From: michael.foord at resolversystems.com (Michael Foord) Date: Fri, 16 Jun 2006 11:42:53 +0100 Subject: [IronPython] Different Range Behaviour Message-ID: <44928B2D.5030903@resolversystems.com> Hello all, IronPython "range" behaves slightly differently than CPython when given float inputs : CPython : >>> range(1.0, 10.0) __main__:1: DeprecationWarning: integer argument expected, got float [1, 2, 3, 4, 5, 6, 7, 8, 9] IronPython : >>> range(1.0, 10.0) [1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L] Not only does IronPython not raise the deprecation warning, but it also returns longs. Michael Foord http://www.resolversystems.com From Martin.Maly at microsoft.com Fri Jun 16 16:40:03 2006 From: Martin.Maly at microsoft.com (Martin Maly) Date: Fri, 16 Jun 2006 07:40:03 -0700 Subject: [IronPython] Choosing the right overload In-Reply-To: <44928705.6070609@kaydash.za.net> Message-ID: <5C0A6F919D675745BB1DBA7412DB68F50512EC5C36@df-foxhound-msg.exchange.corp.microsoft.com> The array_EffectInstance is EffectInstance[] and to get that type, you can do: clr.GetClrType(Direct3D.XXXXX.EffectInstance).MakeArrayType() For example: >>> clr.GetClrType(System.Collections.Hashtable).MakeArrayType() System.Collections.Hashtable[] Hope this helps. Martin -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jonathan Jacobs Sent: Friday, June 16, 2006 3:25 AM To: IronPython List Subject: [IronPython] Choosing the right overload Hi, I'm wondering how to call a specific overload, more specifically one that in C# would take an out parameter but in IronPython does/can not. Here are the available overloads: >>> print Direct3D.Mesh.FromFile.__doc__ static (Mesh, array_EffectInstance) FromFile(str filename, MeshFlags options, Device device) static (Mesh, GraphicsStream, array_EffectInstance) FromFile(str filename, MeshFlags options, Device device) static (Mesh, array_ExtendedMaterial, array_EffectInstance) FromFile(str filename, MeshFlags options, Device device) static Mesh FromFile(str filename, MeshFlags options, Device device) static (Mesh, GraphicsStream) FromFile(str filename, MeshFlags options, Device device) static (Mesh, array_ExtendedMaterial) FromFile(str filename, MeshFlags options, Device device) static (Mesh, GraphicsStream, array_ExtendedMaterial) FromFile(str filename, MeshFlags options, Device device) static (Mesh, GraphicsStream, array_ExtendedMaterial, array_EffectInstance) FromFile(str filename, MeshFlags options, Device device) I want to call: static (Mesh, array_ExtendedMaterial) FromFile(str filename, MeshFlags options, Device device) I've tried using __overloads__: >>> print Direct3D.Mesh.FromFile.__overloads__[(str, Direct3D.MeshFlags, Direct3D.Device)].__doc__ static Mesh FromFile(str filename, MeshFlags options, Device device) I'm going to assume that I'd need some way to specify the return type, which also makes me wonder how you'd specify an object of type array_ExtendedMaterial? So, is there a way I can do this without resorting to writing a C# helper function? I'd also like to suggest that the representation of the "keys" in __overloads__ change to look something a little more like what you need to pass. For instance: 'static (Mesh, array_EffectInstance) FromFile(str filename, MeshFlags options, Device device)': would be more easily understood (IMO) if it looked like: (str, MeshFlags, Device): Regards -- Jonathan When you meet a master swordsman, show him your sword. When you meet a man who is not a poet, do not show him your poem. -- Rinzai, ninth century Zen master _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From Martin.Maly at microsoft.com Fri Jun 16 16:40:03 2006 From: Martin.Maly at microsoft.com (Martin Maly) Date: Fri, 16 Jun 2006 07:40:03 -0700 Subject: [IronPython] Choosing the right overload In-Reply-To: <44928705.6070609@kaydash.za.net> Message-ID: <5C0A6F919D675745BB1DBA7412DB68F50512EC5C36@df-foxhound-msg.exchange.corp.microsoft.com> The array_EffectInstance is EffectInstance[] and to get that type, you can do: clr.GetClrType(Direct3D.XXXXX.EffectInstance).MakeArrayType() For example: >>> clr.GetClrType(System.Collections.Hashtable).MakeArrayType() System.Collections.Hashtable[] Hope this helps. Martin -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jonathan Jacobs Sent: Friday, June 16, 2006 3:25 AM To: IronPython List Subject: [IronPython] Choosing the right overload Hi, I'm wondering how to call a specific overload, more specifically one that in C# would take an out parameter but in IronPython does/can not. Here are the available overloads: >>> print Direct3D.Mesh.FromFile.__doc__ static (Mesh, array_EffectInstance) FromFile(str filename, MeshFlags options, Device device) static (Mesh, GraphicsStream, array_EffectInstance) FromFile(str filename, MeshFlags options, Device device) static (Mesh, array_ExtendedMaterial, array_EffectInstance) FromFile(str filename, MeshFlags options, Device device) static Mesh FromFile(str filename, MeshFlags options, Device device) static (Mesh, GraphicsStream) FromFile(str filename, MeshFlags options, Device device) static (Mesh, array_ExtendedMaterial) FromFile(str filename, MeshFlags options, Device device) static (Mesh, GraphicsStream, array_ExtendedMaterial) FromFile(str filename, MeshFlags options, Device device) static (Mesh, GraphicsStream, array_ExtendedMaterial, array_EffectInstance) FromFile(str filename, MeshFlags options, Device device) I want to call: static (Mesh, array_ExtendedMaterial) FromFile(str filename, MeshFlags options, Device device) I've tried using __overloads__: >>> print Direct3D.Mesh.FromFile.__overloads__[(str, Direct3D.MeshFlags, Direct3D.Device)].__doc__ static Mesh FromFile(str filename, MeshFlags options, Device device) I'm going to assume that I'd need some way to specify the return type, which also makes me wonder how you'd specify an object of type array_ExtendedMaterial? So, is there a way I can do this without resorting to writing a C# helper function? I'd also like to suggest that the representation of the "keys" in __overloads__ change to look something a little more like what you need to pass. For instance: 'static (Mesh, array_EffectInstance) FromFile(str filename, MeshFlags options, Device device)': would be more easily understood (IMO) if it looked like: (str, MeshFlags, Device): Regards -- Jonathan When you meet a master swordsman, show him your sword. When you meet a man who is not a poet, do not show him your poem. -- Rinzai, ninth century Zen master _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From michael.foord at resolversystems.com Fri Jun 16 17:02:40 2006 From: michael.foord at resolversystems.com (Michael Foord) Date: Fri, 16 Jun 2006 16:02:40 +0100 Subject: [IronPython] Overloading __getattr__ Message-ID: <4492C810.1070504@resolversystems.com> Hello all, We have a problem with IronPython and overloading __getattr__, and use of the python magic methods (double underscore). To illustrate the problem : class Test(object): def __getattr__(self, name): print name raise AttributeError("Go Away") if Test(): print "Hello" On CPython it does this : Hello On IronPython : __nonzero__ Traceback (most recent call last): File C:\Personal\Python Projects\modules in progress\ironpython\test.py, line 6, in Initialize File C:\Personal\Python Projects\modules in progress\ironpython\test.py, line 4, in __getattr__ AttributeError: Go Away We are trying to overload __getattr__ and getting calls to __hash__, __len__, __gt__ etc sent there in various places. All the best, Michael Foord http://www.resolversystems.com From jvm_cop at spamcop.net Fri Jun 16 17:38:35 2006 From: jvm_cop at spamcop.net (J. Merrill) Date: Fri, 16 Jun 2006 11:38:35 -0400 Subject: [IronPython] Choosing the right overload In-Reply-To: <44928705.6070609@kaydash.za.net> References: <44928705.6070609@kaydash.za.net> Message-ID: <7.0.1.0.2.20060616111720.08b89108@wheresmymailserver.com> At 06:25 AM 6/16/2006, Jonathan Jacobs wrote (in part) >Hi, > >I'm wondering how to call a specific overload, more specifically one that in >C# would take an out parameter but in IronPython does/can not. > >Here are the available overloads: > > >>> print Direct3D.Mesh.FromFile.__doc__ >[snip] >static (Mesh, array_ExtendedMaterial) FromFile(str filename, MeshFlags >options, Device device) >static Mesh FromFile(str filename, MeshFlags options, Device device) >[snip] > >I want to call: > >static (Mesh, array_ExtendedMaterial) FromFile(str filename, MeshFlags >options, Device device) > >I've tried using __overloads__: > > >>> print Direct3D.Mesh.FromFile.__overloads__[(str, Direct3D.MeshFlags, >Direct3D.Device)].__doc__ >static Mesh FromFile(str filename, MeshFlags options, Device device) > >I'm going to assume that I'd need some way to specify the return type, which >also makes me wonder how you'd specify an object of type array_ExtendedMaterial? Something would be wrong if __overloads__ is keyed only by the input type(s). It has to include the out parameters, in the position that they're defined by C#. >So, is there a way I can do this without resorting to writing a C# helper >function? If you know where the "out" parameter goes in the parameter list (e.g. at the end) you could specify a tuple that includes it in the right spot. Martin has shown you how to define the array. I don't know if C# allows overloads that are identical except for out-ness -- can you have both int Foo(string x, out int blah) and int Foo(string x, int blah) ??? J. Merrill / Analytical Software Corp From jsacksteder at gmail.com Fri Jun 16 18:19:34 2006 From: jsacksteder at gmail.com (jeff sacksteder) Date: Fri, 16 Jun 2006 12:19:34 -0400 Subject: [IronPython] Serial comms with IronPython In-Reply-To: <000001c68a51$ae424300$0a00000a@hpnx5000> References: <000001c68a51$ae424300$0a00000a@hpnx5000> Message-ID: <51c8a7be0606160919g5dbe7d86g98cdfbff1462e445@mail.gmail.com> > > Does anyone have an example of how to use System.IO.Ports.SerialPort from > IronPython? > I don't know if this will tell you anything new, but there's some sample > vb that might be useful. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jsacksteder at gmail.com Fri Jun 16 18:19:46 2006 From: jsacksteder at gmail.com (jeff sacksteder) Date: Fri, 16 Jun 2006 12:19:46 -0400 Subject: [IronPython] Serial comms with IronPython In-Reply-To: <51c8a7be0606160919g5dbe7d86g98cdfbff1462e445@mail.gmail.com> References: <000001c68a51$ae424300$0a00000a@hpnx5000> <51c8a7be0606160919g5dbe7d86g98cdfbff1462e445@mail.gmail.com> Message-ID: <51c8a7be0606160919g546e969aj7b9c99287b147212@mail.gmail.com> On 6/16/06, jeff sacksteder wrote: > > Does anyone have an example of how to use System.IO.Ports.SerialPort from > > IronPython? > > I don't know if this will tell you anything new, but there's some sample > > vb that might be useful. > > > http://www.devx.com/dotnet/Article/31001 -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Fri Jun 16 18:34:23 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Fri, 16 Jun 2006 09:34:23 -0700 Subject: [IronPython] Overloading __getattr__ In-Reply-To: <4492C810.1070504@resolversystems.com> References: <4492C810.1070504@resolversystems.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03BB7595E9@df-foxhound-msg.exchange.corp.microsoft.com> Thanks for the bug report - this is fixed for the next release (the actual problem here is we were looking for instance members for special methods, which we shouldn't do). You can actually get the fix now if you get the latest bits from IronPython on http://www.codeplex.com, but we should have a release real soon now. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Friday, June 16, 2006 8:03 AM To: Discussion of IronPython Subject: [IronPython] Overloading __getattr__ Hello all, We have a problem with IronPython and overloading __getattr__, and use of the python magic methods (double underscore). To illustrate the problem : class Test(object): def __getattr__(self, name): print name raise AttributeError("Go Away") if Test(): print "Hello" On CPython it does this : Hello On IronPython : __nonzero__ Traceback (most recent call last): File C:\Personal\Python Projects\modules in progress\ironpython\test.py, line 6, in Initialize File C:\Personal\Python Projects\modules in progress\ironpython\test.py, line 4, in __getattr__ AttributeError: Go Away We are trying to overload __getattr__ and getting calls to __hash__, __len__, __gt__ etc sent there in various places. All the best, Michael Foord http://www.resolversystems.com _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Fri Jun 16 18:51:42 2006 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Fri, 16 Jun 2006 17:51:42 +0100 Subject: [IronPython] Overloading __getattr__ In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E03BB7595E9@df-foxhound-msg.exchange.corp.microsoft.com> References: <4492C810.1070504@resolversystems.com> <4039D552ADAB094BB1EA670F3E96214E03BB7595E9@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <4492E19E.3050101@voidspace.org.uk> Dino Viehland wrote: > Thanks for the bug report - this is fixed for the next release (the actual problem here is we were looking for instance members for special methods, which we shouldn't do). You can actually get the fix now if you get the latest bits from IronPython on http://www.codeplex.com, but we should have a release real soon now. > Great - you must have borrowed the time machine from Guido. :-) Thanks Michael Foord http://www.resolversystem.com > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Friday, June 16, 2006 8:03 AM > To: Discussion of IronPython > Subject: [IronPython] Overloading __getattr__ > > Hello all, > > We have a problem with IronPython and overloading __getattr__, and use of the python magic methods (double underscore). > > To illustrate the problem : > > class Test(object): > def __getattr__(self, name): > print name > raise AttributeError("Go Away") > > if Test(): > print "Hello" > > On CPython it does this : > > Hello > > On IronPython : > > __nonzero__ > Traceback (most recent call last): > File C:\Personal\Python Projects\modules in progress\ironpython\test.py, line 6, in Initialize > File C:\Personal\Python Projects\modules in progress\ironpython\test.py, line 4, in __getattr__ > AttributeError: Go Away > > We are trying to overload __getattr__ and getting calls to __hash__, __len__, __gt__ etc sent there in various places. > > All the best, > > Michael Foord > http://www.resolversystems.com > > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > From korpse-ironpython at kaydash.za.net Fri Jun 16 19:21:37 2006 From: korpse-ironpython at kaydash.za.net (Jonathan Jacobs) Date: Fri, 16 Jun 2006 19:21:37 +0200 Subject: [IronPython] Choosing the right overload In-Reply-To: <7.0.1.0.2.20060616111720.08b89108@wheresmymailserver.com> References: <44928705.6070609@kaydash.za.net> <7.0.1.0.2.20060616111720.08b89108@wheresmymailserver.com> Message-ID: <4492E8A1.9050505@kaydash.za.net> J. Merrill wrote: > If you know where the "out" parameter goes in the parameter list (e.g. at > the end) you could specify a tuple that includes it in the right spot. > Martin has shown you how to define the array. I didn't know about the array type trick but I'm still having some trouble. This is the overload I want: 'static (Mesh, array_ExtendedMaterial) FromFile(str filename, MeshFlags options, Device device)': The function's C# signature is: public static Mesh FromFile(string, MeshFlags, Device, out ExtendedMaterial); So I tried: >>> Direct3D.Mesh.FromFile.__overloads__[(str, Direct3D.MeshFlags, Direct3D.Device, clr.GetClrType(Direct3D.ExtendedMaterial).MakeArrayType())] Traceback (most recent call last): File , line 0, in ##22 File , line 0, in get_Item##18 TypeError: No match found for the method signature (, , , Microsoft.DirectX.Direct3D.ExtendedMaterial[]) > I don't know if C# allows overloads that are identical except for out-ness > -- can you have both int Foo(string x, out int blah) and int Foo(string x, > int blah) ??? Apparently you can. -- Jonathan When you meet a master swordsman, show him your sword. When you meet a man who is not a poet, do not show him your poem. -- Rinzai, ninth century Zen master From korpse-ironpython at kaydash.za.net Fri Jun 16 19:28:40 2006 From: korpse-ironpython at kaydash.za.net (Jonathan Jacobs) Date: Fri, 16 Jun 2006 19:28:40 +0200 Subject: [IronPython] Choosing the right overload In-Reply-To: <4492E8A1.9050505@kaydash.za.net> References: <44928705.6070609@kaydash.za.net> <7.0.1.0.2.20060616111720.08b89108@wheresmymailserver.com> <4492E8A1.9050505@kaydash.za.net> Message-ID: <4492EA48.2000807@kaydash.za.net> Jonathan Jacobs wrote: >>>> Direct3D.Mesh.FromFile.__overloads__[(str, Direct3D.MeshFlags, > Direct3D.Device, clr.GetClrType(Direct3D.ExtendedMaterial).MakeArrayType())] > Traceback (most recent call last): > File , line 0, in ##22 > File , line 0, in get_Item##18 > TypeError: No match found for the method signature (, 'MeshFlags'>, , Microsoft.DirectX.Direct3D.ExtendedMaterial[]) I did some digging in the source code, it looks like the problem is the indexer for BuiltinFunctionOverloadMapper. The problem appears to be: from Python I am unable to specify whether an argument is byref or not and so the comparison fails when trying to match signatures. -- Jonathan When you meet a master swordsman, show him your sword. When you meet a man who is not a poet, do not show him your poem. -- Rinzai, ninth century Zen master From korpse-ironpython at kaydash.za.net Fri Jun 16 19:32:37 2006 From: korpse-ironpython at kaydash.za.net (Jonathan Jacobs) Date: Fri, 16 Jun 2006 19:32:37 +0200 Subject: [IronPython] Choosing the right overload In-Reply-To: <4492EA48.2000807@kaydash.za.net> References: <44928705.6070609@kaydash.za.net> <7.0.1.0.2.20060616111720.08b89108@wheresmymailserver.com> <4492E8A1.9050505@kaydash.za.net> <4492EA48.2000807@kaydash.za.net> Message-ID: <4492EB35.9060702@kaydash.za.net> Jonathan Jacobs wrote: > I did some digging in the source code, it looks like the problem is the > indexer for BuiltinFunctionOverloadMapper. The problem appears to be: from > Python I am unable to specify whether an argument is byref or not and so the > comparison fails when trying to match signatures. I did a little less digging and a little more thinking: >>> Direct3D.Mesh.FromFile.__overloads__[(str, Direct3D.MeshFlags, Direct3D.Device, clr.GetClrType(Direct3D.ExtendedMaterial).MakeArrayType().MakeByRefType())] Yay! Somewhat insane, but yay. -- Jonathan When you meet a master swordsman, show him your sword. When you meet a man who is not a poet, do not show him your poem. -- Rinzai, ninth century Zen master From dinov at exchange.microsoft.com Fri Jun 16 21:05:17 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Fri, 16 Jun 2006 12:05:17 -0700 Subject: [IronPython] Choosing the right overload In-Reply-To: <4492EB35.9060702@kaydash.za.net> References: <44928705.6070609@kaydash.za.net> <7.0.1.0.2.20060616111720.08b89108@wheresmymailserver.com> <4492E8A1.9050505@kaydash.za.net> <4492EA48.2000807@kaydash.za.net> <4492EB35.9060702@kaydash.za.net> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03BB7597FF@df-foxhound-msg.exchange.corp.microsoft.com> The next release this should actually be considerably better. We've made some fairly significant changes to method binding to be closer to C# and VB's rules, and we've also added a new Reference type that you can use to explicitly call methods w/ ref or out params. So hopefully you won't have to deal with the insanity for too long. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jonathan Jacobs Sent: Friday, June 16, 2006 10:33 AM To: Discussion of IronPython Subject: Re: [IronPython] Choosing the right overload Jonathan Jacobs wrote: > I did some digging in the source code, it looks like the problem is > the indexer for BuiltinFunctionOverloadMapper. The problem appears to > be: from Python I am unable to specify whether an argument is byref or > not and so the comparison fails when trying to match signatures. I did a little less digging and a little more thinking: >>> Direct3D.Mesh.FromFile.__overloads__[(str, Direct3D.MeshFlags, Direct3D.Device, clr.GetClrType(Direct3D.ExtendedMaterial).MakeArrayType().MakeByRefType())] Yay! Somewhat insane, but yay. -- Jonathan When you meet a master swordsman, show him your sword. When you meet a man who is not a poet, do not show him your poem. -- Rinzai, ninth century Zen master _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From sanxiyn at gmail.com Sat Jun 17 02:40:42 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Sat, 17 Jun 2006 09:40:42 +0900 Subject: [IronPython] Overloading __getattr__ In-Reply-To: <4492E19E.3050101@voidspace.org.uk> References: <4492C810.1070504@resolversystems.com> <4039D552ADAB094BB1EA670F3E96214E03BB7595E9@df-foxhound-msg.exchange.corp.microsoft.com> <4492E19E.3050101@voidspace.org.uk> Message-ID: <5b0248170606161740k58e73888iad7978780a1ab921@mail.gmail.com> Dino Viehland wrote: > Thanks for the bug report - this is fixed for the next release (the actual problem here is we were looking for instance members for special methods, which we shouldn't do). You can actually get the fix now if you get the latest bits from IronPython on http://www.codeplex.com, but we should have a release real soon now. Michael Foord wrote: > Great - you must have borrowed the time machine from Guido. :-) Actually, this is the same problem as this one I reported in May: http://lists.ironpython.com/pipermail/users-ironpython.com/2006-May/002377.html To-defend-against-time-machine-theft-allegation-ly, Seo Sanghyeon From sanxiyn at gmail.com Sat Jun 17 03:24:43 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Sat, 17 Jun 2006 10:24:43 +0900 Subject: [IronPython] Latest IronPython on Mono In-Reply-To: <5b0248170606131839j570e8b7by2a07ae81d3370034@mail.gmail.com> References: <5b0248170606131839j570e8b7by2a07ae81d3370034@mail.gmail.com> Message-ID: <5b0248170606161824v6e5e8d40y9ad17efe5957f409@mail.gmail.com> 2006/6/14, Sanghyeon Seo : > If you want to compile the latest IronPython source downloaded off > CodePlex on Mono, you need to edit a bit. Currently Mono C# compiler > can't switch on nullable types, and seems to have a problem with > delegate conversion. > > Switch problem is tracked as Mono bug #78630. This is now fixed in Mono revision 61777. Seo Sanghyeon From jvm_cop at spamcop.net Sat Jun 17 18:28:41 2006 From: jvm_cop at spamcop.net (J. Merrill) Date: Sat, 17 Jun 2006 12:28:41 -0400 Subject: [IronPython] Choosing the right overload In-Reply-To: <4492E8A1.9050505@kaydash.za.net> References: <44928705.6070609@kaydash.za.net> <7.0.1.0.2.20060616111720.08b89108@wheresmymailserver.com> <4492E8A1.9050505@kaydash.za.net> Message-ID: <7.0.1.0.2.20060617122445.08b8c500@wheresmymailserver.com> At 01:21 PM 6/16/2006, Jonathan Jacobs wrote (in part) >J. Merrill wrote: (in part) >> I don't know if C# allows overloads that are identical except for out-ness -- can you have both >> int Foo(string x, out int blah) >>and int Foo(string x, int blah) ??? > >Apparently you can. If that's the case, then it's possible that the design of __overloads__ needs to be changed -- the current key defn of "tuple of types without indication of out-or-ref" may not be sufficient. Martin / Dino / Jim -- could one of you chime in on this? J. Merrill / Analytical Software Corp From jsacksteder at gmail.com Sat Jun 17 18:45:42 2006 From: jsacksteder at gmail.com (jeff sacksteder) Date: Sat, 17 Jun 2006 12:45:42 -0400 Subject: [IronPython] Application objects Message-ID: <51c8a7be0606170945q89deaa7n6142e1743e0df5b4@mail.gmail.com> Given the general lack of IP example code, could someone post a simple example of an application that contains multiple forms or dialogs? -------------- next part -------------- An HTML attachment was scrubbed... URL: From jvm_cop at spamcop.net Sat Jun 17 18:52:32 2006 From: jvm_cop at spamcop.net (J. Merrill) Date: Sat, 17 Jun 2006 12:52:32 -0400 Subject: [IronPython] Choosing the right overload In-Reply-To: <4492E8A1.9050505@kaydash.za.net> References: <44928705.6070609@kaydash.za.net> <7.0.1.0.2.20060616111720.08b89108@wheresmymailserver.com> <4492E8A1.9050505@kaydash.za.net> Message-ID: <7.0.1.0.2.20060617124059.08b9aec0@wheresmymailserver.com> Try adding .MakeByRefType() to what you have: >>> Direct3D.Mesh.FromFile.__overloads__[(str, Direct3D.MeshFlags, Direct3D.Device, clr.GetClrType(Direct3D.ExtendedMaterial).MakeArrayType().MakeByRefType())] Another possibility would be to display the elements of __overloads__ explicitly and work out how to catch the exact one you want: for each (typ, meth) in Direct3D.Mesh.FromFile.__overloads__.items() print typ print meth (Or "print typ, meth" of course, but these are probably long descriptions....) Good luck! At 01:21 PM 6/16/2006, Jonathan Jacobs wrote >This is the overload I want: > >'static (Mesh, array_ExtendedMaterial) FromFile(str filename, MeshFlags >options, Device device)': > >The function's C# signature is: > >public static Mesh FromFile(string, MeshFlags, Device, out ExtendedMaterial); > >So I tried: > >>>> Direct3D.Mesh.FromFile.__overloads__[(str, Direct3D.MeshFlags, >Direct3D.Device, clr.GetClrType(Direct3D.ExtendedMaterial).MakeArrayType())] >Traceback (most recent call last): > File , line 0, in ##22 > File , line 0, in get_Item##18 >TypeError: No match found for the method signature (, 'MeshFlags'>, , Microsoft.DirectX.Direct3D.ExtendedMaterial[]) J. Merrill / Analytical Software Corp From jvm_cop at spamcop.net Sat Jun 17 19:08:25 2006 From: jvm_cop at spamcop.net (J. Merrill) Date: Sat, 17 Jun 2006 13:08:25 -0400 Subject: [IronPython] Choosing the right overload In-Reply-To: <7.0.1.0.2.20060617124059.08b9aec0@wheresmymailserver.com> References: <44928705.6070609@kaydash.za.net> <7.0.1.0.2.20060616111720.08b89108@wheresmymailserver.com> <4492E8A1.9050505@kaydash.za.net> <7.0.1.0.2.20060617124059.08b9aec0@wheresmymailserver.com> Message-ID: <7.0.1.0.2.20060617130749.08b384e0@wheresmymailserver.com> I'm glad this works, and sorry that I hadn't read the mail where you said you'd figured it out. At 12:52 PM 6/17/2006, J. Merrill wrote >Try adding .MakeByRefType() to what you have: > >>>> Direct3D.Mesh.FromFile.__overloads__[(str, Direct3D.MeshFlags, Direct3D.Device, clr.GetClrType(Direct3D.ExtendedMaterial).MakeArrayType().MakeByRefType())] >[snip] J. Merrill / Analytical Software Corp From jvm_cop at spamcop.net Sat Jun 17 19:09:28 2006 From: jvm_cop at spamcop.net (J. Merrill) Date: Sat, 17 Jun 2006 13:09:28 -0400 Subject: [IronPython] Choosing the right overload In-Reply-To: <7.0.1.0.2.20060617122445.08b8c500@wheresmymailserver.com> References: <44928705.6070609@kaydash.za.net> <7.0.1.0.2.20060616111720.08b89108@wheresmymailserver.com> <4492E8A1.9050505@kaydash.za.net> <7.0.1.0.2.20060617122445.08b8c500@wheresmymailserver.com> Message-ID: <7.0.1.0.2.20060617130832.08baa778@wheresmymailserver.com> Never mind, it seems that there's been work done in this area.... At 12:28 PM 6/17/2006, J. Merrill wrote (in part) >If that's the case, then it's possible that the design of __overloads__ needs to be changed -- the current key defn of "tuple of types without indication of out-or-ref" may not be sufficient. > >Martin / Dino / Jim -- could one of you chime in on this? J. Merrill / Analytical Software Corp From sanxiyn at gmail.com Sat Jun 17 20:38:48 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Sun, 18 Jun 2006 03:38:48 +0900 Subject: [IronPython] Freshmeat Message-ID: <5b0248170606171138u5b4dab1ei9149ff5c521c8be6@mail.gmail.com> I updated Freshmeat entry for IronPython to point to CodePlex now. http://freshmeat.net/projects/ironpython I wonder how can I update the release? Seo Sanghyeon From jsacksteder at gmail.com Sat Jun 17 22:33:49 2006 From: jsacksteder at gmail.com (jeff sacksteder) Date: Sat, 17 Jun 2006 16:33:49 -0400 Subject: [IronPython] Running applications vs. forms? Message-ID: <51c8a7be0606171333uac3a258w884a39f2f03a2989@mail.gmail.com> To clarify my earlier message- If I want to create a non-trivial application, I will have several forms and dialogs. My(apparently broken) understanding is that I would create a class representing the application and pass that to the Application.Run(method). For example, the tiny app here: import clr clr.AddReference('System.Windows.Forms') clr.AddReference('System.Drawing') from System.Windows.Forms import Form,Application class Form1(Form): pass class Form2(Form): pass class MyApp(Application): pass a = MyApp() Application.Run(a) Produces 'TypeError: cannot derive from sealed or value types'. Alternatively, If I create a class with no inheritance, I get 'TypeError: bad args for method'. What is the correct way to do this? -------------- next part -------------- An HTML attachment was scrubbed... URL: From ernsnat at iit.edu Sat Jun 17 22:53:10 2006 From: ernsnat at iit.edu (Nathan R. Ernst) Date: Sat, 17 Jun 2006 15:53:10 -0500 Subject: [IronPython] Running applications vs. forms? In-Reply-To: <51c8a7be0606171333uac3a258w884a39f2f03a2989@mail.gmail.com> Message-ID: <20060617205115.7AEDC1BB7E@che.dreamhost.com> The object you pass to Application.Run should derive from Form, not Application. In your example below, you should eliminate the class MyApp and pass either Form1 or Form2. -Nathan _____ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of jeff sacksteder Sent: Saturday, June 17, 2006 3:34 PM To: users at lists.ironpython.com Subject: [IronPython] Running applications vs. forms? To clarify my earlier message- If I want to create a non-trivial application, I will have several forms and dialogs. My(apparently broken) understanding is that I would create a class representing the application and pass that to the Application.Run(method). For example, the tiny app here: import clr clr.AddReference('System.Windows.Forms') clr.AddReference('System.Drawing') from System.Windows.Forms import Form,Application class Form1(Form): pass class Form2(Form): pass class MyApp(Application): pass a = MyApp() Application.Run(a) Produces 'TypeError: cannot derive from sealed or value types'. Alternatively, If I create a class with no inheritance, I get 'TypeError: bad args for method'. What is the correct way to do this? -------------- next part -------------- An HTML attachment was scrubbed... URL: From Martin.Maly at microsoft.com Sun Jun 18 04:51:27 2006 From: Martin.Maly at microsoft.com (Martin Maly) Date: Sat, 17 Jun 2006 19:51:27 -0700 Subject: [IronPython] Running applications vs. forms? In-Reply-To: <51c8a7be0606171333uac3a258w884a39f2f03a2989@mail.gmail.com> Message-ID: <5C0A6F919D675745BB1DBA7412DB68F50512EC630E@df-foxhound-msg.exchange.corp.microsoft.com> import clr clr.AddReference('System.Windows.Forms') clr.AddReference('System.Drawing') from System.Windows.Forms import Form,Application class Form1(Form): pass class Form2(Form): pass Application.Run(Form1()) ________________________________ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of jeff sacksteder Sent: Saturday, June 17, 2006 1:34 PM To: users at lists.ironpython.com Subject: [IronPython] Running applications vs. forms? To clarify my earlier message- If I want to create a non-trivial application, I will have several forms and dialogs. My(apparently broken) understanding is that I would create a class representing the application and pass that to the Application.Run(method). For example, the tiny app here: import clr clr.AddReference('System.Windows.Forms') clr.AddReference('System.Drawing') from System.Windows.Forms import Form,Application class Form1(Form): pass class Form2(Form): pass class MyApp(Application): pass a = MyApp() Application.Run(a) Produces 'TypeError: cannot derive from sealed or value types'. Alternatively, If I create a class with no inheritance, I get 'TypeError: bad args for method'. What is the correct way to do this? -------------- next part -------------- An HTML attachment was scrubbed... URL: From korpse-ironpython at kaydash.za.net Mon Jun 19 11:07:42 2006 From: korpse-ironpython at kaydash.za.net (Jonathan Jacobs) Date: Mon, 19 Jun 2006 11:07:42 +0200 Subject: [IronPython] .NET constructors Message-ID: <4496695E.8010407@kaydash.za.net> Hi, (I didn't see any of these things on the CodePlex issue tracker, sorry if these are old news.) Trying to define a class that derives from my .NET object, with a single constructor that takes more than 4 arguments, explodes: Test.cs: public class Test { public Test(int a, int b, int c, int d, int e) { } } >>> class PyTest(Test): pass ... Traceback (most recent call last): File , line 0, in ##22 SystemError: too many args Adding a second constructor that takes fewer than 5 arguments lets me at least define my class, however I get some odd behaviour from the 5-argument constructor (the 2-arg constructor works fine): Test.cs: public class Test { public Test(int a, int b) { } public Test(int a, int b, int c, int d, int e) { } } >>> class PyTest(Test): pass ... >>> PyTest(1, 2) >>> PyTest(1, 2, 3, 4, 5) Traceback (most recent call last): File , line 0, in ##35 TypeError: PyTest() takes at most 6 arguments (6 given) Adding an initialiser to my derived class doesn't behave properly: >>> class PyTest(Test): ... def __init__(self, a): ... print 'XXX' ... Test.__init__(self, a, 2) ... >>> PyTest(1) # try __init__ Traceback (most recent call last): File , line 0, in ##51 TypeError: PyTest() takes at least 3 arguments (2 given) >>> PyTest(1, 2) # see if base object's constructor still exists then Traceback (most recent call last): File , line 0, in ##52 TypeError: __init__() takes exactly 2 arguments (3 given) And finally, adding a kwarg gets us some more quirky behaviour: >>> class PyTest(Test): ... def __init__(self, a, b=2): ... print 'XXX' ... Test.__init__(self, a, b) ... >>> PyTest(1) Traceback (most recent call last): File , line 0, in ##67 TypeError: PyTest() takes at least 3 arguments (2 given) >>> PyTest(1, 2) XXX Regards -- Jonathan When you meet a master swordsman, show him your sword. When you meet a man who is not a poet, do not show him your poem. -- Rinzai, ninth century Zen master From john at emergentlifetech.com Mon Jun 19 20:32:05 2006 From: john at emergentlifetech.com (John Mancine) Date: Mon, 19 Jun 2006 13:32:05 -0500 Subject: [IronPython] Standard Libs Message-ID: <20060619183541.6D0B81BB6C@che.dreamhost.com> Hi all, I am trying to use IronPython and import 'urllib' -- and I have copied the /Lib/ dir from my Python 2.4 download, but I keep getting an error that the module "_socket" can't be found. I am correct in assuming I should I be able to use the standard libs in IronPython? Is there a specific way to go about this? Thanks for any help. - John From dinov at exchange.microsoft.com Mon Jun 19 20:39:35 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 19 Jun 2006 11:39:35 -0700 Subject: [IronPython] Standard Libs In-Reply-To: <20060619183541.6D0B81BB6C@che.dreamhost.com> References: <20060619183541.6D0B81BB6C@che.dreamhost.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03BB759F72@df-foxhound-msg.exchange.corp.microsoft.com> This will be fixed in beta 8, which we're planning on releasing later today. Previously we haven't had an implementation of the socket module and beta 8 will include it. If you can't wait a few hours you can get the latest source from http://www.codeplex.com/SourceControl/ListDownloadableCommits.aspx?ProjectName=IronPython - the current sources should be the same as the beta 8 sources unless we run into any last minute issues. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of John Mancine Sent: Monday, June 19, 2006 11:32 AM To: users at lists.ironpython.com Subject: [IronPython] Standard Libs Hi all, I am trying to use IronPython and import 'urllib' -- and I have copied the /Lib/ dir from my Python 2.4 download, but I keep getting an error that the module "_socket" can't be found. I am correct in assuming I should I be able to use the standard libs in IronPython? Is there a specific way to go about this? Thanks for any help. - John _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at exchange.microsoft.com Mon Jun 19 20:51:23 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 19 Jun 2006 11:51:23 -0700 Subject: [IronPython] .NET constructors In-Reply-To: <4496695E.8010407@kaydash.za.net> References: <4496695E.8010407@kaydash.za.net> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03BB759F97@df-foxhound-msg.exchange.corp.microsoft.com> This appears to be fixed for beta 8 - we've made a lot of changes to get to our final method dispatch story. One of those changes involved getting rid of creating some optimized methods that wouldn't have worked for more than 5 args. Likely this fixed the issue. That doesn't solve all your issues though - to override a normal CLR type's ctor you'll need to override __new__ instead of __init__. >>> class PyTest(Test): ... def __new__(cls, a): ... print 'XXX' ... return Test.__new__(cls, a, 2) And overriding new also makes the kw-arg case work as well. Why __new__ instead of __init__? In Python __init__ can be called explicitly on any instance after it has been created. You can't do this w/ C# classes & their ctors, so the mapping to __new__ is much more appropriate. We're planning on releasing Beta 8 later today, but you can get the current sources that include these fixes at http://www.codeplex.com/SourceControl/ListDownloadableCommits.aspx?ProjectName=IronPython -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jonathan Jacobs Sent: Monday, June 19, 2006 2:08 AM To: IronPython List Subject: [IronPython] .NET constructors Hi, (I didn't see any of these things on the CodePlex issue tracker, sorry if these are old news.) Trying to define a class that derives from my .NET object, with a single constructor that takes more than 4 arguments, explodes: Test.cs: public class Test { public Test(int a, int b, int c, int d, int e) { } } >>> class PyTest(Test): pass ... Traceback (most recent call last): File , line 0, in ##22 SystemError: too many args Adding a second constructor that takes fewer than 5 arguments lets me at least define my class, however I get some odd behaviour from the 5-argument constructor (the 2-arg constructor works fine): Test.cs: public class Test { public Test(int a, int b) { } public Test(int a, int b, int c, int d, int e) { } } >>> class PyTest(Test): pass ... >>> PyTest(1, 2) >>> PyTest(1, 2, 3, 4, 5) Traceback (most recent call last): File , line 0, in ##35 TypeError: PyTest() takes at most 6 arguments (6 given) Adding an initialiser to my derived class doesn't behave properly: >>> class PyTest(Test): ... def __init__(self, a): ... print 'XXX' ... Test.__init__(self, a, 2) ... >>> PyTest(1) # try __init__ Traceback (most recent call last): File , line 0, in ##51 TypeError: PyTest() takes at least 3 arguments (2 given) >>> PyTest(1, 2) # see if base object's constructor still exists then Traceback (most recent call last): File , line 0, in ##52 TypeError: __init__() takes exactly 2 arguments (3 given) And finally, adding a kwarg gets us some more quirky behaviour: >>> class PyTest(Test): ... def __init__(self, a, b=2): ... print 'XXX' ... Test.__init__(self, a, b) ... >>> PyTest(1) Traceback (most recent call last): File , line 0, in ##67 TypeError: PyTest() takes at least 3 arguments (2 given) >>> PyTest(1, 2) XXX Regards -- Jonathan When you meet a master swordsman, show him your sword. When you meet a man who is not a poet, do not show him your poem. -- Rinzai, ninth century Zen master _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at exchange.microsoft.com Mon Jun 19 20:51:23 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 19 Jun 2006 11:51:23 -0700 Subject: [IronPython] .NET constructors In-Reply-To: <4496695E.8010407@kaydash.za.net> References: <4496695E.8010407@kaydash.za.net> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03BB759F97@df-foxhound-msg.exchange.corp.microsoft.com> This appears to be fixed for beta 8 - we've made a lot of changes to get to our final method dispatch story. One of those changes involved getting rid of creating some optimized methods that wouldn't have worked for more than 5 args. Likely this fixed the issue. That doesn't solve all your issues though - to override a normal CLR type's ctor you'll need to override __new__ instead of __init__. >>> class PyTest(Test): ... def __new__(cls, a): ... print 'XXX' ... return Test.__new__(cls, a, 2) And overriding new also makes the kw-arg case work as well. Why __new__ instead of __init__? In Python __init__ can be called explicitly on any instance after it has been created. You can't do this w/ C# classes & their ctors, so the mapping to __new__ is much more appropriate. We're planning on releasing Beta 8 later today, but you can get the current sources that include these fixes at http://www.codeplex.com/SourceControl/ListDownloadableCommits.aspx?ProjectName=IronPython -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jonathan Jacobs Sent: Monday, June 19, 2006 2:08 AM To: IronPython List Subject: [IronPython] .NET constructors Hi, (I didn't see any of these things on the CodePlex issue tracker, sorry if these are old news.) Trying to define a class that derives from my .NET object, with a single constructor that takes more than 4 arguments, explodes: Test.cs: public class Test { public Test(int a, int b, int c, int d, int e) { } } >>> class PyTest(Test): pass ... Traceback (most recent call last): File , line 0, in ##22 SystemError: too many args Adding a second constructor that takes fewer than 5 arguments lets me at least define my class, however I get some odd behaviour from the 5-argument constructor (the 2-arg constructor works fine): Test.cs: public class Test { public Test(int a, int b) { } public Test(int a, int b, int c, int d, int e) { } } >>> class PyTest(Test): pass ... >>> PyTest(1, 2) >>> PyTest(1, 2, 3, 4, 5) Traceback (most recent call last): File , line 0, in ##35 TypeError: PyTest() takes at most 6 arguments (6 given) Adding an initialiser to my derived class doesn't behave properly: >>> class PyTest(Test): ... def __init__(self, a): ... print 'XXX' ... Test.__init__(self, a, 2) ... >>> PyTest(1) # try __init__ Traceback (most recent call last): File , line 0, in ##51 TypeError: PyTest() takes at least 3 arguments (2 given) >>> PyTest(1, 2) # see if base object's constructor still exists then Traceback (most recent call last): File , line 0, in ##52 TypeError: __init__() takes exactly 2 arguments (3 given) And finally, adding a kwarg gets us some more quirky behaviour: >>> class PyTest(Test): ... def __init__(self, a, b=2): ... print 'XXX' ... Test.__init__(self, a, b) ... >>> PyTest(1) Traceback (most recent call last): File , line 0, in ##67 TypeError: PyTest() takes at least 3 arguments (2 given) >>> PyTest(1, 2) XXX Regards -- Jonathan When you meet a master swordsman, show him your sword. When you meet a man who is not a poet, do not show him your poem. -- Rinzai, ninth century Zen master _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at exchange.microsoft.com Tue Jun 20 00:47:01 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 19 Jun 2006 15:47:01 -0700 Subject: [IronPython] IronPython 1.0 Beta 8 Message-ID: <4039D552ADAB094BB1EA670F3E96214E03BB75A231@df-foxhound-msg.exchange.corp.microsoft.com> Hello IronPython Community, We have just released IronPython 1.0 Beta 8. This release continues our focus on improving compatibility w/ CPython. It also includes the last set of large design changes to IronPython 1.0 including a new method dispatch algorithm that should be closer to C# and VB, but also will now throw in some cases if the method dispatch is ambiguous. There are also a large number of changes in the public API surface as we lock down for the final release (there will be one more set of changes to make fields private in the AST). We'd love to hear your feedback on these changes. Finally we've also included one new module in this release that has had high demand from the community: socket. A more complete list of changes follows at the end. You can download the release from: http://www.microsoft.com/downloads/details.aspx?FamilyId=FA3F9CC7-2A0D-41D3-AE51-0AEF8DFA7C57&displaylang=en We'd like to thank everyone in the community for your bug reports and suggestions that helped make this a better release: AaronM, Adnand Dragoti, Angelo Xu, Aude Espesset, Brian Loyd, CParmar, JesseK, Jonathan Jacobs, Keith J. Farmer, MFenniak, Michael Foord, Michael Shilman, Paparipote, Pelikhan and Seo Sanghyeon. Thanks and keep in touch, The IronPython Team Complete list of changes =================== Implement operators for all standard .NET types re.search returns the correct value ExecuteFile now returns Nullable to indicate whether SystemExit was returned Unhandled exceptions during startup are printed to the console Bitwise operators for standard .NET types are implemented (Byte, SByte, Int16, Uint16, Uint32, Uint64) Fixed issue w/ method dispatch & ref and out args Enabled test_eof from standard CPython regression test suite Bugfix: Dynamic method binding via __get__ is broken for both old and new style classes Bugfix: inconsistency with hash() on types extending builtin basic types Bugfix: unary operators not working for user types derived from basic types Bugfix: issues subclassing tuple, str, unicode, file, and list Bugfix: Errors creating builtin types using keyword arguments Bugfix: CodeDom.FileExtension returns "" Bugfix: str/repr of generic/non-generic collided types shows generic type name Bugfix: SyntaxError expected when function parameter is declared as global Bugfix: test_sys: SystemError is missing 'code' attribute Bugfix: cStringIO module implementation incomplete Experimental static compilation support (disabled by default) Support creating exceptions that logically live in other modules New organization & harness for IronPython regression tests New Hosting API revisions Fix compilation warnings on Mono Bugfix: IndexError, IndexOutOfRangeException on definition of usertype with multiple inheritance Bugfix: subclassing long is broken Bugfix: expecting __repr__ returned non-string Bugfix: file object missing a name member and doc strings Bugfix: Fix special method lookup for new style classes Bugfix: Add imp module Bugfix: dir() scoping bug Bugfix: Cleanup communication between the parser and PythonEngine used to determine when to continue a multi-line statement in the interpreter Improved test code for test_imp Bugfix: Deriving from sys module (and other builtins that implement ICustomAttributes) is broken. Bugfix: __bases__ is immutable when dealing with new-style classes. We were not updating MRO of subtypes Bugfix: __getattributes__ now works with builtins and .NET types Bugfix: vars() obeys the "import clr" context rules Bugfix: Disallow inheriting from function and instance-method Remove binary backwards compatibility for beta 6 -> beta 7 transition Bugfix: Issues subclassing dict, misaligned arguments on construction Bugfix: __call__ doesn't support keyword arguments Bugfix: __name__ is immutable Bugfix: tuple.ToString() doesn't work after import clr Fix issue w/ file handle implementation in nt Bugfix: scope: del a variable which name is also used in a list inside nested function Bugfix: scope: expect no NameError after that name is assigned in exec statement (inside a func) Bugfix: eval(expr, None, None) throws Bugfix: locals() don't include closure variables Bugfix: Scope: eval on a variable defined outside the function Bugfix: Test case disabled in test\test_decorators.py Bugfix: Constructing int from System.Single doesn't work Bugfix: builtin function help needs to be implemented Bugfix: Test pass takes forever Bugfix: 3 remaining issues in test_complex.py Bugfix: subclassing long is broken Bugfix: issues subclassing tuple, str, unicode, file, and list Disable traceback test on 64-bit machines Bugfix: issues with multiple inheritance and super Bugfix: Remove assert keyword from the test suite EngineContext was redundant with Frame Finish SymbolId propogation through code base Bugfix: nt.chmod flags are wrong (initialized as decimal rather than hex) Bugfix: Re-implement time.clock to use the high-performance stop watch class Bugfix: __slots__ implementation is broken Bugfix: enable sbs_typeop.py Bugfix: test_sys: sys.version_info needs to return a tuple containing 5 components Bugfix: __dict__ assignment doesn't work Bugfix: TypeError inheriting from multiple metaclasses Bugfix: Remove ValueType from __mro__ of value types Bugfix: Binascii returns incorrect results sometimes Bugfix: (complex.__ne__(1+1j, 1+1j) is False) == True Bugfix: exec doesn't handle mappings, it requires dictionaries Bugfix: exec "code" in global generates expression for global twice Bugfix: exec code in g, l evaluates g and l in the wrong order Added overloads of PythonEngine.Execute* that take a Frame and ExecutionOptionsAll the PythonEngine.Execute* APIs throw exceptions instead of catching them and converting to error codes Add CompiledModule type (CompiledModule is comparable with FrameCode since it contains the code for a PythonModule, but not the state associated with the module.) Bugfix: PythonEngine API: why engine.ExecuteFile(fileName) can't be debuged. If ExecutionOptions.EnableDebugging is specified, we emit code in debuggable snippets assembly. Added default constructor for Frame Bugfix: divmod issue Additional test cases for regular expressions Bugfix: Missing feature/functionality/implementation in Importer.cs Bugfix: implement type.mro() Bugfix: enable Scenario7 in EngineTest.cs Bugfix: from package.module import module imports module from it's self Bugfix: Issue with metaclasses declared nested in methods Bugfix: Stack overflow on importing package with mutually referencing modules Bugfix: dict construction compat issues Bugfix: More mro inconsistency when dealing with mixes of new and old style classes in a hierarchy New public CreatePythonException functions to support external modules creating old-style exceptions and test cases Added attributes injector feature and the related test. Bugfix: TypeError inheriting from multiple metaclasses Bugfix: OldInstance.TryGetAttr throws if AttributeError is raised by __getattr__ Removed IConsole interface Bugfix: Make delegate instance callable Bugfix: ExtensibleComplex doesn't work Bugfix: Traceback support for top-level code TraceBack is exposed publicly to other C# code Add Get/SetVariables overload that takes frame Added new CompileFile methods (2 overloads) Made the IFrameEnvironment members overridable in the Frame class Added TryGetGlobal to IFrameEnvironment. Bugfix: Custom dictionary types were not marked with [PythonType(typeof(Dict))]. Bugfix: Similarly, the CompiledModules did not have this. Hence isinstance(mymodule.__dict__, dic) was returning False. Bugfix: OpsReflectedType.OpsTypeToType mapped ArrayOps to the last loaded array type. Bugfix: class C(Interface): pass would look up the methods of the Interface on System.Object, which is incorrect. Bugfix: isinstance(old_style_class(), object) and isinstance(None, object) should return True Bugfix: IronPython: Command prompt shown when launching/debugging Windows Forms project Major overhaul of binding rules to better handle ambiguities, to better match C# and VB's rules and to unify the code paths between reflect optimized binding resolution. Marked Emit and Evaluate functions on the AST as private, making CodeGen internal to IronPython Bugfix: added a check for empty inheritance. Fixes to improve ability to pass more of stand-alone CodeDom test suite Renamed: Frame -> ModuleScope Renamed: FrameCode -> CompiledCode Renamed: PythonEngine.Get/SetVariable(string) -> PythonEngine.Get/SetGlobal(SymbolId) Renamed: PythonEngine.Execute(object) -> PythonEngine.Execute(CompiledCode) Renamed: IFrameEnvironment -> IModuleScope + IModuleEnvironment Bugfix: Add support for unsigned integer types (and other missing data types) Misc. code cleanup Bugfix: Re-enable delegates.py test case, and generally improve delegate support (out, ref, and params support for delegates) change static object field PythonEngine.ExecWrapper to static delegate property ConsoleCommandDispatcher. Bugfix: Missing feature/functionality/implementation in Function.cs Bugfix: Binding: ReflectOptimizer loses error information Bugfix: issues with list.__rmul__ ExtensibleComplex now implements IRichComparable __del__ support for new-style classes Improvements to pass all of test_long except logs test Entering a blank line in the console generates error __bases__ is immutable when dealing with new-style classes Implementing TrueCompare for ExtensibleComplex More code coverage for the .net datatype operators Bugfix: INumber doesn't handle all data types, therefore the datatypes must implemente the operators directly rather than delegating to INumber Bugfix: ReverseXXX on float calculated non-reverse result in some cases Bugfix: SingleOps didn't throw on division by zero Bugfix: consistent ~ operator for all unsigned types Bugfix: moved the tests into test_numtypes.py Bugfix: PythonEngine.Evaluate should not change module name to "". Bugfix: SuperConsole tab completion off end of cmd buffer should be detected and anchor position decremented per line scrolled. Added AutoIndent and made AutoIndent, ColorfulConsole, and TabComplete orthogonal flags. Removed HandleExceptions and PressAnyKeyToContinue flags from Console. #ifdef out COM GAC crawling code. Cleaned up code generation scripts Increased code coverage for .net data type operators Bugfix: fix for the case of ExtensibleLong ** UInt64 in which the UInt64 would get converted to double rather than staying integer. Bugfix: Explicit interface properties are always getting long-names Bugfix: Tuple hashing doesn't seem to call new-class's __hash__ function Bugfix: support __coerce__ method in ops. Implement socket module, enabling standard library tests to pass: BaseHTTPServer, DocXMLRPCServer, SimpleHTTPServer, SimpleXMLRPCServer, SocketServer, cgi, ielib, ftplib, httplib, imaplib, macurl2path, mimetypes, nntplib, poplib, robotparser, smtplib, and urllib. socket passes with modifications. Bugfix: Threads now properly exit when SystemExit is raised Bugfix: IP.Compiler.NewTypeMaker now handles types correctly when generating properties Bugfix: CodePlex 446 - Compiler throw on invalid syntax Add new IronPythonWindow.exe for launching Windows apps w/o console Moved many classes to be private to IronPython, refactored namespaces Bugfix: 357 - Subclassing dict, not overriding init, and passing k/w args throws Bugfix: 424 - Implement DynamicType clr.GetPythonType(Type t) Bugfix: 439 - System.Array.Resize throws IndexError Bugfix: Fix __slots__ / __weakref__ / __dict__ issue where we pick the wrong base type More .NET primitive type operations clean-up & test coverage Support for 2.5 PEP 308 (enabled w/ -X:Python25) Bugfix: PreParseRegex incorrectly identifying the '?' in r"\(? " as an extension instead of 0 or 1 left parens Bugfix: ?# is not being recognized as an extension by PreParseRegEx Bugfix: a list is equal to empty string and other sequence types, eg [3, 5] == '' From mbarnett at uniserve.com Tue Jun 20 06:06:09 2006 From: mbarnett at uniserve.com (Lesley & Mitch Barnett) Date: Mon, 19 Jun 2006 21:06:09 -0700 Subject: [IronPython] embedding IP in C# Windows .NET GUI In-Reply-To: Message-ID: <000601c6941e$dc7e43f0$6401a8c0@NIS1861127372> Hi, I am trying to embed IP in my C# .NET Windows app with limited success. The closest to what I am looking for is this: http://lists.ironpython.com/pipermail/users-ironpython.com/2006-April/002205 .html But could not get it to work... I am looking to embed a single RichTextBox for both I/O and the RichTextBox embedded in the main window form (not MDI). Has anyone had success in doing this? And willing to share some code? Thanks in advance, Mitch http://softwareindustrialization.com From lcm at spiralcomms.com Tue Jun 20 06:40:45 2006 From: lcm at spiralcomms.com (Cheemeng) Date: Tue, 20 Jun 2006 12:40:45 +0800 Subject: [IronPython] the new version cannot find an overload for ToolStripItemCollection.AddRange when using a list Message-ID: <44977C4D.3030907@spiralcomms.com> hi , the doc for ToolStripItemCollection.AddRange list the 2 overloads as: ToolStripItemCollection.AddRange (ToolStripItem[]) ToolStripItemCollection.AddRange (ToolStripItemCollection) in prev ironpython version, we can pass a python list as argument, in the newest version, this gives TypeError: no applicable overload Dun know whether this is a new bug OR prev, it works without intention to :) below is the test program, import clr clr.AddReferenceByPartialName("System.Windows.Forms") clr.AddReferenceByPartialName("System.Drawing") from System.Windows.Forms import * from System.Drawing import * class TestMenu(Form): def __init__(self): self.InitializeComponent() def InitializeComponent(self): self.ClientSize = Size(300, 200) self.Name = self.Text = "Test Menu" ms = ToolStripMenuItem() ms.Name = ms.Text = "Hello" ctxMenu = ContextMenuStrip() ctxMenu.Items.AddRange([ms]) # doesn't work in new version #ctxMenu.Items.Add(ms) # this works self.ContextMenuStrip = ctxMenu f = TestMenu() Application.Run(f) thanks. regards cheemeng From korpse-ironpython at kaydash.za.net Tue Jun 20 09:05:37 2006 From: korpse-ironpython at kaydash.za.net (Jonathan Jacobs) Date: Tue, 20 Jun 2006 09:05:37 +0200 Subject: [IronPython] the new version cannot find an overload for ToolStripItemCollection.AddRange when using a list In-Reply-To: <44977C4D.3030907@spiralcomms.com> References: <44977C4D.3030907@spiralcomms.com> Message-ID: <44979E41.5040700@kaydash.za.net> Cheemeng wrote: > the doc for ToolStripItemCollection.AddRange list the 2 overloads as: > ToolStripItemCollection.AddRange (ToolStripItem[]) > ToolStripItemCollection.AddRange (ToolStripItemCollection) > > in prev ironpython version, we can pass a python list as argument, > in the newest version, this gives TypeError: no applicable overload > > ctxMenu.Items.AddRange([ms]) # doesn't work in new version Oddly enough, the list syntax doesn't work but using a tuple does: >>> ctxMenu.Items.AddRange((ms,)) >>> -- Jonathan From joesox at gmail.com Tue Jun 20 15:24:08 2006 From: joesox at gmail.com (JoeSox) Date: Tue, 20 Jun 2006 06:24:08 -0700 Subject: [IronPython] embedding IP in C# Windows .NET GUI In-Reply-To: <000601c6941e$dc7e43f0$6401a8c0@NIS1861127372> References: <000601c6941e$dc7e43f0$6401a8c0@NIS1861127372> Message-ID: <785694cd0606200624p25718ce2n449b5453c0d1cdbf@mail.gmail.com> On 6/19/06, Lesley & Mitch Barnett wrote: > Hi, > > I am trying to embed IP in my C# .NET Windows app with limited success. The > closest to what I am looking for is this: > > http://lists.ironpython.com/pipermail/users-ironpython.com/2006-April/002205 > .html > > But could not get it to work... > > I am looking to embed a single RichTextBox for both I/O and the RichTextBox > embedded in the main window form (not MDI). > > Has anyone had success in doing this? And willing to share some code? > > Thanks in advance, I wrote "IronTextBox" http://codeproject.com/useritems/irontextbox.asp The full source and .dll may be downloaded there. I wrote it as I was first learning IronPython so it was kind of pieced together but anyone can easily drop the box into a form if referenced properly in Visual Studio. I have looked in the code in months and haven't tested it with any versions of IronPython above beta6 if I remember correctly. I don't think I actually used a RichTextBox because I didn't feel like messing around (and learning) Rtf. Later, Joe From fclm1000 at msn.com Tue Jun 20 15:55:20 2006 From: fclm1000 at msn.com (fernando moreira) Date: Tue, 20 Jun 2006 10:55:20 -0300 Subject: [IronPython] more pythonic than python Message-ID: Hello ! First of all, thanks for the great job you are doing ! Second, as newbie programmer i would like to ask if you have in mind after finnish IP, to create a completely pythonic language - like python should be without its warts and gotchas. I think it would not be hard for you to do the cleaning in the language ( the PEPs are too slow and shy ;( ). Below come 2 examples that bother me and i did not find in the python?s gotchas/warts pages in internet. Thanks ;) >>>class __Verbs: ... def __init__(self): ... annoy = "argh" ... bother = "bargh" ... >>>v = __Verbs() >>>v.mother = "we should have an error here (i mistyped the variable's >>>name)" I think this is an excessive flexibility of the language, error prone. ################################ >>>str = "abc" >>>str[0] = "z" Traceback (most recent call last): File , line 0, in ##14 AttributeError: 'str' object has no attribute '__setitem__' Although this useful feature appears in pnuts language. This time the language was not flexible and simple enough for my taste. _________________________________________________________________ MSN Messenger: instale gr?tis e converse com seus amigos. http://messenger.msn.com.br From luismg at gmx.net Tue Jun 20 16:05:04 2006 From: luismg at gmx.net (Luis M. Gonzalez) Date: Tue, 20 Jun 2006 11:05:04 -0300 Subject: [IronPython] Experimental static compilation Message-ID: <000601c69472$90dc7f30$c51ce818@luis> Hi all, I see that you added an experimental static compilation in beta 8, which is dissabled by default However, I didn't find any clue as to how to use it in the documentation... How does it work? Luis -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Tue Jun 20 16:08:55 2006 From: fuzzyman at voidspace.org.uk (Fuzzyman) Date: Tue, 20 Jun 2006 15:08:55 +0100 Subject: [IronPython] more pythonic than python In-Reply-To: References: Message-ID: <44980177.50908@voidspace.org.uk> fernando moreira wrote: > Hello ! > > First of all, thanks for the great job you are doing ! > > Second, as newbie programmer i would like to ask if you have in mind > after finnish IP, to create a completely pythonic language - like > python should be without its warts and gotchas. I think it would not > be hard for you to do the cleaning in the language ( the PEPs are too > slow and shy ;( ). > > Below come 2 examples that bother me and i did not find in the > python?s gotchas/warts pages in internet. > > Thanks ;) > > > > > >>>> class __Verbs: >>> > ... def __init__(self): > ... annoy = "argh" > ... bother = "bargh" > ... > >>>> v = __Verbs() >>>> v.mother = "we should have an error here (i mistyped the variable's >>>> name)" >>> > > > I think this is an excessive flexibility of the language, error prone. > Preventing you from setting attributes on objects would be very annoying. On the other hand there are several tricks with ``__setattr__``, metaclasses, and ``__slots__`` that can all be used to achieve what you want. > > > > ################################ > > > >>>> str = "abc" >>>> str[0] = "z" >>> > Traceback (most recent call last): > File , line 0, in ##14 > AttributeError: 'str' object has no attribute '__setitem__' > Strings are immutable. Writing a simple class that does what you want (in most situations) is not very difficult. Having the core string datatype as mutable would have all sorts of nasty consequences (like not being able to use them as dictionary keys because they would no longer be hashable). All the best, Michael Foord > > Although this useful feature appears in pnuts language. This time the > language was not flexible and simple enough for my taste. > > _________________________________________________________________ > MSN Messenger: instale gr?tis e converse com seus amigos. > http://messenger.msn.com.br > >------------------------------------------------------------------------ > >_______________________________________________ >users mailing list >users at lists.ironpython.com >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > From ralph.soons.asml at hotmail.com Tue Jun 20 17:04:02 2006 From: ralph.soons.asml at hotmail.com (Ralph Soons) Date: Tue, 20 Jun 2006 17:04:02 +0200 Subject: [IronPython] Remoting: Marshal object In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E03BB75A231@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: I have a remoting problem again. I want to create an object at server side, as singleton so when a call is done at client side, ill get the already existing object. I tried it first with a c# server and client. Can anyone tell me why the marshal function doesn't work, objects on server and client side are still different (same code works in c# application so configuration is correct): Client side (Python): t = RemotingServerClient.CallbackSink.Instance System.Runtime.Remoting.RemotingServices.Marshal(t, 'TalkIsGoodToo') Server side (c#): CallbackSink.Instance.Send("Message"); Remotable object (c#): public class CallbackSink : MarshalByRefObject { private static CallbackSink m_Instance = null; public event delCommsInfo OnHostToClient; public static CallbackSink Instance { get { if (null == m_Instance) { m_Instance = new CallbackSink(); } return m_Instance; } } private CallbackSink() { } public void Send(string message) { OnHostToClient(info); } } Thanks for your help. Best regards, Ralph Soons _________________________________________________________________ Talk with your online friends with MSN Messenger http://www.join.msn.com/messenger/overview From dinov at exchange.microsoft.com Tue Jun 20 17:22:43 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Tue, 20 Jun 2006 08:22:43 -0700 Subject: [IronPython] more pythonic than python In-Reply-To: References: Message-ID: <4039D552ADAB094BB1EA670F3E96214E03BC058437@df-foxhound-msg.exchange.corp.microsoft.com> You can actually enforce the 1st one by using __slots__ on a new-style class: Class __Verbs(object): __slots__ = ['annoy', 'bother'] def __init__(self): self.annoy = 'argh' self.bother = 'bargh' v = __Verbs() v.mother = "throws attribute error" This is now enforced in IP Beta 8 (previously we would ignore __slots__ and use a dictionary for storage anyway). Immutable strings are a good thing - they enable a more sane security model (imagine if you had to copy a string everytime before you could validate it), they enable a better optimization model (imagine if you couldn't rely on checking the length once in a loop, and instead got bounds checking on every access because another thread could mutate the string), and they make things like interning viable. Our goal for IronPython is to try and make Python run great on .NET so we'll leave the great Python clean-up to Python 3000. :) -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of fernando moreira Sent: Tuesday, June 20, 2006 6:55 AM To: users at lists.ironpython.com Subject: [IronPython] more pythonic than python Hello ! First of all, thanks for the great job you are doing ! Second, as newbie programmer i would like to ask if you have in mind after finnish IP, to create a completely pythonic language - like python should be without its warts and gotchas. I think it would not be hard for you to do the cleaning in the language ( the PEPs are too slow and shy ;( ). Below come 2 examples that bother me and i did not find in the python?s gotchas/warts pages in internet. Thanks ;) >>>class __Verbs: ... def __init__(self): ... annoy = "argh" ... bother = "bargh" ... >>>v = __Verbs() >>>v.mother = "we should have an error here (i mistyped the variable's >>>name)" I think this is an excessive flexibility of the language, error prone. ################################ >>>str = "abc" >>>str[0] = "z" Traceback (most recent call last): File , line 0, in ##14 AttributeError: 'str' object has no attribute '__setitem__' Although this useful feature appears in pnuts language. This time the language was not flexible and simple enough for my taste. _________________________________________________________________ MSN Messenger: instale gr?tis e converse com seus amigos. http://messenger.msn.com.br From dinov at exchange.microsoft.com Tue Jun 20 17:27:12 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Tue, 20 Jun 2006 08:27:12 -0700 Subject: [IronPython] Experimental static compilation In-Reply-To: <000601c69472$90dc7f30$c51ce818@luis> References: <000601c69472$90dc7f30$c51ce818@luis> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03BC058439@df-foxhound-msg.exchange.corp.microsoft.com> The reason why we didn't mention it, and the reason why it's disabled by default, is because there are limits to it in what you can do and plenty of corner cases that don't work. Another way to put that is it's nowhere near passing all the CPython and our own IronPython regression tests (and we have plenty of concerns about how close we can get there). That being said our CodeDom provider currently enables it by default, and that in turn can be used to create web pages w/ ASP.NET. So it is at least somewhat functional, but definitely not ready for prime-time. It currently works by parsing the Python code like we normally do and making lots of guesses about what it sees. We still generate the various sort of module-initialization code that you'd get w/ Python. The classes definition becomes the cctor and is run on first access. And we map all function definitions to returning object & taking all object parameters, unless we detect an overload in which case we pick a virtual method w/ the same name to overload. Currently it's not very sophisticated in how it does any of this. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Luis M. Gonzalez Sent: Tuesday, June 20, 2006 7:05 AM To: users at lists.ironpython.com Subject: [IronPython] Experimental static compilation Hi all, I see that you added an experimental static compilation in beta 8, which is dissabled by default However, I didn't find any clue as to how to use it in the documentation... How does it work? Luis -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Tue Jun 20 17:29:51 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Tue, 20 Jun 2006 08:29:51 -0700 Subject: [IronPython] the new version cannot find an overload for ToolStripItemCollection.AddRange when using a list In-Reply-To: <44979E41.5040700@kaydash.za.net> References: <44977C4D.3030907@spiralcomms.com> <44979E41.5040700@kaydash.za.net> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03BC05843D@df-foxhound-msg.exchange.corp.microsoft.com> Yep, this is part of our tightening down our conversion & method dispatch logic. We thought the implicit conversion from a List to an array was a little evil. The array could be updated inside of the call and the user's list wouldn't be updated. A caller w/ a tuple doesn't expect to see their tuple updated, and therefore that is an acceptable conversion. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jonathan Jacobs Sent: Tuesday, June 20, 2006 12:06 AM To: Discussion of IronPython Subject: Re: [IronPython] the new version cannot find an overload for ToolStripItemCollection.AddRange when using a list Cheemeng wrote: > the doc for ToolStripItemCollection.AddRange list the 2 overloads as: > ToolStripItemCollection.AddRange (ToolStripItem[]) > ToolStripItemCollection.AddRange (ToolStripItemCollection) > > in prev ironpython version, we can pass a python list as argument, in > the newest version, this gives TypeError: no applicable overload > > ctxMenu.Items.AddRange([ms]) # doesn't work in new version Oddly enough, the list syntax doesn't work but using a tuple does: >>> ctxMenu.Items.AddRange((ms,)) >>> -- Jonathan _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at exchange.microsoft.com Tue Jun 20 18:05:07 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Tue, 20 Jun 2006 09:05:07 -0700 Subject: [IronPython] Remoting: Marshal object In-Reply-To: References: <4039D552ADAB094BB1EA670F3E96214E03BB75A231@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03BC058471@df-foxhound-msg.exchange.corp.microsoft.com> I'm a little lost on this one - what is RemotingServerClient here? Is it a type, an assembly, a namespace? Also, do you get an exception, or does it just do nothing? -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ralph Soons Sent: Tuesday, June 20, 2006 8:04 AM To: users at lists.ironpython.com Subject: [IronPython] Remoting: Marshal object I have a remoting problem again. I want to create an object at server side, as singleton so when a call is done at client side, ill get the already existing object. I tried it first with a c# server and client. Can anyone tell me why the marshal function doesn't work, objects on server and client side are still different (same code works in c# application so configuration is correct): Client side (Python): t = RemotingServerClient.CallbackSink.Instance System.Runtime.Remoting.RemotingServices.Marshal(t, 'TalkIsGoodToo') Server side (c#): CallbackSink.Instance.Send("Message"); Remotable object (c#): public class CallbackSink : MarshalByRefObject { private static CallbackSink m_Instance = null; public event delCommsInfo OnHostToClient; public static CallbackSink Instance { get { if (null == m_Instance) { m_Instance = new CallbackSink(); } return m_Instance; } } private CallbackSink() { } public void Send(string message) { OnHostToClient(info); } } Thanks for your help. Best regards, Ralph Soons _________________________________________________________________ Talk with your online friends with MSN Messenger http://www.join.msn.com/messenger/overview _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From john at emergentlifetech.com Tue Jun 20 18:25:09 2006 From: john at emergentlifetech.com (John Mancine) Date: Tue, 20 Jun 2006 11:25:09 -0500 Subject: [IronPython] OnVarChanged Message-ID: <20060620162608.77C9E1BB86@che.dreamhost.com> I realize this is likely woefully na?ve but I thought I'd ask anyhow. I have a very specific case in my project where I would really like to know when a variable inside IronPython changes. Basically when I do this: pythonEngine.Execute("a = 3"); // Or something more complex that ends up changing global var 'a' I am looking for a way to be notified when 'a' has been assigned to a new value. This seems to be pretty simple for the Set/GetGlobal() calls but what about code that is inside of the Execute() block? Where could I look at adding some code myself such that I can add these hooks? I have dug through some of the code to find a place to add a hook but I couldn't seem to find anything clear cut. Again, I realize this is pretty simplistic and also painfully slow for any moderate scripting but I have a very specific case where I would like some widgets in C# to respond to when a variable has changed. (The watchwindow in visual studio would be a good parallel of what I'm needing to do -- ie. show a new value has been set for a particular value you are watching). Thanks! John From furtwan1 at msu.edu Tue Jun 20 18:53:44 2006 From: furtwan1 at msu.edu (Brandon Furtwangler) Date: Tue, 20 Jun 2006 12:53:44 -0400 Subject: [IronPython] OnVarChanged In-Reply-To: <20060620162608.77C9E1BB86@che.dreamhost.com> References: <20060620162608.77C9E1BB86@che.dreamhost.com> Message-ID: <00b801c6948a$17aefee0$470cfca0$@edu> How fine grain do you need change notifications? you could just store the pre-execute value of a, and after each python Execute you could check that the pre-a is the same as a. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of John Mancine Sent: Tuesday, June 20, 2006 12:25 PM To: users at lists.ironpython.com Subject: [IronPython] OnVarChanged I realize this is likely woefully na?ve but I thought I'd ask anyhow. I have a very specific case in my project where I would really like to know when a variable inside IronPython changes. Basically when I do this: pythonEngine.Execute("a = 3"); // Or something more complex that ends up changing global var 'a' I am looking for a way to be notified when 'a' has been assigned to a new value. This seems to be pretty simple for the Set/GetGlobal() calls but what about code that is inside of the Execute() block? Where could I look at adding some code myself such that I can add these hooks? I have dug through some of the code to find a place to add a hook but I couldn't seem to find anything clear cut. Again, I realize this is pretty simplistic and also painfully slow for any moderate scripting but I have a very specific case where I would like some widgets in C# to respond to when a variable has changed. (The watchwindow in visual studio would be a good parallel of what I'm needing to do -- ie. show a new value has been set for a particular value you are watching). Thanks! John _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Tue Jun 20 18:59:11 2006 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 20 Jun 2006 17:59:11 +0100 Subject: [IronPython] OnVarChanged In-Reply-To: <20060620162608.77C9E1BB86@che.dreamhost.com> References: <20060620162608.77C9E1BB86@che.dreamhost.com> Message-ID: <4498295F.2030200@voidspace.org.uk> John Mancine wrote: > I realize this is likely woefully na?ve but I thought I'd ask anyhow. > > I have a very specific case in my project where I would really like to know > when a variable inside IronPython changes. Basically when I do this: > > pythonEngine.Execute("a = 3"); // Or something more complex that ends up > changing global var 'a' > > I am looking for a way to be notified when 'a' has been assigned to a new > value. This seems to be pretty simple for the Set/GetGlobal() calls but what > about code that is inside of the Execute() block? Where could I look at > adding some code myself such that I can add these hooks? I have dug through > some of the code to find a place to add a hook but I couldn't seem to find > anything clear cut. > > Again, I realize this is pretty simplistic and also painfully slow for any > moderate scripting but I have a very specific case where I would like some > widgets in C# to respond to when a variable has changed. (The watchwindow in > visual studio would be a good parallel of what I'm needing to do -- ie. show > a new value has been set for a particular value you are watching). > > Hello John, I may be off beam here (I'm no C# expert and know little about the IronPython internals) but it sounds like what you want to do is a bit at conflict with the way Python works. Python doesn't have variables by value as such, it has names and objects. In your example, 'a' isn't an object, it's a name bound to an object. When you do : a = 1 a = 2 it's not that the value of a changes, instead the name is rebound to a different object. Tracking changes to a mutable object is one thing, but tracking name binding is a different thing altogether. Perhaps you could replace the ``__dict__`` attribute of a module (where names are stored) with a custom 'dictionary-like' object, that calls a callback when assignments are made ? A better approach would be to use a value on an object (instead of a local variable), and you can get that object to perform a callback when changes are made. All the best, Fuzzyman http://www.voidspace.org.uk/python/index.shtml > Thanks! > John > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > From john at emergentlifetech.com Tue Jun 20 19:26:43 2006 From: john at emergentlifetech.com (John Mancine) Date: Tue, 20 Jun 2006 12:26:43 -0500 Subject: [IronPython] OnVarChanged In-Reply-To: <00b801c6948a$17aefee0$470cfca0$@edu> Message-ID: <20060620172648.E1D1A1BA6C@che.dreamhost.com> Hi Brandon -- Yeah, this was my fallback. I guess I had eyed the ability to hook in event callbacks because I have other things I'd like to know about such as when a class is declared etc. Basically, if you have an app where the user is free to code Python script (Execute(code)) -- and I don't want to parse that myself to see what the user is doing, I'd like to get notified somehow when they change a var, or declare a class etc. etc... If I can look at what classes exist pre-execute and what classes exist-post execute, then this would be a possibility, but I haven't really found where that info is as well. I just wasn't sure where I look to see when these things happen. The terminology with Python seems to be quite different then anything I'm used to (I'm a newbie to python) so my search is a bit harder for finding a place to add hooks. And of course, my lack of Python knowledge could just make this a poorly formed solution to begin with. ;-) > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Brandon Furtwangler > Sent: Tuesday, June 20, 2006 11:54 AM > To: 'Discussion of IronPython' > Subject: Re: [IronPython] OnVarChanged > > How fine grain do you need change notifications? you could just store the > pre-execute value of a, and after each python Execute you could check that > the pre-a is the same as a. > > -----Original Message----- > From: users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] On Behalf Of John Mancine > Sent: Tuesday, June 20, 2006 12:25 PM > To: users at lists.ironpython.com > Subject: [IronPython] OnVarChanged > > I realize this is likely woefully na?ve but I thought I'd ask anyhow. > > I have a very specific case in my project where I would really like to > know > when a variable inside IronPython changes. Basically when I do this: > > pythonEngine.Execute("a = 3"); // Or something more complex that ends up > changing global var 'a' > > I am looking for a way to be notified when 'a' has been assigned to a new > value. This seems to be pretty simple for the Set/GetGlobal() calls but > what > about code that is inside of the Execute() block? Where could I look at > adding some code myself such that I can add these hooks? I have dug > through > some of the code to find a place to add a hook but I couldn't seem to find > anything clear cut. > > Again, I realize this is pretty simplistic and also painfully slow for any > moderate scripting but I have a very specific case where I would like some > widgets in C# to respond to when a variable has changed. (The watchwindow > in > visual studio would be a good parallel of what I'm needing to do -- ie. > show > a new value has been set for a particular value you are watching). > > Thanks! > John > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From john at emergentlifetech.com Tue Jun 20 20:04:30 2006 From: john at emergentlifetech.com (John Mancine) Date: Tue, 20 Jun 2006 13:04:30 -0500 Subject: [IronPython] OnVarChanged In-Reply-To: <4498295F.2030200@voidspace.org.uk> Message-ID: <20060620180431.670261BA6C@che.dreamhost.com> Thanks for the info. I think I have found what I was looking for now. Basically, this is the earliest breakpoint that I hit after returning from the [Lightweight Function] on the call stack after engine.Execute("a=1") is called. IronPython.Runtime.ModuleScope.SetLocal(SymbolId symbol, object value) Sure looks promising at least. The symbol is 'a' and the value is '1'. I also found a IronPython.Runtime.Operations.Ups.MakeClass() call which should be helpful for hooking into class declarations. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Tuesday, June 20, 2006 11:59 AM > To: Discussion of IronPython > Subject: Re: [IronPython] OnVarChanged > > John Mancine wrote: > > I realize this is likely woefully na?ve but I thought I'd ask anyhow. > > > > I have a very specific case in my project where I would really like to > know > > when a variable inside IronPython changes. Basically when I do this: > > > > pythonEngine.Execute("a = 3"); // Or something more complex that ends up > > changing global var 'a' > > > > I am looking for a way to be notified when 'a' has been assigned to a > new > > value. This seems to be pretty simple for the Set/GetGlobal() calls but > what > > about code that is inside of the Execute() block? Where could I look at > > adding some code myself such that I can add these hooks? I have dug > through > > some of the code to find a place to add a hook but I couldn't seem to > find > > anything clear cut. > > > > Again, I realize this is pretty simplistic and also painfully slow for > any > > moderate scripting but I have a very specific case where I would like > some > > widgets in C# to respond to when a variable has changed. (The > watchwindow in > > visual studio would be a good parallel of what I'm needing to do -- ie. > show > > a new value has been set for a particular value you are watching). > > > > > Hello John, > > I may be off beam here (I'm no C# expert and know little about the > IronPython internals) but it sounds like what you want to do is a bit at > conflict with the way Python works. > > Python doesn't have variables by value as such, it has names and objects. > > In your example, 'a' isn't an object, it's a name bound to an object. > > When you do : > > a = 1 > a = 2 > > it's not that the value of a changes, instead the name is rebound to a > different object. Tracking changes to a mutable object is one thing, but > tracking name binding is a different thing altogether. > > Perhaps you could replace the ``__dict__`` attribute of a module (where > names are stored) with a custom 'dictionary-like' object, that calls a > callback when assignments are made ? A better approach would be to use a > value on an object (instead of a local variable), and you can get that > object to perform a callback when changes are made. > > All the best, > > Fuzzyman > http://www.voidspace.org.uk/python/index.shtml > > > Thanks! > > John > > > > _______________________________________________ > > users mailing list > > users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fclm1000 at msn.com Tue Jun 20 20:42:40 2006 From: fclm1000 at msn.com (fernando moreira) Date: Tue, 20 Jun 2006 15:42:40 -0300 Subject: [IronPython] more pythonic than python ( continuation) Message-ID: Thanks for your kind replies. As newbie, i forgot to use 'self' inside the constructor :P . Of course, i can't argue beside your expertises about the internal mechanics of the language. But since i am newbie and sice python intends to be easy to learn, compact, clean, friendly, intuitive, execelent first language etc... I can express the following: I type >>>str = "abc"; str[0] = "z" Then the interpreter thinks "Oh no! Here comes another newbie that does not know that strings are imutable or else all sorts of nasty consequences would happens. Can't he read the manual more carefully ? Why can?t he type str = 'z' + str [1:] or maybe write some class to deal with it ? Let me send him my traditional error message." But what i would expect from a really pythonic interpreter is "He he he... Another newbie that does not know strings are imutable. I am a very friendly interpreter of a very intuitive language; ). So, behind the scenes i will send the present string to trash after i create another one with the same variable?s name. Thus the newbies will keep smiling and saying that python rocks !" Ok. I can begin to learn to use __slots__ and/or "several tricks with ``__setattr__``, metaclasses, and ``__slots__`` that can all be used to achieve what i want". But i don?t FEEL it is the lovely PYTHONIC way. Let me abuse of your time and tell a little history. Around 25 years ago, i passed happy hours using trs-80 basic ( if my memory is not failing). That hobby had no continuation . About 15 months i decided to program again. I searched the internet for which language i should use. C# was not an option because i thouhgt i had to buy it. I started with C++. Being self-taught in C++ and coming from a background of the old procedural, clean-sintaxed and compact Basic was like a stand in a torture chamber. Then i tryed Java, wich promissed to throw in the garbage can the complication of C++ and was a plataform too. I mean it had(s) functions(classes) to deal with mouse and image on screen, etc... Still i coud not believe that as computers and applications turned so amazing powerfull along decades, the computer languages had dismissed the good old Basic and adopted some really complicated sutff. After experimenting other languages in internet, i met Python. Wooow, love at first sight ;). Python seemed to be what i dreamed a computer language should be. I shout to my son: "Come here quickly cause your daddy will teach you computer programmimg.!". But my honeymoon with Python had some problems. I wanted to program 2D games and there was no good GUI to do it. Then Ironpython shined in my life. Till then i had no idea of what .NET meant. I thought it was only a marketing performance of MS, weak in content. Well, i had difficoulties self-taughting me Python and .NET trhough the IronPython iterpreter and the complex ( for beginners) C# examples MSDN show. I had to translate them to IronPython - i got no idea i already had a C# compiler in my computer :P. Ahh.. and i was self-teaching GUI programming and OOP at the same time ( though i have to admit that my experiments with Java and C++ helpded a bit). For not be longer, i can tell that i felt in love with MSIL ( only wish it was more compact ), had sad deceptions with Python and ( you can laugh at will, i am newbie and probably don?t have a clue about what i am talking ), though i hate to use semi-colons all the time, the ugly brackets and the verbosity, i feel myself much more confortabe, pleased and safe writing in C# than in Python. I feel C# is more pythonic than Python after i had some introduction to the language. In Python my first program can be : print "this is my first program" Nothig can be simpler. But when i have to deal with classes. in C# i can use the intuitive, easy, friendly, etc... code like this... public class Verbs { string bother; string annoy; public Verbs() { this.annoy = "argh"; this.bother = "bargh"; } } and everything works fine. Well gentlemen, i am not here for complain about your job nor about IronPython. Indeed i am very glad of what you have done. I am bit sad because now i know that make Python perfect ( as i dreamed it should be) is not one of your goals. I understand that it is not your responsability. Thank you for your kind attention. _________________________________________________________________ MSN Messenger: instale gr?tis e converse com seus amigos. http://messenger.msn.com.br From furtwan1 at msu.edu Wed Jun 21 01:59:37 2006 From: furtwan1 at msu.edu (Brandon Furtwangler) Date: Tue, 20 Jun 2006 19:59:37 -0400 Subject: [IronPython] more pythonic than python ( continuation) In-Reply-To: References: Message-ID: <00d901c694c5$964e2650$c2ea72f0$@edu> The biggest problem that I see in your line of thought is that many of the worst languages have gone down this route only to become a complete mess of random compiler-does-what-you-meant rules. In the end it just adds complexity and only helps out a few newbie's. After you use python (or most other modern languages) you know the very simple rule that strings are immutable. If they were immutable, but the compiler helps you out and does some clever trickery behind your back, this would only cause more confusion when you don't expect it (in error) than the error you got. I dread using old school PHP because some of the libraries do something similar. Some functions (but not all) that require an array as an input parameter but will allow non-array inputs and will automagically wrap them in an array. While that might sound like a good convenience for the user it has bit me in the ass many times because I pass the wrong variable and never get an error message. This is a general problem with dynamic languages, but it's similar to the idea of having the compiler help newbie's. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of fernando moreira Sent: Tuesday, June 20, 2006 2:43 PM To: users at lists.ironpython.com Subject: [IronPython] more pythonic than python ( continuation) Thanks for your kind replies. As newbie, i forgot to use 'self' inside the constructor :P . Of course, i can't argue beside your expertises about the internal mechanics of the language. But since i am newbie and sice python intends to be easy to learn, compact, clean, friendly, intuitive, execelent first language etc... I can express the following: I type >>>str = "abc"; str[0] = "z" Then the interpreter thinks "Oh no! Here comes another newbie that does not know that strings are imutable or else all sorts of nasty consequences would happens. Can't he read the manual more carefully ? Why can4t he type str = 'z' + str [1:] or maybe write some class to deal with it ? Let me send him my traditional error message." But what i would expect from a really pythonic interpreter is "He he he... Another newbie that does not know strings are imutable. I am a very friendly interpreter of a very intuitive language; ). So, behind the scenes i will send the present string to trash after i create another one with the same variable4s name. Thus the newbies will keep smiling and saying that python rocks !" Ok. I can begin to learn to use __slots__ and/or "several tricks with ``__setattr__``, metaclasses, and ``__slots__`` that can all be used to achieve what i want". But i don4t FEEL it is the lovely PYTHONIC way. Let me abuse of your time and tell a little history. Around 25 years ago, i passed happy hours using trs-80 basic ( if my memory is not failing). That hobby had no continuation . About 15 months i decided to program again. I searched the internet for which language i should use. C# was not an option because i thouhgt i had to buy it. I started with C++. Being self-taught in C++ and coming from a background of the old procedural, clean-sintaxed C++ and compact Basic was like a stand in a torture chamber. Then i tryed Java, wich promissed to throw in the garbage can the complication of C++ and was a plataform too. I mean it had(s) functions(classes) to deal with mouse and image on screen, etc... Still i coud not believe that as computers and applications turned so amazing powerfull along decades, the computer languages had dismissed the good old Basic and adopted some really complicated sutff. After experimenting other languages in internet, i met Python. Wooow, love at first sight ;). Python seemed to be what i dreamed a computer language should be. I shout to my son: "Come here quickly cause your daddy will teach you computer programmimg.!". But my honeymoon with Python had some problems. I wanted to program 2D games and there was no good GUI to do it. Then Ironpython shined in my life. Till then i had no idea of what .NET meant. I thought it was only a marketing performance of MS, weak in content. Well, i had difficoulties self-taughting me Python and .NET trhough the IronPython iterpreter and the complex ( for beginners) C# examples MSDN show. I had to translate them to IronPython - i got no idea i already had a C# compiler in my computer :P. Ahh.. and i was self-teaching GUI programming and OOP at the same time ( though i have to admit that my experiments with Java and C++ helpded a bit). For not be longer, i can tell that i felt in love with MSIL ( only wish it was more compact ), had sad deceptions with Python and ( you can laugh at will, i am newbie and probably don4t have a clue about what i am talking ), though i hate to use semi-colons all the time, the ugly brackets and the verbosity, i feel myself much more confortabe, pleased and safe writing in C# than in Python. I feel C# is more pythonic than Python after i had some introduction to the language. In Python my first program can be : print "this is my first program" Nothig can be simpler. But when i have to deal with classes. in C# i can use the intuitive, easy, friendly, etc... code like this... public class Verbs { string bother; string annoy; public Verbs() { this.annoy = "argh"; this.bother = "bargh"; } } and everything works fine. Well gentlemen, i am not here for complain about your job nor about IronPython. Indeed i am very glad of what you have done. I am bit sad because now i know that make Python perfect ( as i dreamed it should be) is not one of your goals. I understand that it is not your responsability. Thank you for your kind attention. _________________________________________________________________ MSN Messenger: instale gratis e converse com seus amigos. http://messenger.msn.com.br From ken.manheimer at gmail.com Wed Jun 21 03:06:15 2006 From: ken.manheimer at gmail.com (Ken Manheimer) Date: Tue, 20 Jun 2006 21:06:15 -0400 Subject: [IronPython] more pythonic than python ( continuation) In-Reply-To: References: Message-ID: <2cd46e7f0606201806o1087e6b1g6203f20fa0ca67b1@mail.gmail.com> On 6/20/06, fernando moreira wrote: > But what i would expect from a really pythonic interpreter is "He he he... > Another newbie that does not know strings are imutable. I am a very friendly > interpreter of a very intuitive language; ). So, behind the scenes i will > send the present string to trash after i create another one with the same > variable?s name. Thus the newbies will keep smiling and saying that python > rocks !" i think you need to distiguish between design choices and taste choices. when you make choices based on taste, you decide each case on what you would prefer, and sort things out later. when you make design choices, you balance the consequences or your choices against the other choices that need to be made. the art in language design is making choices that reconcile well with one another, and hopefully best satisfy the *needs* of the programmers most often. the most remarkable success of python, as a language, may be the degree to which it caters gracefully to a broad range of needs, even satisfying many tastes in the process. don't make the mistake of believing, though, that it was driven by those tastes. how do you distinguish a whim from a need? guido often asks, "what is it that you actually *need* to do?" are you actually struggling with a limitation that's preventing you from doing what your need, or is your answer, "it would just be nice", or "it's more pythonic". if it's just "nice" or "pythonic", he won't listen. if you can cite something practical that needs doing and can't be done without pain as things stand, then good language developers will listen, and help find a good solution if possible. they mostly pay attention to practice and consequences, not taste, and that's why python works well. (my experience is much more in design and development of applications than of languages, but this principle applies at least as well there. i've spent too much time developing a feature that was unnecessary, only to discover that i lost much more in the distortion of my application design than i gained in the extraneous feature, not to mention the waste of time spent on the feature development. i can only imagine how frustrating this could be in language development.) -- ken ken.manheimer at gmail.com http://myriadicity.net Python is an experiment in how much freedom programmers need. Too much freedom and nobody can read another's code; too little and expressiveness is endangered. -- Guido van Rossum, 13 Aug 1996 From joesox at gmail.com Wed Jun 21 06:21:11 2006 From: joesox at gmail.com (JoeSox) Date: Tue, 20 Jun 2006 21:21:11 -0700 Subject: [IronPython] Speed test In-Reply-To: <785694cd0604201028r60484797r4622ea4cc506b8a@mail.gmail.com> References: <785694cd0604191526u76be05aclc796996a4cc15229@mail.gmail.com> <4039D552ADAB094BB1EA670F3E96214E0285827E@df-foxhound-msg.exchange.corp.microsoft.com> <785694cd0604192227yd8831ceg2315cf4459c578da@mail.gmail.com> <785694cd0604201028r60484797r4622ea4cc506b8a@mail.gmail.com> Message-ID: <785694cd0606202121p540ad9k39d9dc6cc2038f86@mail.gmail.com> Just for kicks and giggles (not sure if its helpful but it is interesting, at least to me) here is a speed test using beta4 thru beta8, I ran them one after the other and posted the results below. But a short recap revealed that beta5 and 6 ran the fastest using IronPythonConsole.exe. I am not really sure why beta7 and 8 finished with slower times. beta4 sum = .82 beta5 sum = .38 beta6 sum = .38 beta7 sum = .57 beta8 sum = .43 IDLE 1.1.2 sum = .14 Wing IDE 2.1 sum = .24 >>On 4/19/06, Dino Viehland wrote: >> >>> I've opened a bug in our internal database to track the issue. I'm not sure when we'll get to looking at it just yet as it may be somewhat of an involved investigation. But at least we won't forget about it. >>> >>> If you could give us something that was nice and self contained then we might be able to get to it sooner. >>> >> >> >>Ok great. I think this will work. Here are the two files you will need: >>http://joeswammi.com/projects/CNUDB.py >>http://joeswammi.com/projects/machine_All.txt ==== IronPython 1.0.2262 (Beta[4]) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> import sys,time >>> sys.path.append('E:\\') >>> import CNUDB >>> cn=CNUDB.ConceptNetDB() >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.39', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.09', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.09', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.09', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.16', 'seconds. --\n') sum = .82 ==== ===== IronPython 1.0.2280 (Beta[5]) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> import sys,time >>> sys.path.append('E:\\') >>> import CNUDB >>> cn=CNUDB.ConceptNetDB() >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.17', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.06', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.05', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.05', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.05', 'seconds. --\n') sum = .38 ===== ====== IronPython 1.0.60420 (Beta[6]) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> import sys,time >>> sys.path.append('E:\\') >>> import CNUDB >>> cn=CNUDB.ConceptNetDB() >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.17', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.05', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.05', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.05', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.06', 'seconds. --\n') sum = .38 ====== ======= IronPython 1.0.60523 (Beta[7]) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> import sys,time >>> sys.path.append('E:\\') >>> import CNUDB >>> cn=CNUDB.ConceptNetDB() >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.34', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.06', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.06', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.06', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.05', 'seconds. --\n') sum = .57 ======= ======== IronPython 1.0.60619 (Beta[8]) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> import sys,time >>> sys.path.append('E:\\') >>> import CNUDB >>> cn=CNUDB.ConceptNetDB() >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.25', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.05', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.05', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.03', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.05', 'seconds. --\n') sum = .43 ======== *** IDLE 1.1.2 ==== No Subprocess ==== >>> import sys,time >>> sys.path.append('E:\\') >>> import CNUDB >>> cn=CNUDB.ConceptNetDB() >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.03', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.03', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.03', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.03', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.02', 'seconds. --\n') IDLE 1.1.2 sum = .14 *** **** Python 2.4.2[Wing IDE 2.1] (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] Type "help", "copyright", "credits" or "license" for more information. >>> import sys,time >>> sys.path.append('E:\\') >>> import CNUDB >>> cn=CNUDB.ConceptNetDB() >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.05', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.02', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.02', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.06', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.09', 'seconds. --\n') Wing IDE 2.1 sum = .24 **** -- Later, Joe From ralph.soons.asml at hotmail.com Wed Jun 21 09:49:12 2006 From: ralph.soons.asml at hotmail.com (Ralph Soons) Date: Wed, 21 Jun 2006 09:49:12 +0200 Subject: [IronPython] Remoting: Marshal object In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E03BC058471@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: In c# I have 3 assembly's. There's a server exe and a client exe and a library in which the remoting objects are implemented, which are included in both the client and the server. The CallbackSink class is situated in the library which has the namespace RemotingServerClient. I use server activated Singleton mode configuration. I would like to register on the OnHostToClient event at server side so any object registering for this event receives a notification when a client calls. My problem was that the object I registered my event to and the object which was called by the client weren't the same. So my registered event handlers weren't called. That's why I had to use the marshal function. Using the c# server and client this works. After this I replaced the c# server by a python server. I used the same configuration. Created an event handler function. Created the CallbackSink object (got an instance) and registered the event handler to it. Now I marshal the callbacksink object to make sure during a call from the client the same object is used. When I call my server in python from the c# client, the message is received in the Send function of the CallbackSink and if write the received message to the console I see the message appearing in the python console. However the CallbackSink object is newly created and isn't the object I marshalled in the python server. So it looks like the Marshal call doesn't work. I don't see any exception. Only thing I see is that the objects are different. >From: Dino Viehland >Reply-To: Discussion of IronPython >To: Discussion of IronPython >Subject: Re: [IronPython] Remoting: Marshal object >Date: Tue, 20 Jun 2006 09:05:07 -0700 > >I'm a little lost on this one - what is RemotingServerClient here? Is it a >type, an assembly, a namespace? > >Also, do you get an exception, or does it just do nothing? > >-----Original Message----- >From: users-bounces at lists.ironpython.com >[mailto:users-bounces at lists.ironpython.com] On Behalf Of Ralph Soons >Sent: Tuesday, June 20, 2006 8:04 AM >To: users at lists.ironpython.com >Subject: [IronPython] Remoting: Marshal object > >I have a remoting problem again. I want to create an object at server side, >as singleton so when a call is done at client side, ill get the already >existing object. I tried it first with a c# server and client. > >Can anyone tell me why the marshal function doesn't work, objects on server >and client side are still different (same code works in c# application so >configuration is correct): > >Client side (Python): >t = RemotingServerClient.CallbackSink.Instance >System.Runtime.Remoting.RemotingServices.Marshal(t, 'TalkIsGoodToo') > >Server side (c#): >CallbackSink.Instance.Send("Message"); > >Remotable object (c#): >public class CallbackSink : MarshalByRefObject > { > private static CallbackSink m_Instance = null; > public event delCommsInfo OnHostToClient; > > public static CallbackSink Instance > { > get > { > if (null == m_Instance) > { > m_Instance = new CallbackSink(); > } > return m_Instance; > } > } > > private CallbackSink() > { } > > public void Send(string message) > { > OnHostToClient(info); > } > } > >Thanks for your help. >Best regards, >Ralph Soons > >_________________________________________________________________ >Talk with your online friends with MSN Messenger >http://www.join.msn.com/messenger/overview > >_______________________________________________ >users mailing list >users at lists.ironpython.com >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >_______________________________________________ >users mailing list >users at lists.ironpython.com >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _________________________________________________________________ Talk with your online friends with MSN Messenger http://www.join.msn.com/messenger/overview From fclm1000 at msn.com Wed Jun 21 15:11:40 2006 From: fclm1000 at msn.com (fernando moreira) Date: Wed, 21 Jun 2006 10:11:40 -0300 Subject: [IronPython] more pythonic than python (end) Message-ID: Thanks again for your kind replies. "The biggest problem that I see in your line of thought is that many of the worst languages have gone down this route only to become a complete mess of random compiler-does-what-you-meant rules. In the end it just adds complexity and only helps out a few newbie's. " For sure, i don?t want nor like a messy language with thousands of features that would satisfy any randomic newbie wish. I want a compact, clean, robust, simple, coerent and friendly language: everything that Python promissed to be. Of course, such perfect language won?t 100% satisfy everybody, but then it will be a case of "Love it or leave it". "...guido often asks, "what is it that you actually *need* to do?" are you actually struggling with a limitation that's preventing you from doing what your need, or is your answer, "it would just be nice", or "it's more pythonic". if it's just "nice" or "pythonic", he won't listen." If i understand well, the good developers of the language have too much work to deal with changes that would fit in the fundamental principles over wich the language as prototyped (Zen of Python, for example) but are not indispensable for make a piece of code works. I think that it is a pity that they are too busy. I would like to emphasize that my first e-mail told about 2 examples of my own taste, but made mention about Python warts/gotchas/pitfalls described in some internet pages. Some of the features descibed there are already fixed or planned to be fixed soon. Still i feel that Pyhon 3000 won?t bring deeper changes as it could be. ;( I have nio more questions. Good luck and good work ! _________________________________________________________________ MSN Messenger: instale gr?tis e converse com seus amigos. http://messenger.msn.com.br From sh at defuze.org Wed Jun 21 15:27:53 2006 From: sh at defuze.org (Sylvain Hellegouarch) Date: Wed, 21 Jun 2006 14:27:53 +0100 (BST) Subject: [IronPython] more pythonic than python (end) In-Reply-To: References: Message-ID: <28164.194.221.74.7.1150896473.squirrel@mail1.webfaction.com> > For sure, i don?t want nor like a messy language with thousands of > features that would satisfy any randomic newbie wish. I want a compact, > clean, robust, simple, coerent and friendly language: everything that > Python > promissed to be. Of course, such perfect language won?t 100% satisfy > everybody, but then it will be a case of "Love it or leave it". It is interesting that you claim promises to have all the features you listed and yet you think it should break those features to be nice to newbies. As stated what you suggested is a matter of taste, therefore little long term value for the community. I remember one of my first wish I sent to the Python community (sadly I sent it on the python-dev list and got [rightly] kicked out) was to add a new keyword "Empty" because I found that None was sometimes semantically unclear in some contexts. In the end a few developers explained what I wanted was syntaxic sugar which added no value to the language itself. They were right. > If i understand well, the good developers of the language have too much > work to deal with changes that would fit in the fundamental principles > over > wich the language as prototyped (Zen of Python, for example) but are not > indispensable for make a piece of code works. I think that it is a pity > that they are too busy. I don't think you understood correctly. They won't do what you suggest because they are too busy but because they don't believe it would add any value, and since the language already allows you to achieve it, why should they spend time on it? - Sylvain From dinov at exchange.microsoft.com Wed Jun 21 16:48:15 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Wed, 21 Jun 2006 07:48:15 -0700 Subject: [IronPython] Speed test In-Reply-To: <785694cd0606202121p540ad9k39d9dc6cc2038f86@mail.gmail.com> References: <785694cd0604191526u76be05aclc796996a4cc15229@mail.gmail.com> <4039D552ADAB094BB1EA670F3E96214E0285827E@df-foxhound-msg.exchange.corp.microsoft.com> <785694cd0604192227yd8831ceg2315cf4459c578da@mail.gmail.com> <785694cd0604201028r60484797r4622ea4cc506b8a@mail.gmail.com> <785694cd0606202121p540ad9k39d9dc6cc2038f86@mail.gmail.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03DBCDC88F@df-foxhound-msg.exchange.corp.microsoft.com> Very interesting! There have been a few fixes that have gone in that have caused performance in certain areas to degrade slightly. The top one that comes to mind is in dealing w/ operator equals we used to check object equality before doing anything else, which unfortunately was wrong. We'll have another look at performance after we ship 1.0 - as we're finalizing things we're focused primarily on correctness. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of JoeSox Sent: Tuesday, June 20, 2006 9:21 PM To: Discussion of IronPython Subject: Re: [IronPython] Speed test Just for kicks and giggles (not sure if its helpful but it is interesting, at least to me) here is a speed test using beta4 thru beta8, I ran them one after the other and posted the results below. But a short recap revealed that beta5 and 6 ran the fastest using IronPythonConsole.exe. I am not really sure why beta7 and 8 finished with slower times. beta4 sum = .82 beta5 sum = .38 beta6 sum = .38 beta7 sum = .57 beta8 sum = .43 IDLE 1.1.2 sum = .14 Wing IDE 2.1 sum = .24 >>On 4/19/06, Dino Viehland wrote: >> >>> I've opened a bug in our internal database to track the issue. I'm not sure when we'll get to looking at it just yet as it may be somewhat of an involved investigation. But at least we won't forget about it. >>> >>> If you could give us something that was nice and self contained then we might be able to get to it sooner. >>> >> >> >>Ok great. I think this will work. Here are the two files you will need: >>http://joeswammi.com/projects/CNUDB.py >>http://joeswammi.com/projects/machine_All.txt ==== IronPython 1.0.2262 (Beta[4]) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> import sys,time >>> sys.path.append('E:\\') >>> import CNUDB >>> cn=CNUDB.ConceptNetDB() >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.39', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.09', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.09', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.09', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.16', 'seconds. --\n') sum = .82 ==== ===== IronPython 1.0.2280 (Beta[5]) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> import sys,time >>> sys.path.append('E:\\') >>> import CNUDB >>> cn=CNUDB.ConceptNetDB() >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.17', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.06', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.05', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.05', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.05', 'seconds. --\n') sum = .38 ===== ====== IronPython 1.0.60420 (Beta[6]) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> import sys,time >>> sys.path.append('E:\\') >>> import CNUDB >>> cn=CNUDB.ConceptNetDB() >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.17', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.05', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.05', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.05', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.06', 'seconds. --\n') sum = .38 ====== ======= IronPython 1.0.60523 (Beta[7]) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> import sys,time >>> sys.path.append('E:\\') >>> import CNUDB >>> cn=CNUDB.ConceptNetDB() >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.34', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.06', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.06', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.06', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.05', 'seconds. --\n') sum = .57 ======= ======== IronPython 1.0.60619 (Beta[8]) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> import sys,time >>> sys.path.append('E:\\') >>> import CNUDB >>> cn=CNUDB.ConceptNetDB() >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.25', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.05', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.05', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.03', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.05', 'seconds. --\n') sum = .43 ======== *** IDLE 1.1.2 ==== No Subprocess ==== >>> import sys,time >>> sys.path.append('E:\\') >>> import CNUDB >>> cn=CNUDB.ConceptNetDB() >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.03', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.03', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.03', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.03', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.02', 'seconds. --\n') IDLE 1.1.2 sum = .14 *** **** Python 2.4.2[Wing IDE 2.1] (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] Type "help", "copyright", "credits" or "license" for more information. >>> import sys,time >>> sys.path.append('E:\\') >>> import CNUDB >>> cn=CNUDB.ConceptNetDB() >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.05', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.02', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.02', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.06', 'seconds. --\n') >>> cn.test('E:\\machine_All.txt') ('-- test took', '0.09', 'seconds. --\n') Wing IDE 2.1 sum = .24 **** -- Later, Joe _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From andrzej.krzywda at resolversystems.com Wed Jun 21 18:51:53 2006 From: andrzej.krzywda at resolversystems.com (Andrzej Krzywda) Date: Wed, 21 Jun 2006 17:51:53 +0100 Subject: [IronPython] CallTarget0 Message-ID: <44997929.5070805@resolversystems.com> Hi, We are in the process of upgrading an application from IronPython Beta 5 to Beta 8. Previously it would execute certain functions on the thread belonging to our GUI controls: def DoSomething() pass form.Invoke(CallTarget0(DoSomething)) In beta 8, the CallTarget0 class has been removed - what should we replace it with? We tried simply passing the function to the Invoke() method, but this failed with "SystemError: Object reference not set to an instance of an object." Regards, Andrzej Krzywda From dinov at exchange.microsoft.com Wed Jun 21 18:58:24 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Wed, 21 Jun 2006 09:58:24 -0700 Subject: [IronPython] CallTarget0 In-Reply-To: <44997929.5070805@resolversystems.com> References: <44997929.5070805@resolversystems.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03DBCDC98E@df-foxhound-msg.exchange.corp.microsoft.com> CallTarget0 has actually just moved to IronPython.Runtime.Calls (we used to have over 200 classes in IronPython.Runtime which was just too many). The exception you're getting is still potentially interesting - could you send us the stack trace when running w/ -X:ExceptionDetail ? -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Andrzej Krzywda Sent: Wednesday, June 21, 2006 9:52 AM To: users at lists.ironpython.com Subject: [IronPython] CallTarget0 Hi, We are in the process of upgrading an application from IronPython Beta 5 to Beta 8. Previously it would execute certain functions on the thread belonging to our GUI controls: def DoSomething() pass form.Invoke(CallTarget0(DoSomething)) In beta 8, the CallTarget0 class has been removed - what should we replace it with? We tried simply passing the function to the Invoke() method, but this failed with "SystemError: Object reference not set to an instance of an object." Regards, Andrzej Krzywda _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From andrzej.krzywda at resolversystems.com Wed Jun 21 19:05:57 2006 From: andrzej.krzywda at resolversystems.com (Andrzej Krzywda) Date: Wed, 21 Jun 2006 18:05:57 +0100 Subject: [IronPython] CallTarget0 In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E03DBCDC98E@df-foxhound-msg.exchange.corp.microsoft.com> References: <44997929.5070805@resolversystems.com> <4039D552ADAB094BB1EA670F3E96214E03DBCDC98E@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <44997C75.509@resolversystems.com> Thanks Dino. Here is the actual stack trace: >>> form.Invoke(DoSomething) Object reference not set to an instance of an object. at IronPython.Runtime.Operations.Ops.GetDelegate(Object o, Type delegateType) at IronPython.Runtime.Converter.TryConvertToDelegate(Object value, Type to, C onversion& conversion) at IronPython.Runtime.Converter.ConvertToDelegate(Object value, Type to) at IronPython.Runtime.NewConverter.ConvertToDelegate(Object o, Type t) at Invoke##18(ICallerContext , Object , Object ) at IronPython.Runtime.Calls.CallTargetWithContext2.Invoke(ICallerContext cont ext, Object arg0, Object arg1) at IronPython.Runtime.Calls.FastCallableWithContextAny.CallInstance(ICallerCo ntext context, Object arg0, Object arg1) at IronPython.Runtime.Calls.BoundBuiltinFunction.Call(ICallerContext context, Object arg0) at IronPython.Runtime.Operations.Ops.CallWithContext(ICallerContext context, Object func, Object arg0) at ##17(ModuleScope ) at IronPython.Runtime.CompiledCodeDelegate.Invoke(ModuleScope moduleScope) at IronPython.Runtime.CompiledCode.Run(ModuleScope moduleScope) at IronPython.Hosting.PythonEngine.ExecuteToConsole(String text, ModuleScope defaultScope) at IronPythonConsole.PythonCommandLine.DoOneInteractive(ModuleScope topFrame) at IronPythonConsole.PythonCommandLine.b__6(Boolean& cont inueInteractionArgument) at IronPythonConsole.PythonCommandLine.TryInteractiveAction(InteractiveAction interactiveAction, Boolean& continueInteraction) SystemError: Object reference not set to an instance of an object. >>> Dino Viehland wrote: > CallTarget0 has actually just moved to IronPython.Runtime.Calls (we used to have over 200 classes in IronPython.Runtime which was just too many). > > The exception you're getting is still potentially interesting - could you send us the stack trace when running w/ -X:ExceptionDetail ? > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Andrzej Krzywda > Sent: Wednesday, June 21, 2006 9:52 AM > To: users at lists.ironpython.com > Subject: [IronPython] CallTarget0 > > Hi, > > We are in the process of upgrading an application from IronPython Beta 5 to Beta 8. Previously it would execute certain functions on the thread belonging to our GUI controls: > > def DoSomething() > pass > > form.Invoke(CallTarget0(DoSomething)) > > In beta 8, the CallTarget0 class has been removed - what should we replace it with? We tried simply passing the function to the Invoke() method, but this failed with "SystemError: Object reference not set to an instance of an object." > > > Regards, > > Andrzej Krzywda > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > From dinov at exchange.microsoft.com Wed Jun 21 19:16:53 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Wed, 21 Jun 2006 10:16:53 -0700 Subject: [IronPython] CallTarget0 In-Reply-To: <44997C75.509@resolversystems.com> References: <44997929.5070805@resolversystems.com> <4039D552ADAB094BB1EA670F3E96214E03DBCDC98E@df-foxhound-msg.exchange.corp.microsoft.com> <44997C75.509@resolversystems.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03DBCDC9BA@df-foxhound-msg.exchange.corp.microsoft.com> Thanks for the stack trace. I've opened CodePlex bug 537 to track the issue. We should fail much more gracefully here. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Andrzej Krzywda Sent: Wednesday, June 21, 2006 10:06 AM To: Discussion of IronPython Subject: Re: [IronPython] CallTarget0 Thanks Dino. Here is the actual stack trace: >>> form.Invoke(DoSomething) Object reference not set to an instance of an object. at IronPython.Runtime.Operations.Ops.GetDelegate(Object o, Type delegateType) at IronPython.Runtime.Converter.TryConvertToDelegate(Object value, Type to, C onversion& conversion) at IronPython.Runtime.Converter.ConvertToDelegate(Object value, Type to) at IronPython.Runtime.NewConverter.ConvertToDelegate(Object o, Type t) at Invoke##18(ICallerContext , Object , Object ) at IronPython.Runtime.Calls.CallTargetWithContext2.Invoke(ICallerContext cont ext, Object arg0, Object arg1) at IronPython.Runtime.Calls.FastCallableWithContextAny.CallInstance(ICallerCo ntext context, Object arg0, Object arg1) at IronPython.Runtime.Calls.BoundBuiltinFunction.Call(ICallerContext context, Object arg0) at IronPython.Runtime.Operations.Ops.CallWithContext(ICallerContext context, Object func, Object arg0) at ##17(ModuleScope ) at IronPython.Runtime.CompiledCodeDelegate.Invoke(ModuleScope moduleScope) at IronPython.Runtime.CompiledCode.Run(ModuleScope moduleScope) at IronPython.Hosting.PythonEngine.ExecuteToConsole(String text, ModuleScope defaultScope) at IronPythonConsole.PythonCommandLine.DoOneInteractive(ModuleScope topFrame) at IronPythonConsole.PythonCommandLine.b__6(Boolean& cont inueInteractionArgument) at IronPythonConsole.PythonCommandLine.TryInteractiveAction(InteractiveAction interactiveAction, Boolean& continueInteraction) SystemError: Object reference not set to an instance of an object. >>> Dino Viehland wrote: > CallTarget0 has actually just moved to IronPython.Runtime.Calls (we used to have over 200 classes in IronPython.Runtime which was just too many). > > The exception you're getting is still potentially interesting - could you send us the stack trace when running w/ -X:ExceptionDetail ? > > -----Original Message----- > From: users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] On Behalf Of Andrzej > Krzywda > Sent: Wednesday, June 21, 2006 9:52 AM > To: users at lists.ironpython.com > Subject: [IronPython] CallTarget0 > > Hi, > > We are in the process of upgrading an application from IronPython Beta 5 to Beta 8. Previously it would execute certain functions on the thread belonging to our GUI controls: > > def DoSomething() > pass > > form.Invoke(CallTarget0(DoSomething)) > > In beta 8, the CallTarget0 class has been removed - what should we replace it with? We tried simply passing the function to the Invoke() method, but this failed with "SystemError: Object reference not set to an instance of an object." > > > Regards, > > Andrzej Krzywda > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From Shri.Borde at microsoft.com Wed Jun 21 21:00:08 2006 From: Shri.Borde at microsoft.com (Shri Borde) Date: Wed, 21 Jun 2006 12:00:08 -0700 Subject: [IronPython] OnVarChanged In-Reply-To: <20060620180431.670261BA6C@che.dreamhost.com> Message-ID: You should be able to declare a type that inherits from ModuleScope, and override ModuleScope.Get/SetGlobal. That should be the hook you need. Then you can use engine.Execute("a=1", myCustomModuleScope). Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038) -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of John Mancine Sent: Tuesday, June 20, 2006 11:05 AM To: 'Discussion of IronPython' Subject: Re: [IronPython] OnVarChanged Thanks for the info. I think I have found what I was looking for now. Basically, this is the earliest breakpoint that I hit after returning from the [Lightweight Function] on the call stack after engine.Execute("a=1") is called. IronPython.Runtime.ModuleScope.SetLocal(SymbolId symbol, object value) Sure looks promising at least. The symbol is 'a' and the value is '1'. I also found a IronPython.Runtime.Operations.Ups.MakeClass() call which should be helpful for hooking into class declarations. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Tuesday, June 20, 2006 11:59 AM > To: Discussion of IronPython > Subject: Re: [IronPython] OnVarChanged > > John Mancine wrote: > > I realize this is likely woefully na?ve but I thought I'd ask anyhow. > > > > I have a very specific case in my project where I would really like to > know > > when a variable inside IronPython changes. Basically when I do this: > > > > pythonEngine.Execute("a = 3"); // Or something more complex that ends up > > changing global var 'a' > > > > I am looking for a way to be notified when 'a' has been assigned to a > new > > value. This seems to be pretty simple for the Set/GetGlobal() calls but > what > > about code that is inside of the Execute() block? Where could I look at > > adding some code myself such that I can add these hooks? I have dug > through > > some of the code to find a place to add a hook but I couldn't seem to > find > > anything clear cut. > > > > Again, I realize this is pretty simplistic and also painfully slow for > any > > moderate scripting but I have a very specific case where I would like > some > > widgets in C# to respond to when a variable has changed. (The > watchwindow in > > visual studio would be a good parallel of what I'm needing to do -- ie. > show > > a new value has been set for a particular value you are watching). > > > > > Hello John, > > I may be off beam here (I'm no C# expert and know little about the > IronPython internals) but it sounds like what you want to do is a bit at > conflict with the way Python works. > > Python doesn't have variables by value as such, it has names and objects. > > In your example, 'a' isn't an object, it's a name bound to an object. > > When you do : > > a = 1 > a = 2 > > it's not that the value of a changes, instead the name is rebound to a > different object. Tracking changes to a mutable object is one thing, but > tracking name binding is a different thing altogether. > > Perhaps you could replace the ``__dict__`` attribute of a module (where > names are stored) with a custom 'dictionary-like' object, that calls a > callback when assignments are made ? A better approach would be to use a > value on an object (instead of a local variable), and you can get that > object to perform a callback when changes are made. > > All the best, > > Fuzzyman > http://www.voidspace.org.uk/python/index.shtml > > > Thanks! > > John > > > > _______________________________________________ > > users mailing list > > users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From john at emergentlifetech.com Wed Jun 21 21:49:55 2006 From: john at emergentlifetech.com (John Mancine) Date: Wed, 21 Jun 2006 14:49:55 -0500 Subject: [IronPython] getaddr() support? Message-ID: <20060621195004.4826A1BB86@che.dreamhost.com> I noticed that I can now import urrlib, but upon using urllib.urlopen() I get an error that "getaddr()" is not currently implemented. Any idea when we might see this? Thanks, John From sh at defuze.org Wed Jun 21 22:25:09 2006 From: sh at defuze.org (Sylvain Hellegouarch) Date: Wed, 21 Jun 2006 21:25:09 +0100 Subject: [IronPython] IRC channel Message-ID: <4499AB25.2080604@defuze.org> Hi folks, I was wondering if you'd be interested in meeting in an IRC channel to know each other a bit more and well alternatively answer IP related questions :) Network: Freenode Server: irc.freenode.net Channel: #ironpython I have registered the channel and my nickname is Lawouach. Hope to see you there soon, - Sylvain http://www.defuze.org From t-bruch at microsoft.com Wed Jun 21 22:25:12 2006 From: t-bruch at microsoft.com (Bruce Christensen) Date: Wed, 21 Jun 2006 13:25:12 -0700 Subject: [IronPython] getaddr() support? In-Reply-To: <20060621195004.4826A1BB86@che.dreamhost.com> References: <20060621195004.4826A1BB86@che.dreamhost.com> Message-ID: <3581AA168D87A2479D88EA319BDF7D329DF36A@RED-MSG-80.redmond.corp.microsoft.com> John, Thanks for the report. This is a known problem. As noted in socket.__doc__, there are a functions in socket that we don't currently implement: This implementation of socket differs slightly from the standard CPython socket module. Many of these differences are due to the implementation of the .NET socket libraries. These differences are summarized below. For full details, check the docstrings of the functions mentioned. In this case, the .NET network API (upon which IronPython's socket module is built) provides no getaddrinfo() function for us to build on, so we don't export one to Python. We considered writing own version of it, but we didn't have time to get it right before we released. Rather than introducing subtle incompatibilities, we just left out the feature. I've filed CodePlex bug 548 to track this. --Bruce -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of John Mancine Sent: Wednesday, June 21, 2006 12:50 PM To: 'Discussion of IronPython' Subject: [IronPython] getaddr() support? I noticed that I can now import urrlib, but upon using urllib.urlopen() I get an error that "getaddr()" is not currently implemented. Any idea when we might see this? Thanks, John _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From john at emergentlifetech.com Wed Jun 21 21:22:49 2006 From: john at emergentlifetech.com (John Mancine) Date: Wed, 21 Jun 2006 14:22:49 -0500 Subject: [IronPython] OnVarChanged In-Reply-To: Message-ID: <20060621214916.00ABE1BBC5@che.dreamhost.com> Shri, Thanks for the advice, but I actually noticed that when I do.. pyEngine.Execute("a=1"), I do not in fact hit ModuleScope.SetGlobal(), but I do however hit ModuleScope.SetLocal(). Care to shed some light on this? I am a bit lost as to what IronPython means by 'local' and 'global' as it seems like they are very close to the same thing in the sense that I can do engine.SetGlobal("a", 1) or engine.Execute("a=1") and basically do the same thing but one goes through SetGlobal() and one goes through SetLocal(). Take care, John > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Shri Borde > Sent: Wednesday, June 21, 2006 2:00 PM > To: Discussion of IronPython > Subject: Re: [IronPython] OnVarChanged > > You should be able to declare a type that inherits from ModuleScope, and > override ModuleScope.Get/SetGlobal. That should be the hook you need. Then > you can use engine.Execute("a=1", myCustomModuleScope). > > Do you want to help develop Dynamic languages on CLR? > (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE- > 11F0-45DF-8B78-DC1B43134038) > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of John Mancine > Sent: Tuesday, June 20, 2006 11:05 AM > To: 'Discussion of IronPython' > Subject: Re: [IronPython] OnVarChanged > > Thanks for the info. > > I think I have found what I was looking for now. Basically, this is the > earliest breakpoint that I hit after returning from the [Lightweight > Function] on the call stack after engine.Execute("a=1") is called. > > IronPython.Runtime.ModuleScope.SetLocal(SymbolId symbol, object value) > > Sure looks promising at least. The symbol is 'a' and the value is '1'. > > I also found a IronPython.Runtime.Operations.Ups.MakeClass() call which > should be helpful for hooking into class declarations. > > > -----Original Message----- > > From: users-bounces at lists.ironpython.com [mailto:users- > > bounces at lists.ironpython.com] On Behalf Of Michael Foord > > Sent: Tuesday, June 20, 2006 11:59 AM > > To: Discussion of IronPython > > Subject: Re: [IronPython] OnVarChanged > > > > John Mancine wrote: > > > I realize this is likely woefully na?ve but I thought I'd ask anyhow. > > > > > > I have a very specific case in my project where I would really like to > > know > > > when a variable inside IronPython changes. Basically when I do this: > > > > > > pythonEngine.Execute("a = 3"); // Or something more complex that ends > up > > > changing global var 'a' > > > > > > I am looking for a way to be notified when 'a' has been assigned to a > > new > > > value. This seems to be pretty simple for the Set/GetGlobal() calls > but > > what > > > about code that is inside of the Execute() block? Where could I look > at > > > adding some code myself such that I can add these hooks? I have dug > > through > > > some of the code to find a place to add a hook but I couldn't seem to > > find > > > anything clear cut. > > > > > > Again, I realize this is pretty simplistic and also painfully slow for > > any > > > moderate scripting but I have a very specific case where I would like > > some > > > widgets in C# to respond to when a variable has changed. (The > > watchwindow in > > > visual studio would be a good parallel of what I'm needing to do -- > ie. > > show > > > a new value has been set for a particular value you are watching). > > > > > > > > Hello John, > > > > I may be off beam here (I'm no C# expert and know little about the > > IronPython internals) but it sounds like what you want to do is a bit at > > conflict with the way Python works. > > > > Python doesn't have variables by value as such, it has names and > objects. > > > > In your example, 'a' isn't an object, it's a name bound to an object. > > > > When you do : > > > > a = 1 > > a = 2 > > > > it's not that the value of a changes, instead the name is rebound to a > > different object. Tracking changes to a mutable object is one thing, but > > tracking name binding is a different thing altogether. > > > > Perhaps you could replace the ``__dict__`` attribute of a module (where > > names are stored) with a custom 'dictionary-like' object, that calls a > > callback when assignments are made ? A better approach would be to use a > > value on an object (instead of a local variable), and you can get that > > object to perform a callback when changes are made. > > > > All the best, > > > > Fuzzyman > > http://www.voidspace.org.uk/python/index.shtml > > > > > Thanks! > > > John > > > > > > _______________________________________________ > > > users mailing list > > > users at lists.ironpython.com > > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > > > > > _______________________________________________ > > users mailing list > > users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From john at emergentlifetech.com Wed Jun 21 22:43:03 2006 From: john at emergentlifetech.com (John Mancine) Date: Wed, 21 Jun 2006 15:43:03 -0500 Subject: [IronPython] OnVarChanged() - Repost Message-ID: <20060621221403.1DCB81BB8D@che.dreamhost.com> -- I'm reposting this because I saw that it didn't show up on my list. I apologize if this turns into a dupe. -- Shri, Thanks for the advice, but I actually noticed that when I do... pyEngine.Execute("a=1"), I do not in fact hit ModuleScope.SetGlobal(), but I do however hit ModuleScope.SetLocal(). I took your advice though and I extended ModuleScope, but I found I had to override both SetGlobal and SetLocal to catch all cases which works fine, but I feel like I'm shooting in the dark a bit since I don't have a clear understanding as to what the two versions are really for. Care to shed some light on this? I am a bit lost as to what IronPython means by 'local' and 'global' as it seems like they are very close to the same thing in the sense that I can do engine.SetGlobal("a", 1) or engine.Execute("a=1") and basically do the same thing but one goes through SetGlobal() and one goes through SetLocal(). Take care, John > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Shri Borde > Sent: Wednesday, June 21, 2006 2:00 PM > To: Discussion of IronPython > Subject: Re: [IronPython] OnVarChanged > > You should be able to declare a type that inherits from ModuleScope, > and override ModuleScope.Get/SetGlobal. That should be the hook you > need. Then you can use engine.Execute("a=1", myCustomModuleScope). > From fclm1000 at msn.com Wed Jun 21 20:09:21 2006 From: fclm1000 at msn.com (fernando moreira) Date: Wed, 21 Jun 2006 15:09:21 -0300 Subject: [IronPython] more pythonic than python ( end - REALLY) Message-ID: First of all, i want to APOLOGIZE for still being here. My posts and their replies went out of topic and are not contributing for the development of IronPython. So, this is my last post here. To anyone who wants to show me my mistakes, i beg to point another forum where i would gladly reply (or send me an e-mail). One thing that i would like to be clear is that i am glad for any effort of the open source community - does not matter if the sofware is or is not how i think it should be. I have a strong sympathy for their (yours) works. ;) """ >For sure, i don?t want nor like a messy language with thousands of features >that would satisfy any randomic newbie wish. I want a compact, > clean, robust, simple, coerent and friendly language: everything that >Python promissed to be. Of course, such perfect language won?t 100% >satisfy everybody, but then it will be a case of "Love it or leave it". It is interesting that you claim promises to have all the features you listed and yet you think it should break those features to be nice to newbies. As stated what you suggested is a matter of taste, therefore little long term value for the community. """ I know that my english is far from perfect, but i think that my lines above were of easy understanding. Anyway i will try to explain more. My point is (and was) that any language that is compact, robust, simple, clean, etc... is the best thing a newbie (and veterans probably) would like to have. Thus, there would be no need, nor room neither sense for idiosyncratic annoying new features. I wrote very clear : *then it will be a case of "Love it or leave it".* I did not write *then you love it and keep claiminig for new features*. Of course, i don?t think Python is compact, simple, pythonic, robust, etc.. as soon as i go a step deep inside it, except, obviouslly, when compared to C++ for example. """ >If i understand well, the good developers of the language have too much >work to deal with changes that would fit in the fundamental principles over > wich the language as prototyped (Zen of Python, for example) but are not >indispensable for make a piece of code works. I think that it is a pity >that they are too busy. I don't think you understood correctly. They won't do what you suggest because they are too busy but because they don't believe it would add any value, and since the language already allows you to achieve it, why should they spend time on it? """ My original post here was never about change Python. I was only asking if the IronPython team, had any project for start a NEW language, more pythonic than Python, after they finnish their present work. When i wrote "the good developers of the language" i was NEVER talking about IronPython team. I was replying an e-mail that used exactly theese words and referred the "Benevolent Dictator For Life" (strange title, heh ?). And for all that i read inside and outside python.org i would never spend my time sugesting anything to them. The point is not "how i think Python should be by my own concepts". The point is "how i think Python should be by it's concepts on it's own white paper (or something like that). Of course, there still room for my subjectivity, but i think i am being neutral. ( I am talking about the language in general. I am not insisting about strings operation).. Specifically answering your question about why should they spend time with features that don?t add any value since language already allows someone to achieve a task, i say : EVOLUTION. I mean if the language is more expressive, less error prone, increases protuctivity, etc., with a new feature or the extinguishment of an old feature; than this change ADDS SOME VALUE to the language. If things were not this way you were not talking about python now, but about C or assembly ( they can do OOP too ) or straight machine code :p. Well, as said before, this is my last post here about this matter. I leave with the same ideas i had when i came. Thank you all. Good luck and good work ! _________________________________________________________________ MSN Messenger: instale gr?tis e converse com seus amigos. http://messenger.msn.com.br From mbarnett at uniserve.com Thu Jun 22 06:10:41 2006 From: mbarnett at uniserve.com (Lesley & Mitch Barnett) Date: Wed, 21 Jun 2006 21:10:41 -0700 Subject: [IronPython] embedding IP in C# Windows .NET GUI In-Reply-To: <785694cd0606200624p25718ce2n449b5453c0d1cdbf@mail.gmail.com> Message-ID: <000801c695b1$d39a4290$6401a8c0@NIS1861127372> Thanks Joe! -----Original Message----- From: JoeSox [mailto:joesox at gmail.com] Sent: June 20, 2006 6:24 AM To: Discussion of IronPython Subject: Re: [IronPython] embedding IP in C# Windows .NET GUI On 6/19/06, Lesley & Mitch Barnett wrote: > Hi, > > I am trying to embed IP in my C# .NET Windows app with limited success. The > closest to what I am looking for is this: > > http://lists.ironpython.com/pipermail/users-ironpython.com/2006-April/002205 > .html > > But could not get it to work... > > I am looking to embed a single RichTextBox for both I/O and the RichTextBox > embedded in the main window form (not MDI). > > Has anyone had success in doing this? And willing to share some code? > > Thanks in advance, I wrote "IronTextBox" http://codeproject.com/useritems/irontextbox.asp The full source and .dll may be downloaded there. I wrote it as I was first learning IronPython so it was kind of pieced together but anyone can easily drop the box into a form if referenced properly in Visual Studio. I have looked in the code in months and haven't tested it with any versions of IronPython above beta6 if I remember correctly. I don't think I actually used a RichTextBox because I didn't feel like messing around (and learning) Rtf. Later, Joe From Shri.Borde at microsoft.com Thu Jun 22 08:31:41 2006 From: Shri.Borde at microsoft.com (Shri Borde) Date: Wed, 21 Jun 2006 23:31:41 -0700 Subject: [IronPython] OnVarChanged() - Repost In-Reply-To: <20060621221403.1DCB81BB8D@che.dreamhost.com> Message-ID: Sorry, only ModuleScope.GetGlobal can be overriden. For now, SetLocal is the best hook for you. Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038) -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of John Mancine Sent: Wednesday, June 21, 2006 1:43 PM To: 'Discussion of IronPython' Subject: Re: [IronPython] OnVarChanged() - Repost -- I'm reposting this because I saw that it didn't show up on my list. I apologize if this turns into a dupe. -- Shri, Thanks for the advice, but I actually noticed that when I do... pyEngine.Execute("a=1"), I do not in fact hit ModuleScope.SetGlobal(), but I do however hit ModuleScope.SetLocal(). I took your advice though and I extended ModuleScope, but I found I had to override both SetGlobal and SetLocal to catch all cases which works fine, but I feel like I'm shooting in the dark a bit since I don't have a clear understanding as to what the two versions are really for. Care to shed some light on this? I am a bit lost as to what IronPython means by 'local' and 'global' as it seems like they are very close to the same thing in the sense that I can do engine.SetGlobal("a", 1) or engine.Execute("a=1") and basically do the same thing but one goes through SetGlobal() and one goes through SetLocal(). Take care, John > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Shri Borde > Sent: Wednesday, June 21, 2006 2:00 PM > To: Discussion of IronPython > Subject: Re: [IronPython] OnVarChanged > > You should be able to declare a type that inherits from ModuleScope, > and override ModuleScope.Get/SetGlobal. That should be the hook you > need. Then you can use engine.Execute("a=1", myCustomModuleScope). > _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From KBjorke at nvidia.com Thu Jun 22 11:38:58 2006 From: KBjorke at nvidia.com (Kevin Bjorke) Date: Thu, 22 Jun 2006 02:38:58 -0700 Subject: [IronPython] How to get System.Single[]? Message-ID: <590FCAE72E27D54CA1EADE7293BB444F04422AD1@hqemmail04.nvidia.com> I need to create a list of Singles to use System.Drawing.Darwing2D.ColorBlend's Position member. Color me ignorant, but how can I create such a thing? I can't just pass a list of floats ----------------------------------------------------------------------------------- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ----------------------------------------------------------------------------------- From korpse-ironpython at kaydash.za.net Thu Jun 22 12:27:52 2006 From: korpse-ironpython at kaydash.za.net (Jonathan Jacobs) Date: Thu, 22 Jun 2006 12:27:52 +0200 Subject: [IronPython] How to get System.Single[]? In-Reply-To: <590FCAE72E27D54CA1EADE7293BB444F04422AD1@hqemmail04.nvidia.com> References: <590FCAE72E27D54CA1EADE7293BB444F04422AD1@hqemmail04.nvidia.com> Message-ID: <449A70A8.9080409@kaydash.za.net> Kevin Bjorke wrote: > I need to create a list of Singles to use > System.Drawing.Darwing2D.ColorBlend's Position member. Color me > ignorant, but how can I create such a thing? I can't just pass a list of > floats It would be convenient to pass a tuple of floats, too bad this doesn't work. You can use System.Array.CreateInstance to create a Single[]: >>> System.Array.CreateInstance(System.Single, 3) System.Single[](0.0, 0.0, 0.0) Hope this helps. -- Jonathan From michael.foord at resolversystems.com Thu Jun 22 13:12:37 2006 From: michael.foord at resolversystems.com (Michael Foord) Date: Thu, 22 Jun 2006 12:12:37 +0100 Subject: [IronPython] Code Coverage Message-ID: <449A7B25.3030308@resolversystems.com> Hello all, I've been looking at code coverage tools for Python, as we would like to check the coverage of our unit tests. Unfortunately all the Python code coverage tools use ``sys.settrace`` which isn't implemented in IronPython. This (I guess) is because Python stack frames and code objects aren't used in IronPython. Unfortunately this makes coverage tools impossible (or just very difficult), unless an alternative mechanism is provided. (They also tend to use the parser module which is another issue.) I browsed the IronPython source (is there an API doc ?) but couldn't see anything useful to get a callback as new source-code lines are entered. Line information is obviously *somewhere*, as it is presented in traceback information. Two alternative ideas. 1) Implement a 'cut down' version of sys.settrace which only implements what is possible. For sys.settrace - see http://docs.python.org/lib/debugger-hooks.html#debugger-hooks coverage.py is one of the most common tools : http://www.nedbatchelder.com/code/modules/coverage.html It uses settrace with the following function : def t(f, x, y): c[(f.f_code.co_filename, f.f_lineno)] = 1 return t So it only uses a filename reference from the code object and the line_no from the frame. Either dummy objects could be constructed, or an IronPython specific implementation could be made which presents this information directly. 2) Alternatively a callback hook on the C# side could be implemented, so that as IronPython enters a new line we could cache this information - and generate a report once execution has stopped. Either of these would be much appreciated. All the best, Michael Foord http://www.resolversystems.com http://www.voidspace.org.uk/python/index.shtml From michael.foord at resolversystems.com Thu Jun 22 13:33:11 2006 From: michael.foord at resolversystems.com (Michael Foord) Date: Thu, 22 Jun 2006 12:33:11 +0100 Subject: [IronPython] Empty Module Contents Message-ID: <449A7FF7.7080100@resolversystems.com> Hello all, There is a difference between the contents of an empty module (or any other module for that matter) in CPython and IronPython. This is possibly an implementation detail, but it causes PyChecker to crash so I thought I'd report it. (Tested in Beta 8.) Create an empty file called 'empty_module.py' then import it and run the following : CPython >>> import empty_module >>> vars(empty_module).keys() ['__builtins__', '__name__', '__file__', '__doc__'] >>> IronPython >>> import empty_module >>> vars(empty_module).keys() ['__doc__', '__name__', None, '__builtins__', '__file__', '__str__', '__repr__', '__new__', '__init__', '__module__'] >>> It is (so far) specifically the presence of None that is problematic for me, so I'm building workarounds. All the best, Michael Foord http://www.resolversystems.com http://www.voidspace.org.uk/python/index.shtml From michael.foord at resolversystems.com Thu Jun 22 13:41:08 2006 From: michael.foord at resolversystems.com (Michael Foord) Date: Thu, 22 Jun 2006 12:41:08 +0100 Subject: [IronPython] Inconsistency in getattr exceptions Message-ID: <449A81D4.3090307@resolversystems.com> Hello all, getattr in IronPython raises different exceptions to CPython for invalid input. CPython >>> getattr(a, None) Traceback (most recent call last): File "", line 1, in ? TypeError: getattr(): attribute name must be string >>> IronPython >>> a = object() >>> getattr(a, None) Traceback (most recent call last): File , line 0, in ##64 File , line 0, in GetAttr##65 AttributeError: 'object' object has no attribute '' >>> Note also that exceptions in IronPython involving a None often print the empty string, which can be unhelpful. (Which is odd since both repr(None) and str(None) return 'None'.) All the best, Michael Foord http://www.resolversystems.com http://www.voidspace.org.uk/python/index.shtml From KBjorke at nvidia.com Thu Jun 22 14:16:00 2006 From: KBjorke at nvidia.com (Kevin Bjorke) Date: Thu, 22 Jun 2006 05:16:00 -0700 Subject: [IronPython] How to get System.Single[]? Message-ID: <590FCAE72E27D54CA1EADE7293BB444F04422AD3@hqemmail04.nvidia.com> Yes, that's it, a=System.Array.CreateInstance(System.Single, 3) combined with System.Convert.ToSingle() and a.SetValue() to insert values other than zero Thanks! KB -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jonathan Jacobs Sent: Thursday, June 22, 2006 3:28 AM To: Discussion of IronPython Subject: Re: [IronPython] How to get System.Single[]? Kevin Bjorke wrote: > I need to create a list of Singles to use > System.Drawing.Darwing2D.ColorBlend's Position member. Color me > ignorant, but how can I create such a thing? I can't just pass a list of > floats It would be convenient to pass a tuple of floats, too bad this doesn't work. You can use System.Array.CreateInstance to create a Single[]: >>> System.Array.CreateInstance(System.Single, 3) System.Single[](0.0, 0.0, 0.0) Hope this helps. -- Jonathan _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com ----------------------------------------------------------------------------------- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ----------------------------------------------------------------------------------- From joesox at gmail.com Thu Jun 22 15:53:30 2006 From: joesox at gmail.com (JoeSox) Date: Thu, 22 Jun 2006 06:53:30 -0700 Subject: [IronPython] embedding IP in C# Windows .NET GUI In-Reply-To: <000801c695b1$d39a4290$6401a8c0@NIS1861127372> References: <785694cd0606200624p25718ce2n449b5453c0d1cdbf@mail.gmail.com> <000801c695b1$d39a4290$6401a8c0@NIS1861127372> Message-ID: <785694cd0606220653v5aa987b6n2e86055ecdda538a@mail.gmail.com> On 6/21/06, Lesley & Mitch Barnett wrote: > Thanks Joe! No problem. After checking out beta8, I added updating the source code on that project on my things to do list. Beta8 has many namespace changes and some other important changes. I am pretty sure a person can't compile that project with beta8 right away. Later, Joe From dans at houmus.org Thu Jun 22 16:12:12 2006 From: dans at houmus.org (Dan Shechter) Date: Thu, 22 Jun 2006 17:12:12 +0300 Subject: [IronPython] embedding IP in C# Windows .NET GUI Message-ID: <2e8aa6310606220712m283f98abs82b7f5273bd4bda7@mail.gmail.com> I can verify that :) I was able to change beta7 <-> IronPythonTextBox to work together, but it's not working on beta8 again.... -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.foord at resolversystems.com Thu Jun 22 16:09:42 2006 From: michael.foord at resolversystems.com (Michael Foord) Date: Thu, 22 Jun 2006 15:09:42 +0100 Subject: [IronPython] Code Quality Tools Message-ID: <449AA4A6.5090009@resolversystems.com> Hello all, At Resolver we are looking into tools that we can use to provide simple code hygiene checks. Check we're not shadowing built-in names, check for unneeded import statements and unused variables; that sort of thing. I know of three Python modules that do this. They all fail unredeemably on IronPython : * PyLint Uses the compiler.ast module extensively * PyChecker Does bytecode analysis * PyFlakes Uses compiler.parse (See also the previous email about coverage tools not working on IronPython because "sys.settrace" is not implemented.) We can use PyFlakes from CPython (and possbily PyLint- but not PyChecker because it executes code), but that means our test code is dependent on CPython. So there are no native code quality tools that will work with IronPython. This could be a barrier to entry for some projects who consider using IronPython. I realise it is not going to be high up the priority list, but if a solution to this was possible it would be good. One possibility is a pure Python ports of the parser module (which should get the compiler and compiler.ast modules working). There is a tool called EasyExtend which can generate CSTs in Pure Python, so it could be possible to convert one of the existing tools to use this. All the best, Michael Foord http://www.resolversystems.com http://www.voidspace.org.uk/python/index.shtml From joesox at gmail.com Thu Jun 22 17:04:50 2006 From: joesox at gmail.com (JoeSox) Date: Thu, 22 Jun 2006 08:04:50 -0700 Subject: [IronPython] embedding IP in C# Windows .NET GUI In-Reply-To: <2e8aa6310606220712m283f98abs82b7f5273bd4bda7@mail.gmail.com> References: <2e8aa6310606220712m283f98abs82b7f5273bd4bda7@mail.gmail.com> Message-ID: <785694cd0606220804g5de86dc8kdc36ef38e7734d82@mail.gmail.com> On 6/22/06, Dan Shechter wrote: > I can verify that :) > I was able to change beta7 <-> IronPythonTextBox to work together, but it's > not working on beta8 again.... :) Yes, lots of changes in beta8. adding using IronPython.Runtime.Operations; using IronPython.Compiler.AST; eliminates some compile errors but there are some spots that need to be updated. The SetGlobal() and GetGlobal I have already fixed but the others I haven't had time yet, like "Error 8 The best overloaded method match for 'IronPython.Compiler.Parser.FromString(IronPython.Runtime.SystemState, IronPython.Compiler.CompilerContext, string)' has some invalid arguments" and PythonSyntaxError has changed so I need to fix that one. lol I'll probably update the project tonight. -- Later, Joe From dinov at exchange.microsoft.com Thu Jun 22 17:37:46 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Thu, 22 Jun 2006 08:37:46 -0700 Subject: [IronPython] How to get System.Single[]? In-Reply-To: <590FCAE72E27D54CA1EADE7293BB444F04422AD3@hqemmail04.nvidia.com> References: <590FCAE72E27D54CA1EADE7293BB444F04422AD3@hqemmail04.nvidia.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03DDFC6520@df-foxhound-msg.exchange.corp.microsoft.com> A slightly easier version is: >>> System.Array[System.Single]( (1,2,3) ) System.Single[](1.0, 2.0, 3.0) We make the System.Array class indexable by type and allow you to quickly construct arrays w/ specific values that way. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kevin Bjorke Sent: Thursday, June 22, 2006 5:16 AM To: Discussion of IronPython Subject: Re: [IronPython] How to get System.Single[]? Yes, that's it, a=System.Array.CreateInstance(System.Single, 3) combined with System.Convert.ToSingle() and a.SetValue() to insert values other than zero Thanks! KB -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jonathan Jacobs Sent: Thursday, June 22, 2006 3:28 AM To: Discussion of IronPython Subject: Re: [IronPython] How to get System.Single[]? Kevin Bjorke wrote: > I need to create a list of Singles to use > System.Drawing.Darwing2D.ColorBlend's Position member. Color me > ignorant, but how can I create such a thing? I can't just pass a list of > floats It would be convenient to pass a tuple of floats, too bad this doesn't work. You can use System.Array.CreateInstance to create a Single[]: >>> System.Array.CreateInstance(System.Single, 3) System.Single[](0.0, 0.0, 0.0) Hope this helps. -- Jonathan _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com ----------------------------------------------------------------------------------- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ----------------------------------------------------------------------------------- _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From jvm_cop at spamcop.net Thu Jun 22 17:41:43 2006 From: jvm_cop at spamcop.net (J. Merrill) Date: Thu, 22 Jun 2006 11:41:43 -0400 Subject: [IronPython] How to get System.Single[]? In-Reply-To: <449A70A8.9080409@kaydash.za.net> References: <590FCAE72E27D54CA1EADE7293BB444F04422AD1@hqemmail04.nvidia.com> <449A70A8.9080409@kaydash.za.net> Message-ID: <7.0.1.0.2.20060622114034.08bc1638@wheresmymailserver.com> At 06:27 AM 6/22/2006, Jonathan Jacobs wrote (in part) >Kevin Bjorke wrote: >> I need to create a list of Singles > >It would be convenient to pass a tuple of floats, too bad this doesn't work. I wonder if that should be called a bug. If a tuple of floats can be used for an array of floats, why shouldn't there be an automatic conversion to an array of singles? J. Merrill / Analytical Software Corp From dinov at exchange.microsoft.com Thu Jun 22 17:41:54 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Thu, 22 Jun 2006 08:41:54 -0700 Subject: [IronPython] Empty Module Contents In-Reply-To: <449A7FF7.7080100@resolversystems.com> References: <449A7FF7.7080100@resolversystems.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03DDFC6527@df-foxhound-msg.exchange.corp.microsoft.com> I've filed this as CodePlex bug #561 - hopefully we can get this fixed for the next release. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Thursday, June 22, 2006 4:33 AM To: Discussion of IronPython Subject: [IronPython] Empty Module Contents Hello all, There is a difference between the contents of an empty module (or any other module for that matter) in CPython and IronPython. This is possibly an implementation detail, but it causes PyChecker to crash so I thought I'd report it. (Tested in Beta 8.) Create an empty file called 'empty_module.py' then import it and run the following : CPython >>> import empty_module >>> vars(empty_module).keys() ['__builtins__', '__name__', '__file__', '__doc__'] >>> IronPython >>> import empty_module >>> vars(empty_module).keys() ['__doc__', '__name__', None, '__builtins__', '__file__', '__str__', '__repr__', '__new__', '__init__', '__module__'] >>> It is (so far) specifically the presence of None that is problematic for me, so I'm building workarounds. All the best, Michael Foord http://www.resolversystems.com http://www.voidspace.org.uk/python/index.shtml _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at exchange.microsoft.com Thu Jun 22 17:43:07 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Thu, 22 Jun 2006 08:43:07 -0700 Subject: [IronPython] Inconsistency in getattr exceptions In-Reply-To: <449A81D4.3090307@resolversystems.com> References: <449A81D4.3090307@resolversystems.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03DDFC652A@df-foxhound-msg.exchange.corp.microsoft.com> Thanks for the bug report. I've filed this as CodePlex bug 562. This one sounds like it'll be trivial to fix so we should have it for the next release. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Thursday, June 22, 2006 4:41 AM To: Discussion of IronPython Subject: [IronPython] Inconsistency in getattr exceptions Hello all, getattr in IronPython raises different exceptions to CPython for invalid input. CPython >>> getattr(a, None) Traceback (most recent call last): File "", line 1, in ? TypeError: getattr(): attribute name must be string >>> IronPython >>> a = object() >>> getattr(a, None) Traceback (most recent call last): File , line 0, in ##64 File , line 0, in GetAttr##65 AttributeError: 'object' object has no attribute '' >>> Note also that exceptions in IronPython involving a None often print the empty string, which can be unhelpful. (Which is odd since both repr(None) and str(None) return 'None'.) All the best, Michael Foord http://www.resolversystems.com http://www.voidspace.org.uk/python/index.shtml _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at exchange.microsoft.com Thu Jun 22 17:46:07 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Thu, 22 Jun 2006 08:46:07 -0700 Subject: [IronPython] embedding IP in C# Windows .NET GUI In-Reply-To: <785694cd0606220804g5de86dc8kdc36ef38e7734d82@mail.gmail.com> References: <2e8aa6310606220712m283f98abs82b7f5273bd4bda7@mail.gmail.com> <785694cd0606220804g5de86dc8kdc36ef38e7734d82@mail.gmail.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03DDFC652F@df-foxhound-msg.exchange.corp.microsoft.com> The good news here is that we're almost done w/ the breaking changes... If you depend on the AST namespace we'll probably break you a little bit more in the next release (all the public fields have become properties), but that should be it. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of JoeSox Sent: Thursday, June 22, 2006 8:05 AM To: Discussion of IronPython Subject: Re: [IronPython] embedding IP in C# Windows .NET GUI On 6/22/06, Dan Shechter wrote: > I can verify that :) > I was able to change beta7 <-> IronPythonTextBox to work together, but > it's not working on beta8 again.... :) Yes, lots of changes in beta8. adding using IronPython.Runtime.Operations; using IronPython.Compiler.AST; eliminates some compile errors but there are some spots that need to be updated. The SetGlobal() and GetGlobal I have already fixed but the others I haven't had time yet, like "Error 8 The best overloaded method match for 'IronPython.Compiler.Parser.FromString(IronPython.Runtime.SystemState, IronPython.Compiler.CompilerContext, string)' has some invalid arguments" and PythonSyntaxError has changed so I need to fix that one. lol I'll probably update the project tonight. -- Later, Joe _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From Martin.Maly at microsoft.com Thu Jun 22 17:55:30 2006 From: Martin.Maly at microsoft.com (Martin Maly) Date: Thu, 22 Jun 2006 08:55:30 -0700 Subject: [IronPython] Code Coverage In-Reply-To: <449A7B25.3030308@resolversystems.com> Message-ID: <5C0A6F919D675745BB1DBA7412DB68F50535C11685@df-foxhound-msg.exchange.corp.microsoft.com> Michael, thanks for the feedback. The settrace function is actually one of many things we are hoping to address in the next release. Dino and I discussed options for implementing it and hopefully we can get it fixed for the next release. Thanks Martin -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Thursday, June 22, 2006 4:13 AM To: Discussion of IronPython Subject: [IronPython] Code Coverage Hello all, I've been looking at code coverage tools for Python, as we would like to check the coverage of our unit tests. Unfortunately all the Python code coverage tools use ``sys.settrace`` which isn't implemented in IronPython. This (I guess) is because Python stack frames and code objects aren't used in IronPython. Unfortunately this makes coverage tools impossible (or just very difficult), unless an alternative mechanism is provided. (They also tend to use the parser module which is another issue.) I browsed the IronPython source (is there an API doc ?) but couldn't see anything useful to get a callback as new source-code lines are entered. Line information is obviously *somewhere*, as it is presented in traceback information. Two alternative ideas. 1) Implement a 'cut down' version of sys.settrace which only implements what is possible. For sys.settrace - see http://docs.python.org/lib/debugger-hooks.html#debugger-hooks coverage.py is one of the most common tools : http://www.nedbatchelder.com/code/modules/coverage.html It uses settrace with the following function : def t(f, x, y): c[(f.f_code.co_filename, f.f_lineno)] = 1 return t So it only uses a filename reference from the code object and the line_no from the frame. Either dummy objects could be constructed, or an IronPython specific implementation could be made which presents this information directly. 2) Alternatively a callback hook on the C# side could be implemented, so that as IronPython enters a new line we could cache this information - and generate a report once execution has stopped. Either of these would be much appreciated. All the best, Michael Foord http://www.resolversystems.com http://www.voidspace.org.uk/python/index.shtml _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From hernan at orgmf.com.ar Thu Jun 22 17:59:34 2006 From: hernan at orgmf.com.ar (Hernan Martinez Foffani) Date: Thu, 22 Jun 2006 17:59:34 +0200 Subject: [IronPython] Code Coverage In-Reply-To: <449A7B25.3030308@resolversystems.com> References: <449A7B25.3030308@resolversystems.com> Message-ID: <11fab4bc0606220859k47d3d188m9432a55880dd6b9b@mail.gmail.com> > Unfortunately all the Python code coverage tools use ``sys.settrace`` > which isn't implemented in IronPython. This (I guess) is because Python > stack frames and code objects aren't used in IronPython. > . > . > . > Two alternative ideas. > 1) Implement a 'cut down' version of sys.settrace which only implements > what is possible. > 2) Alternatively a callback hook on the C# side could be implemented, so > that as IronPython enters a new line we could cache this information - > and generate a report once execution has stopped. Profilers, Debugger and Coverage tools for .NET use the .NET Profiling API. Has anyone tried these with IronPython? -H. From Martin.Maly at microsoft.com Thu Jun 22 18:04:48 2006 From: Martin.Maly at microsoft.com (Martin Maly) Date: Thu, 22 Jun 2006 09:04:48 -0700 Subject: [IronPython] Code Quality Tools In-Reply-To: <449AA4A6.5090009@resolversystems.com> Message-ID: <5C0A6F919D675745BB1DBA7412DB68F50535C11693@df-foxhound-msg.exchange.corp.microsoft.com> Great feedback. We will need to investigate this some more to see what exactly the python's compiler package requires in terms of built-in modules. For now I opened CodePlex bug 563 so that we can include this important feature in our planning. Martin -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Thursday, June 22, 2006 7:10 AM To: Discussion of IronPython Subject: [IronPython] Code Quality Tools Hello all, At Resolver we are looking into tools that we can use to provide simple code hygiene checks. Check we're not shadowing built-in names, check for unneeded import statements and unused variables; that sort of thing. I know of three Python modules that do this. They all fail unredeemably on IronPython : * PyLint Uses the compiler.ast module extensively * PyChecker Does bytecode analysis * PyFlakes Uses compiler.parse (See also the previous email about coverage tools not working on IronPython because "sys.settrace" is not implemented.) We can use PyFlakes from CPython (and possbily PyLint- but not PyChecker because it executes code), but that means our test code is dependent on CPython. So there are no native code quality tools that will work with IronPython. This could be a barrier to entry for some projects who consider using IronPython. I realise it is not going to be high up the priority list, but if a solution to this was possible it would be good. One possibility is a pure Python ports of the parser module (which should get the compiler and compiler.ast modules working). There is a tool called EasyExtend which can generate CSTs in Pure Python, so it could be possible to convert one of the existing tools to use this. All the best, Michael Foord http://www.resolversystems.com http://www.voidspace.org.uk/python/index.shtml _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From KBjorke at nvidia.com Thu Jun 22 18:46:53 2006 From: KBjorke at nvidia.com (Kevin Bjorke) Date: Thu, 22 Jun 2006 09:46:53 -0700 Subject: [IronPython] How to get System.Single[]? Message-ID: <590FCAE72E27D54CA1EADE7293BB444F04422AD4@hqemmail04.nvidia.com> Thanks, that's a real help too. Might this issue eventually just disappear, since some CLR environments (say, C#) are perfectly happy just passing arrays of native floats and the ColorBlend class just does the right thing? Seems like a bit of a minefield if some .NET methods randomly need Single while others are okay with float. If it's a permanent condition, your tuple trick might be good to include in the FAQ kb -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: Thursday, June 22, 2006 8:38 AM To: Discussion of IronPython Subject: Re: [IronPython] How to get System.Single[]? A slightly easier version is: >>> System.Array[System.Single]( (1,2,3) ) System.Single[](1.0, 2.0, 3.0) We make the System.Array class indexable by type and allow you to quickly construct arrays w/ specific values that way. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kevin Bjorke Sent: Thursday, June 22, 2006 5:16 AM To: Discussion of IronPython Subject: Re: [IronPython] How to get System.Single[]? Yes, that's it, a=System.Array.CreateInstance(System.Single, 3) combined with System.Convert.ToSingle() and a.SetValue() to insert values other than zero Thanks! KB -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jonathan Jacobs Sent: Thursday, June 22, 2006 3:28 AM To: Discussion of IronPython Subject: Re: [IronPython] How to get System.Single[]? Kevin Bjorke wrote: > I need to create a list of Singles to use > System.Drawing.Darwing2D.ColorBlend's Position member. Color me > ignorant, but how can I create such a thing? I can't just pass a list of > floats It would be convenient to pass a tuple of floats, too bad this doesn't work. You can use System.Array.CreateInstance to create a Single[]: >>> System.Array.CreateInstance(System.Single, 3) System.Single[](0.0, 0.0, 0.0) Hope this helps. -- Jonathan _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com ------------------------------------------------------------------------ ----------- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ------------------------------------------------------------------------ ----------- _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From Martin.Maly at microsoft.com Thu Jun 22 18:51:44 2006 From: Martin.Maly at microsoft.com (Martin Maly) Date: Thu, 22 Jun 2006 09:51:44 -0700 Subject: [IronPython] Code Coverage In-Reply-To: <11fab4bc0606220859k47d3d188m9432a55880dd6b9b@mail.gmail.com> Message-ID: <5C0A6F919D675745BB1DBA7412DB68F50535C1170F@df-foxhound-msg.exchange.corp.microsoft.com> The debugger support works really well with IronPython. There are some limitations, but the basic experience is truly pleasant. As for profilers, code coverage, the limitations likely to make experience less pleasant are our function name mangling and use of lightweight code generation which both will affect the code coverage and profiling tools experience. Martin -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Hernan Martinez Foffani Sent: Thursday, June 22, 2006 9:00 AM To: Discussion of IronPython Subject: Re: [IronPython] Code Coverage > Unfortunately all the Python code coverage tools use ``sys.settrace`` > which isn't implemented in IronPython. This (I guess) is because Python > stack frames and code objects aren't used in IronPython. > . > . > . > Two alternative ideas. > 1) Implement a 'cut down' version of sys.settrace which only implements > what is possible. > 2) Alternatively a callback hook on the C# side could be implemented, so > that as IronPython enters a new line we could cache this information - > and generate a report once execution has stopped. Profilers, Debugger and Coverage tools for .NET use the .NET Profiling API. Has anyone tried these with IronPython? -H. _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From andrzej.krzywda at resolversystems.com Thu Jun 22 19:16:09 2006 From: andrzej.krzywda at resolversystems.com (Andrzej Krzywda) Date: Thu, 22 Jun 2006 18:16:09 +0100 Subject: [IronPython] Compiler flags and co_flags value Message-ID: <449AD059.4090104@resolversystems.com> Hi all, It's good to see that the compiler flags are now working in IronPython Beta8. However, the compiled code object doesn't return valid co_flags value: CPython: >>> x = compile("print 2/3", "", "exec", 8192) >>> x.co_flags 8256 IronPython Beta 8: >>> x = compile("print 2/3", "", "exec", 8192) >>> x.co_flags 0 Andrzej Krzywda From fuzzyman at voidspace.org.uk Fri Jun 23 01:29:30 2006 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Fri, 23 Jun 2006 00:29:30 +0100 Subject: [IronPython] IronPython & Windows Forms Part VI Message-ID: <449B27DA.9080501@voidspace.org.uk> Hello all, I have finally completed my sixth blog entry in the series on IronPython & Windows Form. This one is on CheckBoxes and RadioButtons. As always comments and corrections (and screenshots) appreciated : http://www.voidspace.org.uk/python/weblog/arch_d7_2006_06_17.shtml#e374 I finished this in a bit of a rush, so if you see any typos let me know (I'll add links to the other entries later). Hopefully it won't be so long before the next entry. All the best, Michael Foord http://www.voidspace.org.uk/python/index.shtml From sanxiyn at gmail.com Fri Jun 23 03:00:45 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Fri, 23 Jun 2006 10:00:45 +0900 Subject: [IronPython] IronPython & Windows Forms Part VI In-Reply-To: <449B27DA.9080501@voidspace.org.uk> References: <449B27DA.9080501@voidspace.org.uk> Message-ID: <5b0248170606221800r2271dd65o3a9f81e5340f04f7@mail.gmail.com> 2006/6/23, Michael Foord : > As always comments and corrections (and screenshots) appreciated : I'd use random.randrange(256) instead of int(random.random() * 256). It doesn't matter in this case though. randrange can compensate when underlying random number generator doesn't return enough random bits. Seo Sanghyeon From sanxiyn at gmail.com Fri Jun 23 04:22:30 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Fri, 23 Jun 2006 11:22:30 +0900 Subject: [IronPython] IronPython 1.0 Beta 8 on Mono Message-ID: <5b0248170606221922m58ff2e7bqb13fdcbda0319d44@mail.gmail.com> You need Mono revision later than 61914 to avoid compiler bugs, namely Mono bug #78630 and #78678. socket.cs doesn't compile, because Mono misses SendTimeout and ReceiveTimeout. I deleted the file for now. Apart from that, Beta 8 should compile and run fine. Seo Sanghyeon From sanxiyn at gmail.com Fri Jun 23 04:43:52 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Fri, 23 Jun 2006 11:43:52 +0900 Subject: [IronPython] Compilation warnings on Mono Message-ID: <5b0248170606221943p45c8d8ebwa18906b5d6ad290b@mail.gmail.com> Attached. Seo Sanghyeon -------------- next part -------------- IronPython/Compiler/MethodBinder.cs(837,22): warning CS0219: The variable `returnType' is assigned but its value is never used IronPython/Compiler/Generation/OutputGenerator.cs(321,25): warning CS0219: The variable `finished' is assigned but its value is never used IronPython/Runtime/Operations/StringOps.cs(1469,21): warning CS0168: The variable `bytesSkipped' is declared but never used IronPython/Runtime/Operations/StringOps.cs(1567,21): warning CS0168: The variable `bytesSkipped' is declared but never used IronPython/Runtime/Types/Mro.cs(201,27): warning CS0219: The variable `parentInfo' is assigned but its value is never used IronPython/Compiler/MethodBinder.cs(880,32): warning CS0169: The private method `IronPython.Compiler.MethodBinder.MethodTarget.CountPriority(System.Collections.Generic.List, int)' is never used IronPython/Compiler/Generation/CodeGen.cs(1556,22): warning CS0169: The private method `IronPython.Compiler.Generation.CodeGen.WriteIL(string, object, object, object, object)' is never used IronPython/Compiler/Generation/NewTypeMaker.cs(573,29): warning CS0169: The private method `IronPython.Compiler.Generation.NewTypeMaker.EmitNoDict(IronPython.Compiler.Generation.CodeGen)' is never used IronPython/Compiler/Generation/Slot.cs(325,34): warning CS0414: The private field `IronPython.Compiler.Generation.LocalSlot.codeGen' is assigned but its value is never used IronPython/Hosting/PythonEngine.cs(582,22): warning CS0169: The private method `IronPython.Hosting.PythonEngine.AssociateComInterface(object, object)' is never used IronPython/Hosting/PythonEngine.cs(590,22): warning CS0169: The private method `IronPython.Hosting.PythonEngine.AssociateHiddenComInterface(System.Type, System.Type)' is never used IronPython/Hosting/PythonEngine.cs(599,22): warning CS0169: The private method `IronPython.Hosting.PythonEngine.AssociateHiddenComAddInterface(System.Type, System.Collections.Generic.IList)' is never used IronPython/Runtime/Converter.cs(348,38): warning CS0414: The private field `IronPython.Runtime.NewConverter.Int16Type' is assigned but its value is never used IronPython/Runtime/Converter.cs(349,38): warning CS0414: The private field `IronPython.Runtime.NewConverter.SByteType' is assigned but its value is never used IronPython/Runtime/Converter.cs(351,38): warning CS0414: The private field `IronPython.Runtime.NewConverter.UInt64Type' is assigned but its value is never used IronPython/Runtime/Converter.cs(354,38): warning CS0414: The private field `IronPython.Runtime.NewConverter.DecimalType' is assigned but its value is never used IronPython/Runtime/Converter.cs(355,38): warning CS0414: The private field `IronPython.Runtime.NewConverter.ObjectType' is assigned but its value is never used IronPython/Runtime/Converter.cs(356,38): warning CS0414: The private field `IronPython.Runtime.NewConverter.Int64Type' is assigned but its value is never used IronPython/Runtime/Converter.cs(358,38): warning CS0414: The private field `IronPython.Runtime.NewConverter.SingleType' is assigned but its value is never used IronPython/Runtime/Converter.cs(360,38): warning CS0414: The private field `IronPython.Runtime.NewConverter.UInt16Type' is assigned but its value is never used IronPython/Runtime/Converter.cs(361,38): warning CS0414: The private field `IronPython.Runtime.NewConverter.UInt32Type' is assigned but its value is never used IronPython/Runtime/Converter.cs(362,38): warning CS0414: The private field `IronPython.Runtime.NewConverter.ByteType' is assigned but its value is never used IronPython/Runtime/Converter.cs(363,38): warning CS0414: The private field `IronPython.Runtime.NewConverter.BigIntegerType' is assigned but its value is never used IronPython/Runtime/Converter.cs(364,38): warning CS0414: The private field `IronPython.Runtime.NewConverter.Complex64Type' is assigned but its value is never used IronPython/Runtime/Converter.cs(369,38): warning CS0414: The private field `IronPython.Runtime.NewConverter.ArrayListType' is assigned but its value is never used IronPython/Runtime/Converter.cs(371,38): warning CS0414: The private field `IronPython.Runtime.NewConverter.ListOfTType' is assigned but its value is never used IronPython/Runtime/Converter.cs(373,38): warning CS0414: The private field `IronPython.Runtime.NewConverter.HashtableType' is assigned but its value is never used IronPython/Runtime/Converter.cs(374,38): warning CS0414: The private field `IronPython.Runtime.NewConverter.ListWrapperForIListType' is assigned but its value is never used IronPython/Runtime/Converter.cs(377,38): warning CS0414: The private field `IronPython.Runtime.NewConverter.DictWrapperForIDictType' is assigned but its value is never used IronPython/Runtime/SystemState.cs(291,24): warning CS0169: The private method `IronPython.Runtime.SystemState.setdefaultencodingImpl(object)' is never used IronPython/Runtime/Types/ReflectedType.cs(622,29): warning CS0169: The private method `IronPython.Runtime.Types.ReflectedType.IsOptimizedMethod(System.Reflection.ParameterInfo[])' is never used IronPythonConsole/PythonCommandLine.cs(502,17): warning CS0219: The variable `result' is assigned but its value is never used IronPythonConsole/PythonCommandLine.cs(400,29): warning CS0169: The private method `IronPythonConsole.PythonCommandLine.WaitForAnyKey()' is never used IronPythonConsole/PythonCommandLine.cs(710,29): warning CS0414: The private field `IronPythonConsole.BasicConsole.sys' is assigned but its value is never used From Martin.Maly at microsoft.com Fri Jun 23 04:59:22 2006 From: Martin.Maly at microsoft.com (Martin Maly) Date: Thu, 22 Jun 2006 19:59:22 -0700 Subject: [IronPython] Compiler flags and co_flags value In-Reply-To: <449AD059.4090104@resolversystems.com> Message-ID: <5C0A6F919D675745BB1DBA7412DB68F50535C11CE7@df-foxhound-msg.exchange.corp.microsoft.com> We did make change in the co_flags but this is a case we probably missed. I filed a bug on CodePlex (#567) for this issue and we'll try to fix it before the next release. Martin -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Andrzej Krzywda Sent: Thursday, June 22, 2006 10:16 AM To: Discussion of IronPython Subject: [IronPython] Compiler flags and co_flags value Hi all, It's good to see that the compiler flags are now working in IronPython Beta8. However, the compiled code object doesn't return valid co_flags value: CPython: >>> x = compile("print 2/3", "", "exec", 8192) >>> x.co_flags 8256 IronPython Beta 8: >>> x = compile("print 2/3", "", "exec", 8192) >>> x.co_flags 0 Andrzej Krzywda _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From joesox at gmail.com Fri Jun 23 07:08:16 2006 From: joesox at gmail.com (JoeSox) Date: Thu, 22 Jun 2006 22:08:16 -0700 Subject: [IronPython] embedding IP in C# Windows .NET GUI In-Reply-To: <2e8aa6310606220712m283f98abs82b7f5273bd4bda7@mail.gmail.com> References: <2e8aa6310606220712m283f98abs82b7f5273bd4bda7@mail.gmail.com> Message-ID: <785694cd0606222208y19851a3cwaed5fad5a069706c@mail.gmail.com> On 6/22/06, Dan Shechter wrote: > I can verify that :) > I was able to change beta7 <-> IronPythonTextBox to work together, but it's > not working on beta8 again.... Just fyi, I updated the project and .dll so it supports beta8. http://www.codeproject.com/useritems/irontextbox/irontextbox_src.zip http://www.codeproject.com/useritems/irontextbox/irontextbox_dll.zip On 6/22/06, Dino Viehland wrote: > The good news here is that we're almost done w/ the breaking changes... If you depend on the AST namespace we'll probably break you a little bit more in the next release (all the public fields have become properties), but that should be it. > This is good to know because I'll wait until then to actually schedule time to code a project I have been debating with myself to code or not (a more complete C# library of ConceptNet) just to save me some headaches in the long run. I am still undecided on how to handling this speed dilemma of mine but it just seems easier to use a mixture of IronPython, .Net, and script files instead of using just the .Net library for what I am doing. Someone today told me they are using XML-RPC.NET to communicate with ConceptNetXMLRPCServer.py but it sounded like the loading of the predicate files (which I have mention onlist previously) and creating the huge semantic map (Python List instances) was a hurdle for him also. I also need to look at this but I have not looked at XML-RPC.NET yet. He wasn't sure on how to handle the return values from some ConceptNet methods because he wasn't familiar with ConceptNet's methods and logic, I advised him that IronPython would probably help get those returning values from the server. -- Later, Joe From sanxiyn at gmail.com Fri Jun 23 12:09:26 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Fri, 23 Jun 2006 19:09:26 +0900 Subject: [IronPython] IronPython & Windows Forms Part VI In-Reply-To: <449B27DA.9080501@voidspace.org.uk> References: <449B27DA.9080501@voidspace.org.uk> Message-ID: <5b0248170606230309ibf3b4a5m591b2856ba8c88d7@mail.gmail.com> 2006/6/23, Michael Foord : > As always comments and corrections (and screenshots) appreciated : You have "Forms" missing in the blog post title. Seo Sanghyeon From fuzzyman at voidspace.org.uk Fri Jun 23 14:05:53 2006 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Fri, 23 Jun 2006 13:05:53 +0100 Subject: [IronPython] IronPython & Windows Forms Part VI In-Reply-To: <5b0248170606230309ibf3b4a5m591b2856ba8c88d7@mail.gmail.com> References: <449B27DA.9080501@voidspace.org.uk> <5b0248170606230309ibf3b4a5m591b2856ba8c88d7@mail.gmail.com> Message-ID: <449BD921.407@voidspace.org.uk> Sanghyeon Seo wrote: > 2006/6/23, Michael Foord : > >> As always comments and corrections (and screenshots) appreciated : >> > > You have "Forms" missing in the blog post title. > Oops, thanks. :-) Michael > Seo Sanghyeon > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > From dinov at exchange.microsoft.com Sat Jun 24 00:56:52 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Fri, 23 Jun 2006 15:56:52 -0700 Subject: [IronPython] Remoting: Marshal object In-Reply-To: References: <4039D552ADAB094BB1EA670F3E96214E03BC058471@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03DFB30E3E@df-foxhound-msg.exchange.corp.microsoft.com> Sorry for the delay, your repros are complex :). Additionally having not used Remoting thoroughly in about 4-5 years (and then only having a fairly brief but in-depth in certain areas exposure to it) this took me some time to work through. Doing everything programmatically in C# this is where I ended up w/ a solution that appears to be what you want, but I'm not sure if this is the same as what you're doing. I also changed the type of the event handler to be a simple EventHandler rather than your type. I think I am doing something slightly different than you. On the client side it sounds like you're marshalling what should be your WKO instead of marshalling the listener for the event. You'll notice in my client I have an instance of foo that I Marshal to TalkIsGoodToo and then wire up to the remote event handler. Maybe you actually just have two instances of CallbackSink on both the client & server doing something more peer-to-peer. Server side: using System; using System.Collections; using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Http; using System.Runtime.Serialization.Formatters; class foo{ public static void Main(string[]args){ SoapServerFormatterSinkProvider provider = new SoapServerFormatterSinkProvider(); provider.TypeFilterLevel = TypeFilterLevel.Full; // Creating the IDictionary to set the port on the channel instance. IDictionary props = new Hashtable(); props["port"] = 8086; ChannelServices.RegisterChannel(new HttpChannel(props, null, provider), false); WellKnownServiceTypeEntry wkoe = new WellKnownServiceTypeEntry(typeof(CallbackSink), "SayHello", WellKnownObjectMode.Singleton); RemotingConfiguration.RegisterWellKnownServiceType(wkoe); Console.WriteLine("server running"); //CallbackSink cbs = (CallbackSink)System.Runtime.Remoting.RemotingServices.Marshal(typeof(CallbackSink), "SayHello"); //cbs.Send("Server Hello"); Console.ReadLine(); } } Client side: using System; using System.Collections; using System.Runtime.Remoting; using System.Runtime.Remoting.Services; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Http; using System.Runtime.Serialization.Formatters; class foo : MarshalByRefObject{ public static void Main(string[]args){ SoapServerFormatterSinkProvider provider = new SoapServerFormatterSinkProvider(); provider.TypeFilterLevel = TypeFilterLevel.Full; IDictionary props = new Hashtable(); props["port"] = 8087; ChannelServices.RegisterChannel(new HttpChannel(props, null, provider), false); Console.WriteLine("go"); CallbackSink cbs = (CallbackSink)System.Activator.GetObject(typeof(CallbackSink), "http://localhost:8086/SayHello"); foo f = new foo(); System.Runtime.Remoting.RemotingServices.Marshal(f, "TalkIsGoodToo"); cbs.OnHostToClient += f.MyEventHandler; cbs.Send("hello!"); } public void MyEventHandler(object sender, EventArgs e){ Console.WriteLine("MyEventHandler!"); } } Then my Python script ends up looking like this: import System import clr clr.AddReference('System.Runtime.Remoting') clr.AddReference('System.Runtime.Serialization.Formatters.Soap') from System.Runtime.Serialization.Formatters import TypeFilterLevel provider = System.Runtime.Remoting.Channels.SoapServerFormatterSinkProvider() provider.TypeFilterLevel = TypeFilterLevel.Full props = System.Collections.Hashtable() props["port"] = 8087 System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(System.Runtime.Remoting.Channels.Http.HttpChannel(props, None, provider), False) clr.AddReferenceToFile('ro.dll') import CallbackSink cbs = System.Activator.GetObject(CallbackSink, "http://localhost:8086/SayHello") class foo(System.MarshalByRefObject): def handler(self, sender, args): print 'called' f = foo() System.Runtime.Remoting.RemotingServices.Marshal(f, "TalkIsGoodToo") cbs.OnHostToClient += f.handler and depending on how I tweak things, I finally get an exception of one sort on the final line. For starters I got that ModuleScope was not serializable. I changed it to derive from MarshalByRefObject (not sure that's right, just wanted to see about getting past this) and I was able to get a little bit further, but this is where it starts to get difficult to make any forward progress. For starters cbs, being a remote MarshalByRefObject, has all the same problems w/ remote MarshalByRefObject's that you ran into previously. I was able to get closer to wiring up the event handler by doing: CallbackSink.OnHostToClient.__get__(cbs, CallbackSink).__iadd__(f.handler) But then we seem to hit a brick wall where we fail to serialize something else, and it's not very clear what it is... So, the question then becomes, how do you actually do this w/ IronPython? I think what you'll need to do is setup a helper class that can do the event handling for you. Link that against IronPython.dll and call through Ops to invoke your object, I came up with: using System; using IronPython.Runtime.Operations; public class Helper : MarshalByRefObject { private object o; public Helper(object o){ this.o = o; } public void Register(CallbackSink cbs){ cbs.OnHostToClient += this.OnCalled; } public virtual void OnCalled(object sender, EventArgs e){ Console.WriteLine("Helper.OnCalled"); Ops.Call(o); } } (note the registration does need to occur via C#). Finally I use that from Python like: import System import clr clr.AddReference('System.Runtime.Remoting') clr.AddReferenceToFile('helper.dll') #clr.AddReference('System.Runtime.Serialization.Formatters.') from System.Runtime.Serialization.Formatters import TypeFilterLevel provider = System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider() provider.TypeFilterLevel = TypeFilterLevel.Full props = System.Collections.Hashtable() props["port"] = 8087 System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(System.Runtime.Remoting.Channels.Tcp.TcpChannel(props, None, provider), False) clr.AddReferenceToFile('ro.dll') import CallbackSink cbs = System.Activator.GetObject(CallbackSink, "Tcp://localhost:8086/SayHello") def myCallback(): print 'called' import Helper f = Helper(myCallback) System.Runtime.Remoting.RemotingServices.Marshal(f, "TalkIsGoodToo") f.Register(cbs) CallbackSink.Send(cbs, 'hello') All in all I'd say that IronPython is capable w/ some effort of consuming remoting objects, but that we're not capable of producing remotable objects (which is what you're effectively trying to do here). So as you get into the more production side of things you'll need some C# code to stitch things together. Hopefully we can do a better job here in the future (although it's not entirely clear how) but unfortunately we probably won't make any significant changes to this for v1.0. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ralph Soons Sent: Wednesday, June 21, 2006 12:49 AM To: users at lists.ironpython.com Subject: Re: [IronPython] Remoting: Marshal object In c# I have 3 assembly's. There's a server exe and a client exe and a library in which the remoting objects are implemented, which are included in both the client and the server. The CallbackSink class is situated in the library which has the namespace RemotingServerClient. I use server activated Singleton mode configuration. I would like to register on the OnHostToClient event at server side so any object registering for this event receives a notification when a client calls. My problem was that the object I registered my event to and the object which was called by the client weren't the same. So my registered event handlers weren't called. That's why I had to use the marshal function. Using the c# server and client this works. After this I replaced the c# server by a python server. I used the same configuration. Created an event handler function. Created the CallbackSink object (got an instance) and registered the event handler to it. Now I marshal the callbacksink object to make sure during a call from the client the same object is used. When I call my server in python from the c# client, the message is received in the Send function of the CallbackSink and if write the received message to the console I see the message appearing in the python console. However the CallbackSink object is newly created and isn't the object I marshalled in the python server. So it looks like the Marshal call doesn't work. I don't see any exception. Only thing I see is that the objects are different. >From: Dino Viehland >Reply-To: Discussion of IronPython >To: Discussion of IronPython >Subject: Re: [IronPython] Remoting: Marshal object >Date: Tue, 20 Jun 2006 09:05:07 -0700 > >I'm a little lost on this one - what is RemotingServerClient here? Is >it a type, an assembly, a namespace? > >Also, do you get an exception, or does it just do nothing? > >-----Original Message----- >From: users-bounces at lists.ironpython.com >[mailto:users-bounces at lists.ironpython.com] On Behalf Of Ralph Soons >Sent: Tuesday, June 20, 2006 8:04 AM >To: users at lists.ironpython.com >Subject: [IronPython] Remoting: Marshal object > >I have a remoting problem again. I want to create an object at server >side, as singleton so when a call is done at client side, ill get the >already existing object. I tried it first with a c# server and client. > >Can anyone tell me why the marshal function doesn't work, objects on >server and client side are still different (same code works in c# >application so configuration is correct): > >Client side (Python): >t = RemotingServerClient.CallbackSink.Instance >System.Runtime.Remoting.RemotingServices.Marshal(t, 'TalkIsGoodToo') > >Server side (c#): >CallbackSink.Instance.Send("Message"); > >Remotable object (c#): >public class CallbackSink : MarshalByRefObject > { > private static CallbackSink m_Instance = null; > public event delCommsInfo OnHostToClient; > > public static CallbackSink Instance > { > get > { > if (null == m_Instance) > { > m_Instance = new CallbackSink(); > } > return m_Instance; > } > } > > private CallbackSink() > { } > > public void Send(string message) > { > OnHostToClient(info); > } > } > >Thanks for your help. >Best regards, >Ralph Soons > >_________________________________________________________________ >Talk with your online friends with MSN Messenger >http://www.join.msn.com/messenger/overview > >_______________________________________________ >users mailing list >users at lists.ironpython.com >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >_______________________________________________ >users mailing list >users at lists.ironpython.com >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _________________________________________________________________ Talk with your online friends with MSN Messenger http://www.join.msn.com/messenger/overview _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From jsacksteder at gmail.com Sat Jun 24 22:31:42 2006 From: jsacksteder at gmail.com (jeff sacksteder) Date: Sat, 24 Jun 2006 16:31:42 -0400 Subject: [IronPython] serial ports Message-ID: <51c8a7be0606241331m7f1db693sb401181122ebf231@mail.gmail.com> I'm having trouble reading data from a serial port. I'm connected with a null modem to another pc- I can send text fine with the Write() method, so I know the cable and bits are all correct. I'm trying something like from System.IO.Ports import SerialPort s = SerialPort(PortName='COM1',BaudRate=9600) s.Open() while 1: print s.ReadLine() I would expect this to produce a line of text each time the 'return' key was pressed on remote terminal, yet nothing ever happens. The VB examples I have looked at seem to use the ReadLine() method in this way. What's the problem? -------------- next part -------------- An HTML attachment was scrubbed... URL: From kristof.wagemans at gmail.com Sun Jun 25 10:09:18 2006 From: kristof.wagemans at gmail.com (Kristof Wagemans) Date: Sun, 25 Jun 2006 10:09:18 +0200 Subject: [IronPython] Python console control for WPF Message-ID: <000001c6982e$a92e28d0$0f01a8c0@notebook> I've been experimenting with a Python console control for WPF. The improvements made for IronPython beta 8 make this a lot easier thanks to several new functions on the PythonEngine: ExecuteToConsole, FormatException and ParseInteractiveInput. One of the things I need to do to communicate with a C# application is to change the default encoding to receive non-ascii characters. For this I execute several commands after the PythonEngine instance is created. import sys sys.setdefaultencoding('utf_16_le') del(sys) Setting the default encoding seems like a good candidate for the options you can pass to the engine while creating a new instance. It would also be easier if I could get at the options through a PythonEngine instance. I hope you're not going to remove the FilterStackFrame delegate from the FormatException method as the comment seems to indicate. I think it's very useful to filter my own C# application from the stack trace. Maybe you could add an overload with just the Exception and FilterStackFrame? To set a variable in the PythonEngine you need to use SetGlobal with a SymbolId. Am I correct to use SymbolTable.StringToId(name) to generate a SymbolId? It used to be easier with just a string to specify the name. A useful enhancement for the PythonEngine might be if there was a way to directly call a Python function loaded in the engine and pass parameters to it and get the return value. You could also support out parameters similar to calling a method through reflection. If you want to specify that a number is a long you can write 10L. Is there a way to specify that a number is a double or a decimal? -------------- next part -------------- An HTML attachment was scrubbed... URL: From jsacksteder at gmail.com Sun Jun 25 19:40:18 2006 From: jsacksteder at gmail.com (jeff sacksteder) Date: Sun, 25 Jun 2006 13:40:18 -0400 Subject: [IronPython] Serial Ports Message-ID: <51c8a7be0606251040lfbb5c7cj2f0699c6543c9784@mail.gmail.com> For the sake of those reading this later- The trouble with my previous example is that the ReadLines() method of a serial port expects a simple newline(\n), while the return key in Windows Hyperterminal sends a carriage return(\r) only. I'm not sure if this behaviour is because of the CLR or of IronPython, but it was not what I expected. Set the NewLine attribute of the serial port instance to your preferred delimiter to change this if necessary for your application. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jsacksteder at gmail.com Tue Jun 27 01:47:04 2006 From: jsacksteder at gmail.com (jeff sacksteder) Date: Mon, 26 Jun 2006 19:47:04 -0400 Subject: [IronPython] TabPages - misunderstanding or bug? Message-ID: <51c8a7be0606261647k9b4c9ebk5308c370e062bf24@mail.gmail.com> The TabPages attribute of the TabControl class contains a collection of TabPage objects. I was under the impression that individual tabs would be accessable by index or key. That is apparently not the case. Is this a bug or a misunderstanding on my part? >>> for p in tab_book.TabPages: ... print p ... TabPage: {foo} TabPage: {bar} TabPage: {baz} >>> print tab_book.TabPages[1] TabPage: {bar} >>> print book.TabPages['bar'] None -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex at syzmk.com Tue Jun 27 02:03:16 2006 From: alex at syzmk.com (Alex Henderson) Date: Tue, 27 Jun 2006 12:03:16 +1200 Subject: [IronPython] IP v8 Hosting question... In-Reply-To: <51c8a7be0606251040lfbb5c7cj2f0699c6543c9784@mail.gmail.com> Message-ID: <012901c6997d$17751a70$6701a8c0@tokai> I'm looking for the most appropriate way to "scope" variables for my expression to evaluate that come from an external context (ie. Outside of the python engine) - So far I have something working, using ModuleScope - but is this the way I should be doing it? PythonEngine engine = new PythonEngine(); SymbolId id = SymbolTable.StringToId("Message"); ModuleScope scope1 = ModuleScope.MakeScopeForFunction(new PythonModule("Junk", new Dict(), engine.Sys)); scope1.SetGlobal(id, "hello"); ModuleScope scope2 = ModuleScope.MakeScopeForFunction(new PythonModule("Junk", new Dict(), engine.Sys)); scope2.SetGlobal(id, "goodbye"); Assert.AreEqual("hello", engine.Evaluate("Message", scope1, ExecutionOptions.Default)); Assert.AreEqual("goodbye", engine.Evaluate("Message", scope2, ExecutionOptions.Default)); Using this method I can evaluate around 2000 expressions a second, which is more the adequate for what I'm doing - but I'm concerned about memory consumption... Chez, - Alex From dinov at exchange.microsoft.com Tue Jun 27 02:05:52 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 26 Jun 2006 17:05:52 -0700 Subject: [IronPython] TabPages - misunderstanding or bug? In-Reply-To: <51c8a7be0606261647k9b4c9ebk5308c370e062bf24@mail.gmail.com> References: <51c8a7be0606261647k9b4c9ebk5308c370e062bf24@mail.gmail.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03E040D83B@df-foxhound-msg.exchange.corp.microsoft.com> It looks like you've set the Text property to be foo/bar/baz, but not Name (which it seems is what this keys off of): import winforms import System.Windows.Forms as WF tc = WF.TabControl() tp = WF.TabPage('test') tp.Name = 'test' tc.TabPages.Add(tp) tp = WF.TabPage('foo') tp.Name = 'foo' tc.TabPages.Add(tp) tp = WF.TabPage('bar') tp.Name = 'bar' tc.TabPages.Add(tp) tc.TabPages['foo'] prints: TabPage: {foo} From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of jeff sacksteder Sent: Monday, June 26, 2006 4:47 PM To: users at lists.ironpython.com Subject: [IronPython] TabPages - misunderstanding or bug? The TabPages attribute of the TabControl class contains a collection of TabPage objects. I was under the impression that individual tabs would be accessable by index or key. That is apparently not the case. Is this a bug or a misunderstanding on my part? >>> for p in tab_book.TabPages: ... print p ... TabPage: {foo} TabPage: {bar} TabPage: {baz} >>> print tab_book.TabPages[1] TabPage: {bar} >>> print book.TabPages ['bar'] None -------------- next part -------------- An HTML attachment was scrubbed... URL: From joesox at gmail.com Tue Jun 27 02:38:20 2006 From: joesox at gmail.com (JoeSox) Date: Mon, 26 Jun 2006 17:38:20 -0700 Subject: [IronPython] odd IronPython behavior? Message-ID: <785694cd0606261738l5044225due0025e8d25dd8365@mail.gmail.com> In short, I am observing IronPython completely go thru the below method and only to return empty, while other Python environments return a value and exit on the first return statement. I believe this may be some sort of bug. Can someone confirm this for me, otherwise I will need to troubleshoot this more. "filename" is assigned with one file name in both IronPython and Python. I don't know if os.listdir(path) is operational in IronPython or I am not loading paths in there or what. I have some modified ConceptNet script files and I almost have it running in IronPython which is exciting but as you can see I am still working on some things. Thanks, as always. ====method ... def find_file(self,filename): if filename in os.listdir('.'): return './'+filename if os.environ.has_key('MONTYLINGUA'): csplits=os.environ['MONTYLINGUA'].split(';') csplits=map(lambda groupss:groupss.strip(),csplits) for enabled_arr in csplits: try : if filename in os.listdir(enabled_arr): return enabled_arr+'/'+filename except : pass if os.environ.has_key('PATH'): csplits=os.environ['PATH'].split(';') csplits=map(lambda groupss:groupss.strip(),csplits) for enabled_arr in csplits: try : if filename in os.listdir(enabled_arr): return enabled_arr+'/'+filename except : pass return '' -- Later, Joe From dinov at exchange.microsoft.com Tue Jun 27 03:01:13 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 26 Jun 2006 18:01:13 -0700 Subject: [IronPython] odd IronPython behavior? In-Reply-To: <785694cd0606261738l5044225due0025e8d25dd8365@mail.gmail.com> References: <785694cd0606261738l5044225due0025e8d25dd8365@mail.gmail.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03E040D8B7@df-foxhound-msg.exchange.corp.microsoft.com> os.listdir(path) seems to be working for me: >>> if 'sets.py' in os.listdir('.'): print 'hello' ... hello (running in the Python lib dir) -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of JoeSox Sent: Monday, June 26, 2006 5:38 PM To: Discussion of IronPython Subject: [IronPython] odd IronPython behavior? In short, I am observing IronPython completely go thru the below method and only to return empty, while other Python environments return a value and exit on the first return statement. I believe this may be some sort of bug. Can someone confirm this for me, otherwise I will need to troubleshoot this more. "filename" is assigned with one file name in both IronPython and Python. I don't know if os.listdir(path) is operational in IronPython or I am not loading paths in there or what. I have some modified ConceptNet script files and I almost have it running in IronPython which is exciting but as you can see I am still working on some things. Thanks, as always. ====method ... def find_file(self,filename): if filename in os.listdir('.'): return './'+filename if os.environ.has_key('MONTYLINGUA'): csplits=os.environ['MONTYLINGUA'].split(';') csplits=map(lambda groupss:groupss.strip(),csplits) for enabled_arr in csplits: try : if filename in os.listdir(enabled_arr): return enabled_arr+'/'+filename except : pass if os.environ.has_key('PATH'): csplits=os.environ['PATH'].split(';') csplits=map(lambda groupss:groupss.strip(),csplits) for enabled_arr in csplits: try : if filename in os.listdir(enabled_arr): return enabled_arr+'/'+filename except : pass return '' -- Later, Joe _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From joesox at gmail.com Tue Jun 27 03:30:30 2006 From: joesox at gmail.com (JoeSox) Date: Mon, 26 Jun 2006 18:30:30 -0700 Subject: [IronPython] odd IronPython behavior? In-Reply-To: <785694cd0606261738l5044225due0025e8d25dd8365@mail.gmail.com> References: <785694cd0606261738l5044225due0025e8d25dd8365@mail.gmail.com> Message-ID: <785694cd0606261830u227d9cdct7df1e419900d3a92@mail.gmail.com> On 6/26/06, JoeSox wrote: > In short, I am observing IronPython completely go thru the below > method and only to return empty, while other Python environments > return a value and exit on the first return statement. I believe this > may be some sort of bug. Can someone confirm this for me, otherwise I > will need to troubleshoot this more. "filename" is assigned with one > file name in both IronPython and Python. I don't know if > os.listdir(path) is operational in IronPython or I am not loading > paths in there or what. After setting some break points in a file named __init__.py in ConceptNet's directory named montylingua, it seems when "import MontyLingua" is called in a Python environment(and in IronPython if I just append the path and call the import) the file is accessed and it only has three lines of code: import os os.environ['PATH'] = os.environ.get('PATH','')+';./montylingua;' import MontyLingua However, in my project it is not getting accessed, so it is probably something I am doing. Thanks. -- Later, Joe From joesox at gmail.com Tue Jun 27 03:46:01 2006 From: joesox at gmail.com (JoeSox) Date: Mon, 26 Jun 2006 18:46:01 -0700 Subject: [IronPython] odd IronPython behavior? In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E03E040D8B7@df-foxhound-msg.exchange.corp.microsoft.com> References: <785694cd0606261738l5044225due0025e8d25dd8365@mail.gmail.com> <4039D552ADAB094BB1EA670F3E96214E03E040D8B7@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <785694cd0606261846n1356003bg10be051a3b8d93c7@mail.gmail.com> On 6/26/06, Dino Viehland wrote: > os.listdir(path) seems to be working for me: > > >>> if 'sets.py' in os.listdir('.'): print 'hello' > ... > hello > > (running in the Python lib dir) Thanks for the feedback. I have a bunch of modified importing from the ConceptNet modules and it looks like I might be losing or setting some imports incorrectly. It gets confusing with all of the imports and the levels that each module imports. Plus, I forgot that the os module wasn't attached to IronPython. For some reason I thought it was. -- Later, Joe From joesox at gmail.com Tue Jun 27 08:39:24 2006 From: joesox at gmail.com (JoeSox) Date: Mon, 26 Jun 2006 23:39:24 -0700 Subject: [IronPython] Speed test In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E03DBCDC88F@df-foxhound-msg.exchange.corp.microsoft.com> References: <785694cd0604191526u76be05aclc796996a4cc15229@mail.gmail.com> <4039D552ADAB094BB1EA670F3E96214E0285827E@df-foxhound-msg.exchange.corp.microsoft.com> <785694cd0604192227yd8831ceg2315cf4459c578da@mail.gmail.com> <785694cd0604201028r60484797r4622ea4cc506b8a@mail.gmail.com> <785694cd0606202121p540ad9k39d9dc6cc2038f86@mail.gmail.com> <4039D552ADAB094BB1EA670F3E96214E03DBCDC88F@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <785694cd0606262339r57ff6a6t35fc52e41b3a3786@mail.gmail.com> I finally achieved some spare time to get MIT's ConceptNet 2.1 to run using IronPython. I decided just to modify some of the files included with the 2.1 distribution and copy them; placing them in another directory to acheive execution in IronPython. Just to get it to run the first time, I created a custom(and not exactly functional. It is actually an IronPython.Runtime.List type object called array) array.py, commented out some zlib lines used by MontyLingua (doesn't seem to effect any results from tests thus far). I ran it using IronPythonConsole.exe beta8 So it appears it takes IronPythonConsole.exe beta8 151.478704 seconds to load ConceptNet 2.1 and its predicate files. It takes IDLE 60.205843 seconds to execute the same calls. One of these days I'll have everything in a presentable manner, and hopefully a nice little MS VS project. Even though it's not as fast, I still believe it is a wonderful achievement the IronPython team has done! ********************************* Loading Common Sense Component... predicates_concise_nonkline.txt: Loaded 27000 predicates! predicates_concise_kline.txt: Loaded 174000 predicates! predicates_nonconcise_nonkline.txt: Loaded 348000 predicates! -- took 151.478704 seconds. -- Performing Optimizations... Optimised 129563 of 129563 nodes! ************************************** ------------------------- *****IDLE:.... Loaded 342000 predicates! predicates_nonconcise_nonkline.txt: Loaded 345000 predicates! predicates_nonconcise_nonkline.txt: Loaded 348000 predicates! -- took 60.205843 seconds. -- -- Later, Joe From dinov at exchange.microsoft.com Tue Jun 27 17:48:28 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Tue, 27 Jun 2006 08:48:28 -0700 Subject: [IronPython] Compilation warnings on Mono In-Reply-To: <5b0248170606221943p45c8d8ebwa18906b5d6ad290b@mail.gmail.com> References: <5b0248170606221943p45c8d8ebwa18906b5d6ad290b@mail.gmail.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03E21BCB80@df-foxhound-msg.exchange.corp.microsoft.com> Thanks for keeping these coming Seo. I've opened CodePlex bug #623 to track the issue, and we'll get these cleaned up for the next release. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Sanghyeon Seo Sent: Thursday, June 22, 2006 7:44 PM To: Discussion of IronPython Subject: [IronPython] Compilation warnings on Mono Attached. Seo Sanghyeon From Shri.Borde at microsoft.com Tue Jun 27 23:55:15 2006 From: Shri.Borde at microsoft.com (Shri Borde) Date: Tue, 27 Jun 2006 14:55:15 -0700 Subject: [IronPython] IP v8 Hosting question... In-Reply-To: <012901c6997d$17751a70$6701a8c0@tokai> Message-ID: <50B69702CA6E6D4E849D30CD4989AB8E197F64A8BC@DF-GRTDANE-MSG.exchange.corp.microsoft.com> We will are taking a look at the API and will be changing it a bit. The current way of doing this as follows: PythonEngine engine = new PythonEngine(); SymbolId id = SymbolTable.StringToId("Message"); ModuleScope scope1 = new ModuleScope("Junk1"); scope1.SetGlobal(id, "hello"); ModuleScope scope2 = new ModuleScope("Junk2"); scope2.SetGlobal(id, "goodbye"); Assert.AreEqual("hello", engine.Evaluate("Message", scope1, ExecutionOptions.Default)); Assert.AreEqual("goodbye", engine.Evaluate("Message", scope2, ExecutionOptions.Default)); Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038) -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Alex Henderson Sent: Monday, June 26, 2006 5:03 PM To: 'Discussion of IronPython' Subject: [IronPython] IP v8 Hosting question... I'm looking for the most appropriate way to "scope" variables for my expression to evaluate that come from an external context (ie. Outside of the python engine) - So far I have something working, using ModuleScope - but is this the way I should be doing it? PythonEngine engine = new PythonEngine(); SymbolId id = SymbolTable.StringToId("Message"); ModuleScope scope1 = ModuleScope.MakeScopeForFunction(new PythonModule("Junk", new Dict(), engine.Sys)); scope1.SetGlobal(id, "hello"); ModuleScope scope2 = ModuleScope.MakeScopeForFunction(new PythonModule("Junk", new Dict(), engine.Sys)); scope2.SetGlobal(id, "goodbye"); Assert.AreEqual("hello", engine.Evaluate("Message", scope1, ExecutionOptions.Default)); Assert.AreEqual("goodbye", engine.Evaluate("Message", scope2, ExecutionOptions.Default)); Using this method I can evaluate around 2000 expressions a second, which is more the adequate for what I'm doing - but I'm concerned about memory consumption... Chez, - Alex _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From Shri.Borde at microsoft.com Wed Jun 28 00:04:47 2006 From: Shri.Borde at microsoft.com (Shri Borde) Date: Tue, 27 Jun 2006 15:04:47 -0700 Subject: [IronPython] Python console control for WPF In-Reply-To: <000001c6982e$a92e28d0$0f01a8c0@notebook> Message-ID: <50B69702CA6E6D4E849D30CD4989AB8E197F64A8CE@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Hi Kristof, You can call a Python method as such. public delegate int IntIntDelegate(int arg); engine.Execute("def IntIntMethod(a): return a * 100"); IntIntDelegate d = engine.Evaluate("IntIntMethod"); Console.WriteLine(d(2)); // This prints "200" I have opened this bug http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&WorkItemId=632 to track the issue with setdefaultencoding. Shri ________ Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038) ________________________________ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kristof Wagemans Sent: Sunday, June 25, 2006 1:09 AM To: users at lists.ironpython.com Subject: [IronPython] Python console control for WPF I've been experimenting with a Python console control for WPF. The improvements made for IronPython beta 8 make this a lot easier thanks to several new functions on the PythonEngine: ExecuteToConsole, FormatException and ParseInteractiveInput. One of the things I need to do to communicate with a C# application is to change the default encoding to receive non-ascii characters. For this I execute several commands after the PythonEngine instance is created. import sys sys.setdefaultencoding('utf_16_le') del(sys) Setting the default encoding seems like a good candidate for the options you can pass to the engine while creating a new instance. It would also be easier if I could get at the options through a PythonEngine instance. I hope you're not going to remove the FilterStackFrame delegate from the FormatException method as the comment seems to indicate. I think it's very useful to filter my own C# application from the stack trace. Maybe you could add an overload with just the Exception and FilterStackFrame? To set a variable in the PythonEngine you need to use SetGlobal with a SymbolId. Am I correct to use SymbolTable.StringToId(name) to generate a SymbolId? It used to be easier with just a string to specify the name. A useful enhancement for the PythonEngine might be if there was a way to directly call a Python function loaded in the engine and pass parameters to it and get the return value. You could also support out parameters similar to calling a method through reflection. If you want to specify that a number is a long you can write 10L. Is there a way to specify that a number is a double or a decimal? -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex at syzmk.com Wed Jun 28 03:19:47 2006 From: alex at syzmk.com (Alex Henderson) Date: Wed, 28 Jun 2006 13:19:47 +1200 Subject: [IronPython] IP v8 Hosting question... In-Reply-To: <50B69702CA6E6D4E849D30CD4989AB8E197F64A8BC@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <001c01c69a50$f21fcf70$6701a8c0@tokai> Yeah, I arrived at this yesterday after some experimentation :) I've since dumped the idea of setting global variables (as it's obviously not thread safe for multiple threads evaluating the same expression) and now generate methods for the expression i.e. For an expression: "Hello" + Message I would end up generating def generated_method_1(Message): return "Hello" + Message Then execute that against a newly created module, then evaluate "generated_method_1", casting it to a PythonFunction and Call that with the array of values that make up my context... works well now and suits my needs perfectly as I can wrap up iron python to work with our standard scripting interfaces. When I no longer need these methods I set their value to None, but I'm wondering if generating methods like this will incur overhead I can't get back (ie. will my apps memory consumption just keep growing, until the python engine itself is shut down?) It certainly seems a little like that when I've been unit testing, but perhaps that's a side effect of the NUnit environment? Chez, - Alex > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Shri Borde > Sent: Wednesday, 28 June 2006 9:55 a.m. > To: Discussion of IronPython > Subject: Re: [IronPython] IP v8 Hosting question... > > We will are taking a look at the API and will be changing it a bit. > > The current way of doing this as follows: > > PythonEngine engine = new PythonEngine(); > > SymbolId id = SymbolTable.StringToId("Message"); > > ModuleScope scope1 = new ModuleScope("Junk1"); > scope1.SetGlobal(id, "hello"); > > ModuleScope scope2 = new ModuleScope("Junk2"); > scope2.SetGlobal(id, "goodbye"); > > Assert.AreEqual("hello", engine.Evaluate("Message", scope1, > ExecutionOptions.Default)); > > Assert.AreEqual("goodbye", engine.Evaluate("Message", scope2, > ExecutionOptions.Default)); > > Do you want to help develop Dynamic languages on CLR? > (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE- > 11F0-45DF-8B78-DC1B43134038) > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Alex Henderson > Sent: Monday, June 26, 2006 5:03 PM > To: 'Discussion of IronPython' > Subject: [IronPython] IP v8 Hosting question... > > I'm looking for the most appropriate way to "scope" variables for my > expression to evaluate that come from an external context (ie. Outside of > the python engine) - So far I have something working, using ModuleScope - > but is this the way I should be doing it? > > PythonEngine engine = new PythonEngine(); > > SymbolId id = SymbolTable.StringToId("Message"); > > ModuleScope scope1 = ModuleScope.MakeScopeForFunction(new > PythonModule("Junk", new Dict(), engine.Sys)); > scope1.SetGlobal(id, "hello"); > > ModuleScope scope2 = ModuleScope.MakeScopeForFunction(new > PythonModule("Junk", new Dict(), engine.Sys)); > scope2.SetGlobal(id, "goodbye"); > > Assert.AreEqual("hello", engine.Evaluate("Message", scope1, > ExecutionOptions.Default)); > > Assert.AreEqual("goodbye", engine.Evaluate("Message", scope2, > ExecutionOptions.Default)); > > Using this method I can evaluate around 2000 expressions a second, which > is > more the adequate for what I'm doing - but I'm concerned about memory > consumption... > > Chez, > > - Alex > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at exchange.microsoft.com Wed Jun 28 03:47:27 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Tue, 27 Jun 2006 18:47:27 -0700 Subject: [IronPython] IP v8 Hosting question... In-Reply-To: <001c01c69a50$f21fcf70$6701a8c0@tokai> References: <50B69702CA6E6D4E849D30CD4989AB8E197F64A8BC@DF-GRTDANE-MSG.exchange.corp.microsoft.com>, <001c01c69a50$f21fcf70$6701a8c0@tokai> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03EA465817@df-foxhound-msg.exchange.corp.microsoft.com> Two things could be causing the increasing memory usage: 1. Instances of modules hanging around. If you're creating new modules & those are getting published in sys.modules, then you'll keep these things around (you could manually remove them from sys.modules and they should be collected after that). 2. Code compiled in a module will not be collectible - it will get compiled into a type in-memory that won't get unloaded until app domain unload. Code compiled stand-alone (e.g. from Python doing exec or eval) will be collectible and go away when the GC kicks in. In general this should come down to RunFile* will not be collectible, and everything else is. We do have a mode, -X:GenerateAsSnippets, which forces everything to be generated in mode #2. But there are significant performance benefits to having the non-collectible code. Everything else should be collectible. ________________________________________ From: users-bounces at lists.ironpython.com On Behalf Of Alex Henderson Sent: Tuesday, June 27, 2006 6:19 PM To: 'Discussion of IronPython' Subject: Re: [IronPython] IP v8 Hosting question... Yeah, I arrived at this yesterday after some experimentation :) I've since dumped the idea of setting global variables (as it's obviously not thread safe for multiple threads evaluating the same expression) and now generate methods for the expression i.e. For an expression: "Hello" + Message I would end up generating def generated_method_1(Message): return "Hello" + Message Then execute that against a newly created module, then evaluate "generated_method_1", casting it to a PythonFunction and Call that with the array of values that make up my context... works well now and suits my needs perfectly as I can wrap up iron python to work with our standard scripting interfaces. When I no longer need these methods I set their value to None, but I'm wondering if generating methods like this will incur overhead I can't get back (ie. will my apps memory consumption just keep growing, until the python engine itself is shut down?) It certainly seems a little like that when I've been unit testing, but perhaps that's a side effect of the NUnit environment? Chez, - Alex > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Shri Borde > Sent: Wednesday, 28 June 2006 9:55 a.m. > To: Discussion of IronPython > Subject: Re: [IronPython] IP v8 Hosting question... > > We will are taking a look at the API and will be changing it a bit. > > The current way of doing this as follows: > > PythonEngine engine = new PythonEngine(); > > SymbolId id = SymbolTable.StringToId("Message"); > > ModuleScope scope1 = new ModuleScope("Junk1"); > scope1.SetGlobal(id, "hello"); > > ModuleScope scope2 = new ModuleScope("Junk2"); > scope2.SetGlobal(id, "goodbye"); > > Assert.AreEqual("hello", engine.Evaluate("Message", scope1, > ExecutionOptions.Default)); > > Assert.AreEqual("goodbye", engine.Evaluate("Message", scope2, > ExecutionOptions.Default)); > > Do you want to help develop Dynamic languages on CLR? > (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE- > 11F0-45DF-8B78-DC1B43134038) > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Alex Henderson > Sent: Monday, June 26, 2006 5:03 PM > To: 'Discussion of IronPython' > Subject: [IronPython] IP v8 Hosting question... > > I'm looking for the most appropriate way to "scope" variables for my > expression to evaluate that come from an external context (ie. Outside of > the python engine) - So far I have something working, using ModuleScope - > but is this the way I should be doing it? > > PythonEngine engine = new PythonEngine(); > > SymbolId id = SymbolTable.StringToId("Message"); > > ModuleScope scope1 = ModuleScope.MakeScopeForFunction(new > PythonModule("Junk", new Dict(), engine.Sys)); > scope1.SetGlobal(id, "hello"); > > ModuleScope scope2 = ModuleScope.MakeScopeForFunction(new > PythonModule("Junk", new Dict(), engine.Sys)); > scope2.SetGlobal(id, "goodbye"); > > Assert.AreEqual("hello", engine.Evaluate("Message", scope1, > ExecutionOptions.Default)); > > Assert.AreEqual("goodbye", engine.Evaluate("Message", scope2, > ExecutionOptions.Default)); > > Using this method I can evaluate around 2000 expressions a second, which > is > more the adequate for what I'm doing - but I'm concerned about memory > consumption... > > Chez, > > - Alex > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From Shri.Borde at microsoft.com Wed Jun 28 05:04:30 2006 From: Shri.Borde at microsoft.com (Shri Borde) Date: Tue, 27 Jun 2006 20:04:30 -0700 Subject: [IronPython] IP v8 Hosting question... In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E03EA465817@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <50B69702CA6E6D4E849D30CD4989AB8E198D1B112D@DF-GRTDANE-MSG.exchange.corp.microsoft.com> We publish the ModuleScope to sys.modules if you do scope = new ModuleScope("some name"); We don't publish the ModuleScope if you do scope = new ModuleScope(); Note that we are thinking of changing this to let the user explicitly chose whether the module is published to sys.modules. Code compiled by all the PythonEngine APIs should generate collectible code except for: If you pass in ExecutionOptions.EnableDebugging. If you use ExecuteFileOptimized (formerly known as RunFile) You should not need to worry about memory leaks. I will add a test case to ensure that this stays this way. Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038) -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: Tuesday, June 27, 2006 6:47 PM To: Discussion of IronPython Subject: Re: [IronPython] IP v8 Hosting question... Two things could be causing the increasing memory usage: 1. Instances of modules hanging around. If you're creating new modules & those are getting published in sys.modules, then you'll keep these things around (you could manually remove them from sys.modules and they should be collected after that). 2. Code compiled in a module will not be collectible - it will get compiled into a type in-memory that won't get unloaded until app domain unload. Code compiled stand-alone (e.g. from Python doing exec or eval) will be collectible and go away when the GC kicks in. In general this should come down to RunFile* will not be collectible, and everything else is. We do have a mode, -X:GenerateAsSnippets, which forces everything to be generated in mode #2. But there are significant performance benefits to having the non-collectible code. Everything else should be collectible. ________________________________________ From: users-bounces at lists.ironpython.com On Behalf Of Alex Henderson Sent: Tuesday, June 27, 2006 6:19 PM To: 'Discussion of IronPython' Subject: Re: [IronPython] IP v8 Hosting question... Yeah, I arrived at this yesterday after some experimentation :) I've since dumped the idea of setting global variables (as it's obviously not thread safe for multiple threads evaluating the same expression) and now generate methods for the expression i.e. For an expression: "Hello" + Message I would end up generating def generated_method_1(Message): return "Hello" + Message Then execute that against a newly created module, then evaluate "generated_method_1", casting it to a PythonFunction and Call that with the array of values that make up my context... works well now and suits my needs perfectly as I can wrap up iron python to work with our standard scripting interfaces. When I no longer need these methods I set their value to None, but I'm wondering if generating methods like this will incur overhead I can't get back (ie. will my apps memory consumption just keep growing, until the python engine itself is shut down?) It certainly seems a little like that when I've been unit testing, but perhaps that's a side effect of the NUnit environment? Chez, - Alex > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Shri Borde > Sent: Wednesday, 28 June 2006 9:55 a.m. > To: Discussion of IronPython > Subject: Re: [IronPython] IP v8 Hosting question... > > We will are taking a look at the API and will be changing it a bit. > > The current way of doing this as follows: > > PythonEngine engine = new PythonEngine(); > > SymbolId id = SymbolTable.StringToId("Message"); > > ModuleScope scope1 = new ModuleScope("Junk1"); > scope1.SetGlobal(id, "hello"); > > ModuleScope scope2 = new ModuleScope("Junk2"); > scope2.SetGlobal(id, "goodbye"); > > Assert.AreEqual("hello", engine.Evaluate("Message", scope1, > ExecutionOptions.Default)); > > Assert.AreEqual("goodbye", engine.Evaluate("Message", scope2, > ExecutionOptions.Default)); > > Do you want to help develop Dynamic languages on CLR? > (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE- > 11F0-45DF-8B78-DC1B43134038) > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Alex Henderson > Sent: Monday, June 26, 2006 5:03 PM > To: 'Discussion of IronPython' > Subject: [IronPython] IP v8 Hosting question... > > I'm looking for the most appropriate way to "scope" variables for my > expression to evaluate that come from an external context (ie. Outside of > the python engine) - So far I have something working, using ModuleScope - > but is this the way I should be doing it? > > PythonEngine engine = new PythonEngine(); > > SymbolId id = SymbolTable.StringToId("Message"); > > ModuleScope scope1 = ModuleScope.MakeScopeForFunction(new > PythonModule("Junk", new Dict(), engine.Sys)); > scope1.SetGlobal(id, "hello"); > > ModuleScope scope2 = ModuleScope.MakeScopeForFunction(new > PythonModule("Junk", new Dict(), engine.Sys)); > scope2.SetGlobal(id, "goodbye"); > > Assert.AreEqual("hello", engine.Evaluate("Message", scope1, > ExecutionOptions.Default)); > > Assert.AreEqual("goodbye", engine.Evaluate("Message", scope2, > ExecutionOptions.Default)); > > Using this method I can evaluate around 2000 expressions a second, which > is > more the adequate for what I'm doing - but I'm concerned about memory > consumption... > > Chez, > > - Alex > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From alex at syzmk.com Wed Jun 28 05:15:05 2006 From: alex at syzmk.com (Alex Henderson) Date: Wed, 28 Jun 2006 15:15:05 +1200 Subject: [IronPython] IP v8 Hosting question... In-Reply-To: <50B69702CA6E6D4E849D30CD4989AB8E198D1B112D@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <009b01c69a61$0df6ef70$6701a8c0@tokai> Sweet, I'm naming the modules which probably explains where I'm running into issues... everything I use (that I care about collecting during runtime) are snippets... I don't imagine anything I have needs publishing in sys... incidentally to remove a module from sys, do I just need to do something like engine.Sys.modules.Remove(SymbolTable.StringToId(myModuleName)); ? > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Shri Borde > Sent: Wednesday, 28 June 2006 3:05 p.m. > To: Discussion of IronPython > Subject: Re: [IronPython] IP v8 Hosting question... > > We publish the ModuleScope to sys.modules if you do > scope = new ModuleScope("some name"); > We don't publish the ModuleScope if you do > scope = new ModuleScope(); > Note that we are thinking of changing this to let the user explicitly > chose whether the module is published to sys.modules. > > Code compiled by all the PythonEngine APIs should generate collectible > code except for: > If you pass in ExecutionOptions.EnableDebugging. > If you use ExecuteFileOptimized (formerly known as RunFile) > > You should not need to worry about memory leaks. I will add a test case to > ensure that this stays this way. > > Do you want to help develop Dynamic languages on CLR? > (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE- > 11F0-45DF-8B78-DC1B43134038) > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Dino Viehland > Sent: Tuesday, June 27, 2006 6:47 PM > To: Discussion of IronPython > Subject: Re: [IronPython] IP v8 Hosting question... > > Two things could be causing the increasing memory usage: > > 1. Instances of modules hanging around. If you're creating new modules & > those are getting published in sys.modules, then you'll keep these things > around (you could manually remove them from sys.modules and they should be > collected after that). > > 2. Code compiled in a module will not be collectible - it will get > compiled into a type in-memory that won't get unloaded until app domain > unload. Code compiled stand-alone (e.g. from Python doing exec or eval) > will be collectible and go away when the GC kicks in. In general this > should come down to RunFile* will not be collectible, and everything else > is. > > We do have a mode, -X:GenerateAsSnippets, which forces everything to be > generated in mode #2. But there are significant performance benefits to > having the non-collectible code. > > Everything else should be collectible. > > ________________________________________ > From: users-bounces at lists.ironpython.com On Behalf Of Alex Henderson > Sent: Tuesday, June 27, 2006 6:19 PM > To: 'Discussion of IronPython' > Subject: Re: [IronPython] IP v8 Hosting question... > > Yeah, I arrived at this yesterday after some experimentation :) I've since > dumped the idea of setting global variables (as it's obviously not thread > safe for multiple threads evaluating the same expression) and now generate > methods for the expression i.e. > > For an expression: "Hello" + Message > > I would end up generating > > def generated_method_1(Message): > return "Hello" + Message > > Then execute that against a newly created module, then evaluate > "generated_method_1", casting it to a PythonFunction and Call that > with the array of values that make up my context... works well now and > suits > my needs perfectly as I can wrap up iron python to work with our standard > scripting interfaces. > > When I no longer need these methods I set their value to None, but I'm > wondering if generating methods like this will incur overhead I can't get > back (ie. will my apps memory consumption just keep growing, until the > python engine itself is shut down?) It certainly seems a little like that > when I've been unit testing, but perhaps that's a side effect of the NUnit > environment? > > Chez, > > - Alex > > > -----Original Message----- > > From: users-bounces at lists.ironpython.com [mailto:users- > > bounces at lists.ironpython.com] On Behalf Of Shri Borde > > Sent: Wednesday, 28 June 2006 9:55 a.m. > > To: Discussion of IronPython > > Subject: Re: [IronPython] IP v8 Hosting question... > > > > We will are taking a look at the API and will be changing it a bit. > > > > The current way of doing this as follows: > > > > PythonEngine engine = new PythonEngine(); > > > > SymbolId id = SymbolTable.StringToId("Message"); > > > > ModuleScope scope1 = new ModuleScope("Junk1"); > > scope1.SetGlobal(id, "hello"); > > > > ModuleScope scope2 = new ModuleScope("Junk2"); > > scope2.SetGlobal(id, "goodbye"); > > > > Assert.AreEqual("hello", engine.Evaluate("Message", scope1, > > ExecutionOptions.Default)); > > > > Assert.AreEqual("goodbye", engine.Evaluate("Message", scope2, > > ExecutionOptions.Default)); > > > > Do you want to help develop Dynamic languages on CLR? > > > (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE- > > 11F0-45DF-8B78-DC1B43134038) > > > > -----Original Message----- > > From: users-bounces at lists.ironpython.com [mailto:users- > > bounces at lists.ironpython.com] On Behalf Of Alex Henderson > > Sent: Monday, June 26, 2006 5:03 PM > > To: 'Discussion of IronPython' > > Subject: [IronPython] IP v8 Hosting question... > > > > I'm looking for the most appropriate way to "scope" variables for my > > expression to evaluate that come from an external context (ie. Outside > of > > the python engine) - So far I have something working, using ModuleScope > - > > but is this the way I should be doing it? > > > > PythonEngine engine = new PythonEngine(); > > > > SymbolId id = SymbolTable.StringToId("Message"); > > > > ModuleScope scope1 = ModuleScope.MakeScopeForFunction(new > > PythonModule("Junk", new Dict(), engine.Sys)); > > scope1.SetGlobal(id, "hello"); > > > > ModuleScope scope2 = ModuleScope.MakeScopeForFunction(new > > PythonModule("Junk", new Dict(), engine.Sys)); > > scope2.SetGlobal(id, "goodbye"); > > > > Assert.AreEqual("hello", engine.Evaluate("Message", scope1, > > ExecutionOptions.Default)); > > > > Assert.AreEqual("goodbye", engine.Evaluate("Message", scope2, > > ExecutionOptions.Default)); > > > > Using this method I can evaluate around 2000 expressions a second, which > > is > > more the adequate for what I'm doing - but I'm concerned about memory > > consumption... > > > > Chez, > > > > - Alex > > > > _______________________________________________ > > users mailing list > > users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > > users mailing list > > users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From raathm at gmail.com Wed Jun 28 07:21:39 2006 From: raathm at gmail.com (Mike Raath) Date: Wed, 28 Jun 2006 07:21:39 +0200 Subject: [IronPython] "no module named win32api" using PyWin32-208 Message-ID: <664260580606272221p24eccdd1re808de0033a2aaaf@mail.gmail.com> I posted this on the *comp.lang.python * list yesterday but am not sure if that is the correct list to have posted on, so apologies for the cross-post but I would really appreciate some help on this. I have Python 2.4 installed on my local machine in c:\Python24. I have also downloaded the python for windows extensions installer pywin32-208.win32-py2.4.exe and installed this to C:\Python24\Lib\site-packages Trying to run a python script through a C# console app is causing me problems: the last line of code in the following block results in a no module named win32ap error. I'm not sure if this is because there is no win32api.py in the win32 folder off site-packages, just a win32api.pyc file. m_engine = new PythonEngine(); m_engine.AddToPath("C:\\Python24\\DLLs"); m_engine.AddToPath("C:\\Python24\\lib"); m_engine.AddToPath("C:\\Python24\\lib\\plat-win"); m_engine.AddToPath("C:\\Python24\\lib\\lib-tk"); m_engine.AddToPath("C:\\Python24\\Lib\\site-packages\\pythonwin"); m_engine.AddToPath("C:\\Python24"); m_engine.AddToPath("C:\\Python24\\lib\\site-packages"); m_engine.AddToPath("C:\\Python24\\lib\\site-packages\\win32"); m_engine.AddToPath("C:\\Python24\\lib\\site-packages\\win32\\lib"); m_engine.Execute("from win32api import win32api"); I have added all the addtopaths to get the path to match the sys.path I see in a normal python console which can successfully import the module. Incidentally, I have tried making the last line m_engine.Execute("import win32api"); with no luck. Can the win32 extensions handle compiled python modules? If not how can I get it to work? Thanks, Mike -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Wed Jun 28 07:46:56 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Tue, 27 Jun 2006 22:46:56 -0700 Subject: [IronPython] "no module named win32api" using PyWin32-208 In-Reply-To: <664260580606272221p24eccdd1re808de0033a2aaaf@mail.gmail.com> References: <664260580606272221p24eccdd1re808de0033a2aaaf@mail.gmail.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03EA465819@df-foxhound-msg.exchange.corp.microsoft.com> We don't support compiled Python modules (PYD's or PYC's, I'm not sure which one pywin32 is though I'd bet PYD) and isn't anything we'll support before 1.0. But if it's access to Win32 you want, there's a large amount of Win32 exposed through the .NET APIs that you can access directly by importing the appropriate namespaces (and adding references to the appropriate assemblies if it's not mscorlib or System). That may or may not work for you depending on what your goals are. ________________________________ From: users-bounces at lists.ironpython.com On Behalf Of Mike Raath Sent: Tuesday, June 27, 2006 10:21 PM To: users at lists.ironpython.com Subject: [IronPython] "no module named win32api" using PyWin32-208 I posted this on the comp.lang.python list yesterday but am not sure if that is the correct list to have posted on, so apologies for the cross-post but I would really appreciate some help on this. I have Python 2.4 installed on my local machine in c:\Python24. I have also downloaded the python for windows extensions installer pywin32-208.win32-py2.4.exe and installed this to C:\Python24\Lib\site-packages Trying to run a python script through a C# console app is causing me problems: the last line of code in the following block results in a no module named win32ap error. I'm not sure if this is because there is no win32api.py in the win32 folder off site-packages, just a win32api.pyc file. m_engine = new PythonEngine(); m_engine.AddToPath("C:\\Python24\\DLLs"); m_engine.AddToPath("C:\\Python24\\lib"); m_engine.AddToPath("C:\\Python24\\lib\\plat-win"); m_engine.AddToPath("C:\\Python24\\lib\\lib-tk"); m_engine.AddToPath("C:\\Python24\\Lib\\site-packages\\pythonwin"); m_engine.AddToPath("C:\\Python24"); m_engine.AddToPath("C:\\Python24\\lib\\site-packages"); m_engine.AddToPath("C:\\Python24\\lib\\site-packages\\win32"); m_engine.AddToPath("C:\\Python24\\lib\\site-packages\\win32\\lib"); m_engine.Execute("from win32api import win32api"); I have added all the addtopaths to get the path to match the sys.path I see in a normal python console which can successfully import the module. Incidentally, I have tried making the last line m_engine.Execute("import win32api"); with no luck. Can the win32 extensions handle compiled python modules? If not how can I get it to work? Thanks, Mike -------------- next part -------------- An HTML attachment was scrubbed... URL: From raathm at gmail.com Wed Jun 28 08:01:03 2006 From: raathm at gmail.com (Mike Raath) Date: Wed, 28 Jun 2006 08:01:03 +0200 Subject: [IronPython] "no module named win32api" using PyWin32-208 In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E03EA465819@df-foxhound-msg.exchange.corp.microsoft.com> References: <664260580606272221p24eccdd1re808de0033a2aaaf@mail.gmail.com> <4039D552ADAB094BB1EA670F3E96214E03EA465819@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <664260580606272301n587730a1w6de8d46a094b854c@mail.gmail.com> Thanks, Dino, I'm looking at that. (It's a .pyc, btw) A bit of background - I've got some Python script running server-side which does screen-scraping based on definitions in a MS SQL Server db, and I'm trying to come up with a maintenance app where an administrator can define the screen-scraping, and view the effect of their definition. The server script uses COM ADO through the win32 extensions, and the admin app is in .Net. I was hoping to be able to use the Python classes as-is, but I can modify the .py file which will live with the webapp slightly so that it uses .Net ADO, or even COM ADO. It's a great product, by the way. Just one thing - I've been reading about how IronPython is pretty fast, but I've come across an area where it's quite slow. It seems that creating a BeautifulSoup object to parse a web page is slow; not sure if that's something you'd like to benchmark. Cheers, Mike On 6/28/06, Dino Viehland wrote: > > We don't support compiled Python modules (PYD's or PYC's, I'm not sure > which one pywin32 is though I'd bet PYD) and isn't anything we'll support > before 1.0. But if it's access to Win32 you want, there's a large amount > of Win32 exposed through the .NET APIs that you can access directly by > importing the appropriate namespaces (and adding references to the > appropriate assemblies if it's not mscorlib or System). > > That may or may not work for you depending on what your goals are. > > > ------------------------------ > *From:* users-bounces at lists.ironpython.com On Behalf Of Mike Raath > *Sent:* Tuesday, June 27, 2006 10:21 PM > *To:* users at lists.ironpython.com > *Subject:* [IronPython] "no module named win32api" using PyWin32-208 > > I posted this on the *comp.lang.python > *list yesterday but am not sure if that is the correct list to have posted > on, so apologies for the cross-post but I would really appreciate some help > on this. > > I have Python 2.4 installed on my local machine in c:\Python24. I have > also downloaded the python for windows extensions installer > pywin32-208.win32-py2.4.exe and installed this to > C:\Python24\Lib\site-packages > > Trying to run a python script through a C# console app is causing me > problems: the last line of code in the following block results in a no > module named win32ap error. I'm not sure if this is because there is no > win32api.py in the win32 folder off site-packages, just a win32api.pyc > file. > > m_engine = new PythonEngine(); > > m_engine.AddToPath("C:\\Python24\\DLLs"); > m_engine.AddToPath("C:\\Python24\\lib"); > m_engine.AddToPath("C:\\Python24\\lib\\plat-win"); > m_engine.AddToPath("C:\\Python24\\lib\\lib-tk"); > > m_engine.AddToPath("C:\\Python24\\Lib\\site-packages\\pythonwin"); > m_engine.AddToPath("C:\\Python24"); > m_engine.AddToPath("C:\\Python24\\lib\\site-packages"); > > m_engine.AddToPath("C:\\Python24\\lib\\site-packages\\win32"); > > m_engine.AddToPath("C:\\Python24\\lib\\site-packages\\win32\\lib"); > > m_engine.Execute("from win32api import win32api"); > > I have added all the addtopaths to get the path to match the sys.path I > see in a normal python console which can successfully import the > module. > > Incidentally, I have tried making the last line > m_engine.Execute("import win32api"); > with no luck. > > Can the win32 extensions handle compiled python modules? If not how can > I get it to work? > Thanks, > Mike > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Wed Jun 28 17:07:16 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Wed, 28 Jun 2006 08:07:16 -0700 Subject: [IronPython] "no module named win32api" using PyWin32-208 In-Reply-To: <664260580606272301n587730a1w6de8d46a094b854c@mail.gmail.com> References: <664260580606272221p24eccdd1re808de0033a2aaaf@mail.gmail.com> <4039D552ADAB094BB1EA670F3E96214E03EA465819@df-foxhound-msg.exchange.corp.microsoft.com> <664260580606272301n587730a1w6de8d46a094b854c@mail.gmail.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03E9FC7D4C@df-foxhound-msg.exchange.corp.microsoft.com> I would recommend going w/ .NET ADO. You can get started w/: import clr clr.AddReference('System.Data') import System.Data as SD and then you have SD.* available to you. On the BeautifulSoup object - what is a BeautifulSoup object? You can either give us more details here, or you can open an issue on CodePlex (http://www.codeplex.com/Wiki/View.aspx?ProjectName=IronPython). Unfortunately we're not planning on revisiting performance again until after v1.0 ships, but it is something that we always care about. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Mike Raath Sent: Tuesday, June 27, 2006 11:01 PM To: Discussion of IronPython Subject: Re: [IronPython] "no module named win32api" using PyWin32-208 Thanks, Dino, I'm looking at that. (It's a .pyc, btw) A bit of background - I've got some Python script running server-side which does screen-scraping based on definitions in a MS SQL Server db, and I'm trying to come up with a maintenance app where an administrator can define the screen-scraping, and view the effect of their definition. The server script uses COM ADO through the win32 extensions, and the admin app is in .Net. I was hoping to be able to use the Python classes as-is, but I can modify the .py file which will live with the webapp slightly so that it uses .Net ADO, or even COM ADO. It's a great product, by the way. Just one thing - I've been reading about how IronPython is pretty fast, but I've come across an area where it's quite slow. It seems that creating a BeautifulSoup object to parse a web page is slow; not sure if that's something you'd like to benchmark. Cheers, Mike On 6/28/06, Dino Viehland > wrote: We don't support compiled Python modules (PYD's or PYC's, I'm not sure which one pywin32 is though I'd bet PYD) and isn't anything we'll support before 1.0. But if it's access to Win32 you want, there's a large amount of Win32 exposed through the .NET APIs that you can access directly by importing the appropriate namespaces (and adding references to the appropriate assemblies if it's not mscorlib or System). That may or may not work for you depending on what your goals are. ________________________________ From: users-bounces at lists.ironpython.com On Behalf Of Mike Raath Sent: Tuesday, June 27, 2006 10:21 PM To: users at lists.ironpython.com Subject: [IronPython] "no module named win32api" using PyWin32-208 I posted this on the comp.lang.python list yesterday but am not sure if that is the correct list to have posted on, so apologies for the cross-post but I would really appreciate some help on this. I have Python 2.4 installed on my local machine in c:\Python24. I have also downloaded the python for windows extensions installer pywin32-208.win32-py2.4.exe and installed this to C:\Python24\Lib\site-packages Trying to run a python script through a C# console app is causing me problems: the last line of code in the following block results in a no module named win32ap error. I'm not sure if this is because there is no win32api.py in the win32 folder off site-packages, just a win32api.pyc file. m_engine = new PythonEngine(); m_engine.AddToPath("C:\\Python24\\DLLs"); m_engine.AddToPath("C:\\Python24\\lib"); m_engine.AddToPath("C:\\Python24\\lib\\plat-win"); m_engine.AddToPath("C:\\Python24\\lib\\lib-tk"); m_engine.AddToPath("C:\\Python24\\Lib\\site-packages\\pythonwin"); m_engine.AddToPath("C:\\Python24"); m_engine.AddToPath("C:\\Python24\\lib\\site-packages"); m_engine.AddToPath("C:\\Python24\\lib\\site-packages\\win32"); m_engine.AddToPath("C:\\Python24\\lib\\site-packages\\win32\\lib"); m_engine.Execute("from win32api import win32api"); I have added all the addtopaths to get the path to match the sys.path I see in a normal python console which can successfully import the module. Incidentally, I have tried making the last line m_engine.Execute("import win32api"); with no luck. Can the win32 extensions handle compiled python modules? If not how can I get it to work? Thanks, Mike _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From raathm at gmail.com Wed Jun 28 17:16:03 2006 From: raathm at gmail.com (Mike Raath) Date: Wed, 28 Jun 2006 17:16:03 +0200 Subject: [IronPython] "no module named win32api" using PyWin32-208 In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E03E9FC7D4C@df-foxhound-msg.exchange.corp.microsoft.com> References: <664260580606272221p24eccdd1re808de0033a2aaaf@mail.gmail.com> <4039D552ADAB094BB1EA670F3E96214E03EA465819@df-foxhound-msg.exchange.corp.microsoft.com> <664260580606272301n587730a1w6de8d46a094b854c@mail.gmail.com> <4039D552ADAB094BB1EA670F3E96214E03E9FC7D4C@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <664260580606280816v745c72e3t97e09266e2dec0a9@mail.gmail.com> I have gone with ADO.Net on the admin web application, and this is fine as it's running within the .Net web application. It just deviates slightly from the codebase on the server which is running in the standard Python runtime, but I can live with that. On the BeautifulSoup, sorry - as a newb in the Python sphere I don't know what's common knowledge and what's not. BeautifulSoup is an excellent html parser, much better than the parsers that ship with Python, which sympathetically parses HTML so dealing with missing closing tags and other common malformed html issues - vital if you're scraping html from external sites over which you have no control. The project is here: http://www.crummy.com/software/BeautifulSoup/ and there's a fair bit on the web for it too. On 6/28/06, Dino Viehland wrote: > > I would recommend going w/ .NET ADO. You can get started w/: > > > > import clr > > clr.AddReference('System.Data') > > > > import System.Data as SD > > > > and then you have SD.* available to you. > > > > On the BeautifulSoup object ? what is a BeautifulSoup object? You can > either give us more details here, or you can open an issue on CodePlex ( > http://www.codeplex.com/Wiki/View.aspx?ProjectName=IronPython). > Unfortunately we're not planning on revisiting performance again until after > v1.0 ships, but it is something that we always care about. > > > > > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Mike Raath > *Sent:* Tuesday, June 27, 2006 11:01 PM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] "no module named win32api" using PyWin32-208 > > > > Thanks, Dino, I'm looking at that. (It's a .pyc, btw) > > A bit of background - I've got some Python script running server-side > which does screen-scraping based on definitions in a MS SQL Server db, and > I'm trying to come up with a maintenance app where an administrator can > define the screen-scraping, and view the effect of their definition. The > server script uses COM ADO through the win32 extensions, and the admin app > is in .Net. I was hoping to be able to use the Python classes as-is, but I > can modify the .py file which will live with the webapp slightly so that it > uses .Net ADO, or even COM ADO. > > It's a great product, by the way. Just one thing - I've been reading about > how IronPython is pretty fast, but I've come across an area where it's quite > slow. It seems that creating a BeautifulSoup object to parse a web page is > slow; not sure if that's something you'd like to benchmark. > > Cheers, > Mike > > On 6/28/06, *Dino Viehland* wrote: > > We don't support compiled Python modules (PYD's or PYC's, I'm not sure > which one pywin32 is though I'd bet PYD) and isn't anything we'll support > before 1.0. But if it's access to Win32 you want, there's a large amount > of Win32 exposed through the .NET APIs that you can access directly by > importing the appropriate namespaces (and adding references to the > appropriate assemblies if it's not mscorlib or System). > > > > That may or may not work for you depending on what your goals are. > > > > > ------------------------------ > > *From:* users-bounces at lists.ironpython.com On Behalf Of Mike Raath > *Sent:* Tuesday, June 27, 2006 10:21 PM > *To:* users at lists.ironpython.com > *Subject:* [IronPython] "no module named win32api" using PyWin32-208 > > I posted this on the *comp.lang.python > *list yesterday but am not sure if that is the correct list to have posted > on, so apologies for the cross-post but I would really appreciate some help > on this. > > I have Python 2.4 installed on my local machine in c:\Python24. I have > also downloaded the python for windows extensions installer > pywin32-208.win32-py2.4.exe and installed this to > C:\Python24\Lib\site-packages > > Trying to run a python script through a C# console app is causing me > problems: the last line of code in the following block results in a no > module named win32ap error. I'm not sure if this is because there is no > win32api.py in the win32 folder off site-packages, just a win32api.pyc > file. > > m_engine = new PythonEngine(); > > m_engine.AddToPath("C:\\Python24\\DLLs"); > m_engine.AddToPath("C:\\Python24\\lib"); > m_engine.AddToPath("C:\\Python24\\lib\\plat-win"); > m_engine.AddToPath("C:\\Python24\\lib\\lib-tk"); > > m_engine.AddToPath("C:\\Python24\\Lib\\site-packages\\pythonwin"); > m_engine.AddToPath("C:\\Python24"); > m_engine.AddToPath("C:\\Python24\\lib\\site-packages"); > > m_engine.AddToPath("C:\\Python24\\lib\\site-packages\\win32"); > > m_engine.AddToPath("C:\\Python24\\lib\\site-packages\\win32\\lib"); > > m_engine.Execute("from win32api import win32api"); > > I have added all the addtopaths to get the path to match the sys.path I > see in a normal python console which can successfully import the > module. > > Incidentally, I have tried making the last line > m_engine.Execute("import win32api"); > with no luck. > > Can the win32 extensions handle compiled python modules? If not how can > I get it to work? > > Thanks, > Mike > > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Wed Jun 28 17:37:03 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Wed, 28 Jun 2006 08:37:03 -0700 Subject: [IronPython] "no module named win32api" using PyWin32-208 In-Reply-To: <664260580606280816v745c72e3t97e09266e2dec0a9@mail.gmail.com> References: <664260580606272221p24eccdd1re808de0033a2aaaf@mail.gmail.com> <4039D552ADAB094BB1EA670F3E96214E03EA465819@df-foxhound-msg.exchange.corp.microsoft.com> <664260580606272301n587730a1w6de8d46a094b854c@mail.gmail.com> <4039D552ADAB094BB1EA670F3E96214E03E9FC7D4C@df-foxhound-msg.exchange.corp.microsoft.com> <664260580606280816v745c72e3t97e09266e2dec0a9@mail.gmail.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03E9FC7D7D@df-foxhound-msg.exchange.corp.microsoft.com> Ahh, thanks for the BeautifulSoup explanation... I've opened bug #651 on CodePlex to track it and make sure we don't forget about it post 1.0. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Mike Raath Sent: Wednesday, June 28, 2006 8:16 AM To: Discussion of IronPython Subject: Re: [IronPython] "no module named win32api" using PyWin32-208 I have gone with ADO.Net on the admin web application, and this is fine as it's running within the .Net web application. It just deviates slightly from the codebase on the server which is running in the standard Python runtime, but I can live with that. On the BeautifulSoup, sorry - as a newb in the Python sphere I don't know what's common knowledge and what's not. BeautifulSoup is an excellent html parser, much better than the parsers that ship with Python, which sympathetically parses HTML so dealing with missing closing tags and other common malformed html issues - vital if you're scraping html from external sites over which you have no control. The project is here: http://www.crummy.com/software/BeautifulSoup/ and there's a fair bit on the web for it too. On 6/28/06, Dino Viehland > wrote: I would recommend going w/ .NET ADO. You can get started w/: import clr clr.AddReference('System.Data') import System.Data as SD and then you have SD.* available to you. On the BeautifulSoup object - what is a BeautifulSoup object? You can either give us more details here, or you can open an issue on CodePlex (http://www.codeplex.com/Wiki/View.aspx?ProjectName=IronPython ). Unfortunately we're not planning on revisiting performance again until after v1.0 ships, but it is something that we always care about. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Mike Raath Sent: Tuesday, June 27, 2006 11:01 PM To: Discussion of IronPython Subject: Re: [IronPython] "no module named win32api" using PyWin32-208 Thanks, Dino, I'm looking at that. (It's a .pyc, btw) A bit of background - I've got some Python script running server-side which does screen-scraping based on definitions in a MS SQL Server db, and I'm trying to come up with a maintenance app where an administrator can define the screen-scraping, and view the effect of their definition. The server script uses COM ADO through the win32 extensions, and the admin app is in .Net. I was hoping to be able to use the Python classes as-is, but I can modify the .py file which will live with the webapp slightly so that it uses .Net ADO, or even COM ADO. It's a great product, by the way. Just one thing - I've been reading about how IronPython is pretty fast, but I've come across an area where it's quite slow. It seems that creating a BeautifulSoup object to parse a web page is slow; not sure if that's something you'd like to benchmark. Cheers, Mike On 6/28/06, Dino Viehland > wrote: We don't support compiled Python modules (PYD's or PYC's, I'm not sure which one pywin32 is though I'd bet PYD) and isn't anything we'll support before 1.0. But if it's access to Win32 you want, there's a large amount of Win32 exposed through the .NET APIs that you can access directly by importing the appropriate namespaces (and adding references to the appropriate assemblies if it's not mscorlib or System). That may or may not work for you depending on what your goals are. ________________________________ From: users-bounces at lists.ironpython.com On Behalf Of Mike Raath Sent: Tuesday, June 27, 2006 10:21 PM To: users at lists.ironpython.com Subject: [IronPython] "no module named win32api" using PyWin32-208 I posted this on the comp.lang.python list yesterday but am not sure if that is the correct list to have posted on, so apologies for the cross-post but I would really appreciate some help on this. I have Python 2.4 installed on my local machine in c:\Python24. I have also downloaded the python for windows extensions installer pywin32-208.win32-py2.4.exe and installed this to C:\Python24\Lib\site-packages Trying to run a python script through a C# console app is causing me problems: the last line of code in the following block results in a no module named win32ap error. I'm not sure if this is because there is no win32api.py in the win32 folder off site-packages, just a win32api.pyc file. m_engine = new PythonEngine(); m_engine.AddToPath("C:\\Python24\\DLLs"); m_engine.AddToPath("C:\\Python24\\lib"); m_engine.AddToPath("C:\\Python24\\lib\\plat-win"); m_engine.AddToPath("C:\\Python24\\lib\\lib-tk"); m_engine.AddToPath("C:\\Python24\\Lib\\site-packages\\pythonwin"); m_engine.AddToPath("C:\\Python24"); m_engine.AddToPath("C:\\Python24\\lib\\site-packages"); m_engine.AddToPath("C:\\Python24\\lib\\site-packages\\win32"); m_engine.AddToPath("C:\\Python24\\lib\\site-packages\\win32\\lib"); m_engine.Execute("from win32api import win32api"); I have added all the addtopaths to get the path to match the sys.path I see in a normal python console which can successfully import the module. Incidentally, I have tried making the last line m_engine.Execute("import win32api"); with no luck. Can the win32 extensions handle compiled python modules? If not how can I get it to work? Thanks, Mike _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Shri.Borde at microsoft.com Wed Jun 28 19:33:45 2006 From: Shri.Borde at microsoft.com (Shri Borde) Date: Wed, 28 Jun 2006 10:33:45 -0700 Subject: [IronPython] IP v8 Hosting question... In-Reply-To: <009b01c69a61$0df6ef70$6701a8c0@tokai> Message-ID: <50B69702CA6E6D4E849D30CD4989AB8E198D1B1240@DF-GRTDANE-MSG.exchange.corp.microsoft.com> You would need to do the following. engine.Sys.modules.Remove(myModuleName); Since engine.Sys.modules is a regular Python dict, it is indexed using strings, not SymbolIDs. Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038) -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Alex Henderson Sent: Tuesday, June 27, 2006 8:15 PM To: 'Discussion of IronPython' Subject: Re: [IronPython] IP v8 Hosting question... Sweet, I'm naming the modules which probably explains where I'm running into issues... everything I use (that I care about collecting during runtime) are snippets... I don't imagine anything I have needs publishing in sys... incidentally to remove a module from sys, do I just need to do something like engine.Sys.modules.Remove(SymbolTable.StringToId(myModuleName)); ? > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Shri Borde > Sent: Wednesday, 28 June 2006 3:05 p.m. > To: Discussion of IronPython > Subject: Re: [IronPython] IP v8 Hosting question... > > We publish the ModuleScope to sys.modules if you do > scope = new ModuleScope("some name"); > We don't publish the ModuleScope if you do > scope = new ModuleScope(); > Note that we are thinking of changing this to let the user explicitly > chose whether the module is published to sys.modules. > > Code compiled by all the PythonEngine APIs should generate collectible > code except for: > If you pass in ExecutionOptions.EnableDebugging. > If you use ExecuteFileOptimized (formerly known as RunFile) > > You should not need to worry about memory leaks. I will add a test case to > ensure that this stays this way. > > Do you want to help develop Dynamic languages on CLR? > (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE- > 11F0-45DF-8B78-DC1B43134038) > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Dino Viehland > Sent: Tuesday, June 27, 2006 6:47 PM > To: Discussion of IronPython > Subject: Re: [IronPython] IP v8 Hosting question... > > Two things could be causing the increasing memory usage: > > 1. Instances of modules hanging around. If you're creating new modules & > those are getting published in sys.modules, then you'll keep these things > around (you could manually remove them from sys.modules and they should be > collected after that). > > 2. Code compiled in a module will not be collectible - it will get > compiled into a type in-memory that won't get unloaded until app domain > unload. Code compiled stand-alone (e.g. from Python doing exec or eval) > will be collectible and go away when the GC kicks in. In general this > should come down to RunFile* will not be collectible, and everything else > is. > > We do have a mode, -X:GenerateAsSnippets, which forces everything to be > generated in mode #2. But there are significant performance benefits to > having the non-collectible code. > > Everything else should be collectible. > > ________________________________________ > From: users-bounces at lists.ironpython.com On Behalf Of Alex Henderson > Sent: Tuesday, June 27, 2006 6:19 PM > To: 'Discussion of IronPython' > Subject: Re: [IronPython] IP v8 Hosting question... > > Yeah, I arrived at this yesterday after some experimentation :) I've since > dumped the idea of setting global variables (as it's obviously not thread > safe for multiple threads evaluating the same expression) and now generate > methods for the expression i.e. > > For an expression: "Hello" + Message > > I would end up generating > > def generated_method_1(Message): > return "Hello" + Message > > Then execute that against a newly created module, then evaluate > "generated_method_1", casting it to a PythonFunction and Call that > with the array of values that make up my context... works well now and > suits > my needs perfectly as I can wrap up iron python to work with our standard > scripting interfaces. > > When I no longer need these methods I set their value to None, but I'm > wondering if generating methods like this will incur overhead I can't get > back (ie. will my apps memory consumption just keep growing, until the > python engine itself is shut down?) It certainly seems a little like that > when I've been unit testing, but perhaps that's a side effect of the NUnit > environment? > > Chez, > > - Alex > > > -----Original Message----- > > From: users-bounces at lists.ironpython.com [mailto:users- > > bounces at lists.ironpython.com] On Behalf Of Shri Borde > > Sent: Wednesday, 28 June 2006 9:55 a.m. > > To: Discussion of IronPython > > Subject: Re: [IronPython] IP v8 Hosting question... > > > > We will are taking a look at the API and will be changing it a bit. > > > > The current way of doing this as follows: > > > > PythonEngine engine = new PythonEngine(); > > > > SymbolId id = SymbolTable.StringToId("Message"); > > > > ModuleScope scope1 = new ModuleScope("Junk1"); > > scope1.SetGlobal(id, "hello"); > > > > ModuleScope scope2 = new ModuleScope("Junk2"); > > scope2.SetGlobal(id, "goodbye"); > > > > Assert.AreEqual("hello", engine.Evaluate("Message", scope1, > > ExecutionOptions.Default)); > > > > Assert.AreEqual("goodbye", engine.Evaluate("Message", scope2, > > ExecutionOptions.Default)); > > > > Do you want to help develop Dynamic languages on CLR? > > > (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE- > > 11F0-45DF-8B78-DC1B43134038) > > > > -----Original Message----- > > From: users-bounces at lists.ironpython.com [mailto:users- > > bounces at lists.ironpython.com] On Behalf Of Alex Henderson > > Sent: Monday, June 26, 2006 5:03 PM > > To: 'Discussion of IronPython' > > Subject: [IronPython] IP v8 Hosting question... > > > > I'm looking for the most appropriate way to "scope" variables for my > > expression to evaluate that come from an external context (ie. Outside > of > > the python engine) - So far I have something working, using ModuleScope > - > > but is this the way I should be doing it? > > > > PythonEngine engine = new PythonEngine(); > > > > SymbolId id = SymbolTable.StringToId("Message"); > > > > ModuleScope scope1 = ModuleScope.MakeScopeForFunction(new > > PythonModule("Junk", new Dict(), engine.Sys)); > > scope1.SetGlobal(id, "hello"); > > > > ModuleScope scope2 = ModuleScope.MakeScopeForFunction(new > > PythonModule("Junk", new Dict(), engine.Sys)); > > scope2.SetGlobal(id, "goodbye"); > > > > Assert.AreEqual("hello", engine.Evaluate("Message", scope1, > > ExecutionOptions.Default)); > > > > Assert.AreEqual("goodbye", engine.Evaluate("Message", scope2, > > ExecutionOptions.Default)); > > > > Using this method I can evaluate around 2000 expressions a second, which > > is > > more the adequate for what I'm doing - but I'm concerned about memory > > consumption... > > > > Chez, > > > > - Alex > > > > _______________________________________________ > > users mailing list > > users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > > users mailing list > > users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From jorgen.stenarson at bostream.nu Wed Jun 28 20:36:49 2006 From: jorgen.stenarson at bostream.nu (=?ISO-8859-1?Q?J=F6rgen_Stenarson?=) Date: Wed, 28 Jun 2006 20:36:49 +0200 Subject: [IronPython] Bug when calling ironpythonconsole from powershell Message-ID: <44A2CC41.3020903@bostream.nu> Hi I have a problem calling ironpythonconsole from windows powershell using the -X: options. Below are excerpts from sessions both in cmd.exe and powershell: From cmd.exe: C:\IronPython>IronPythonConsole.exe -X:SaveAssemblies hej.py HELLO WORLD! From windows powershell: PS C:\IronPython> IronPythonConsole.exe -X:SaveAssemblies hej.py File -X: does not exist looks like there is some issue with commandline parsing. Best regards, J?rgen Stenarson From jorgen.stenarson at bostream.nu Wed Jun 28 20:44:27 2006 From: jorgen.stenarson at bostream.nu (=?ISO-8859-1?Q?J=F6rgen_Stenarson?=) Date: Wed, 28 Jun 2006 20:44:27 +0200 Subject: [IronPython] ironpython alternative to PyOS_ReadlineFunctionPointer Message-ID: <44A2CE0B.4050107@bostream.nu> Hi, I'm working on a python based implementation of readline (pyreadline available from http://projects.scipy.org/ipython/ipython/wiki/PyReadline/Intro). I'm experimenting with adding support for ironpython, I have been successful in porting some of the ctypes based routines used for keyboard event processing to ironpython using System.Console. It has been quite painless so far. But to take this further I need to know the ironpython equivalent to PyOS_ReadlineFunctionPointer in cpython and how to use it. Is this functionality exposed and if not do you plan to expose it? Best regards, J?rgen Stenarson From dinov at exchange.microsoft.com Wed Jun 28 20:53:27 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Wed, 28 Jun 2006 11:53:27 -0700 Subject: [IronPython] ironpython alternative to PyOS_ReadlineFunctionPointer In-Reply-To: <44A2CE0B.4050107@bostream.nu> References: <44A2CE0B.4050107@bostream.nu> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03E9FC8051@df-foxhound-msg.exchange.corp.microsoft.com> Is IronPython.Runtime.Operations.Ops.ReadLineFromSrc what you're looking for? This allows you to read a line of input from std-in. I'm not familiar w/ CPython's internal interfaces so I'm not sure if that's right or not... The other option is that this is the functionality that lives in the console, and you want IConsole.ReadLine. Currently these two are rather disconnected. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of J?rgen Stenarson Sent: Wednesday, June 28, 2006 11:44 AM To: Discussion of IronPython Subject: [IronPython] ironpython alternative to PyOS_ReadlineFunctionPointer Hi, I'm working on a python based implementation of readline (pyreadline available from http://projects.scipy.org/ipython/ipython/wiki/PyReadline/Intro). I'm experimenting with adding support for ironpython, I have been successful in porting some of the ctypes based routines used for keyboard event processing to ironpython using System.Console. It has been quite painless so far. But to take this further I need to know the ironpython equivalent to PyOS_ReadlineFunctionPointer in cpython and how to use it. Is this functionality exposed and if not do you plan to expose it? Best regards, J?rgen Stenarson _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From jorgen.stenarson at bostream.nu Wed Jun 28 23:21:11 2006 From: jorgen.stenarson at bostream.nu (=?ISO-8859-1?Q?J=F6rgen_Stenarson?=) Date: Wed, 28 Jun 2006 23:21:11 +0200 Subject: [IronPython] ironpython alternative to PyOS_ReadlineFunctionPointer In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E03E9FC8051@df-foxhound-msg.exchange.corp.microsoft.com> References: <44A2CE0B.4050107@bostream.nu> <4039D552ADAB094BB1EA670F3E96214E03E9FC8051@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <44A2F2C7.90505@bostream.nu> Thanks for the response, I will have to investigate this further. Just to clarify, what I want to do is replace the function that is called by the ironpython interpreter to read a line of text from the user. /J?rgen Dino Viehland skrev: > Is IronPython.Runtime.Operations.Ops.ReadLineFromSrc what you're looking for? This allows you to read a line of input from std-in. > > I'm not familiar w/ CPython's internal interfaces so I'm not sure if that's right or not... The other option is that this is the functionality that lives in the console, and you want IConsole.ReadLine. > > Currently these two are rather disconnected. > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of J?rgen Stenarson > Sent: Wednesday, June 28, 2006 11:44 AM > To: Discussion of IronPython > Subject: [IronPython] ironpython alternative to PyOS_ReadlineFunctionPointer > > Hi, > > I'm working on a python based implementation of readline (pyreadline available from http://projects.scipy.org/ipython/ipython/wiki/PyReadline/Intro). I'm experimenting with adding support for ironpython, I have been successful in porting some of the ctypes based routines used for keyboard event processing to ironpython using System.Console. It has been quite painless so far. > > But to take this further I need to know the ironpython equivalent to PyOS_ReadlineFunctionPointer in cpython and how to use it. Is this functionality exposed and if not do you plan to expose it? > > Best regards, > J?rgen Stenarson > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From dinov at exchange.microsoft.com Wed Jun 28 23:28:09 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Wed, 28 Jun 2006 14:28:09 -0700 Subject: [IronPython] ironpython alternative to PyOS_ReadlineFunctionPointer In-Reply-To: <44A2F2C7.90505@bostream.nu> References: <44A2CE0B.4050107@bostream.nu> <4039D552ADAB094BB1EA670F3E96214E03E9FC8051@df-foxhound-msg.exchange.corp.microsoft.com> <44A2F2C7.90505@bostream.nu> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03E9FC8268@df-foxhound-msg.exchange.corp.microsoft.com> Ops.ReadLineFromSrc will be called if for example someone calls raw_input() from Python (one way to read from the user). IConsole.ReadLine gets called when we're reading input from the console for some code you're typing in. I think ideally these would be using the same underlying implementation but do to the extra things our fancy console does they're rather divergent today. For readline I suspect you'll want to be updating IConsole.ReadLine instead. Also it'd be great if you could keep us updated when you get something working. One of our PMs has wanted good history support, and I think Bruce (who implemented socket as part of his internship this summer) might prefer readline's key bindings :). -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of J?rgen Stenarson Sent: Wednesday, June 28, 2006 2:21 PM To: Discussion of IronPython Subject: Re: [IronPython] ironpython alternative to PyOS_ReadlineFunctionPointer Thanks for the response, I will have to investigate this further. Just to clarify, what I want to do is replace the function that is called by the ironpython interpreter to read a line of text from the user. /J?rgen Dino Viehland skrev: > Is IronPython.Runtime.Operations.Ops.ReadLineFromSrc what you're looking for? This allows you to read a line of input from std-in. > > I'm not familiar w/ CPython's internal interfaces so I'm not sure if that's right or not... The other option is that this is the functionality that lives in the console, and you want IConsole.ReadLine. > > Currently these two are rather disconnected. > > -----Original Message----- > From: users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] On Behalf Of J?rgen > Stenarson > Sent: Wednesday, June 28, 2006 11:44 AM > To: Discussion of IronPython > Subject: [IronPython] ironpython alternative to > PyOS_ReadlineFunctionPointer > > Hi, > > I'm working on a python based implementation of readline (pyreadline available from http://projects.scipy.org/ipython/ipython/wiki/PyReadline/Intro). I'm experimenting with adding support for ironpython, I have been successful in porting some of the ctypes based routines used for keyboard event processing to ironpython using System.Console. It has been quite painless so far. > > But to take this further I need to know the ironpython equivalent to PyOS_ReadlineFunctionPointer in cpython and how to use it. Is this functionality exposed and if not do you plan to expose it? > > Best regards, > J?rgen Stenarson > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From daftspaniel at gmail.com Thu Jun 29 13:49:48 2006 From: daftspaniel at gmail.com (Davy Mitchell) Date: Thu, 29 Jun 2006 12:49:48 +0100 Subject: [IronPython] Module issue? Message-ID: <20253b0c0606290449g5d072e38y545eb2572f700b90@mail.gmail.com> Hi Everyone, On standard Python this script produces '': import datetime print datetime.datetime On IronPython 'AttributeError: 'module' object has no attribute 'datetime'.... import sys sys.path.append("c:/Python24/Lib") import datetime print datetime.datetime I am trying to get Kirbybase to run on IronPython - no idea why it needs to use datetime.datetime !! Thanks Davy Mitchell Mood News - BBC News Headlines Auto-Classified as Good, Bad or Neutral. http://www.latedecember.com/sites/moodnews/ From william at resolversystems.com Thu Jun 29 16:14:39 2006 From: william at resolversystems.com (William Reade) Date: Thu, 29 Jun 2006 15:14:39 +0100 Subject: [IronPython] Adding None to a set Message-ID: <44A3E04F.1020003@resolversystems.com> Hi guys As if you didn't have enough on your plates already... IronPython beta8: >>> st = set([]) >>> st.add(None) >>> st set([]) CPython: >>> st = set([]) >>> st.add(None) >>> st set([None]) Cheers William From dinov at exchange.microsoft.com Thu Jun 29 19:07:55 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Thu, 29 Jun 2006 10:07:55 -0700 Subject: [IronPython] Module issue? In-Reply-To: <20253b0c0606290449g5d072e38y545eb2572f700b90@mail.gmail.com> References: <20253b0c0606290449g5d072e38y545eb2572f700b90@mail.gmail.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03EEF22EEC@df-foxhound-msg.exchange.corp.microsoft.com> This is a bug - we're missing the datetime class. I've opened bug http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&WorkItemId=676 for this and we should be able to get it implemented for the next release. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Davy Mitchell Sent: Thursday, June 29, 2006 4:50 AM To: Discussion of IronPython Subject: [IronPython] Module issue? Hi Everyone, On standard Python this script produces '': import datetime print datetime.datetime On IronPython 'AttributeError: 'module' object has no attribute 'datetime'.... import sys sys.path.append("c:/Python24/Lib") import datetime print datetime.datetime I am trying to get Kirbybase to run on IronPython - no idea why it needs to use datetime.datetime !! Thanks Davy Mitchell Mood News - BBC News Headlines Auto-Classified as Good, Bad or Neutral. http://www.latedecember.com/sites/moodnews/ _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at exchange.microsoft.com Thu Jun 29 19:18:54 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Thu, 29 Jun 2006 10:18:54 -0700 Subject: [IronPython] Adding None to a set In-Reply-To: <44A3E04F.1020003@resolversystems.com> References: <44A3E04F.1020003@resolversystems.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03EEF22F13@df-foxhound-msg.exchange.corp.microsoft.com> Thanks for reporting this. Luckily this one is quite easy to fix. The reason for this bug is that .NET dictionaries don't allow null as a value, and the Set class used to be backed off of a .NET dictionary. But these days it's backed by a Python dictionary, but there's still some checks to handle null values that seem to have lingered on. If you remove every instance of: if (o == null) o = NoneType.InstanceOfNoneType; from IronPython\Runtime\Set.cs then you'll get rid of this bug. I'll file a CodePlex bug on this & get it fixed for the next release. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of William Reade Sent: Thursday, June 29, 2006 7:15 AM To: Discussion of IronPython Subject: [IronPython] Adding None to a set Hi guys As if you didn't have enough on your plates already... IronPython beta8: >>> st = set([]) >>> st.add(None) >>> st set([]) CPython: >>> st = set([]) >>> st.add(None) >>> st set([None]) Cheers William _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at exchange.microsoft.com Thu Jun 29 19:24:45 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Thu, 29 Jun 2006 10:24:45 -0700 Subject: [IronPython] Adding None to a set In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E03EEF22F13@df-foxhound-msg.exchange.corp.microsoft.com> References: <44A3E04F.1020003@resolversystems.com> <4039D552ADAB094BB1EA670F3E96214E03EEF22F13@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03EEF22F30@df-foxhound-msg.exchange.corp.microsoft.com> Well, I take that back... that should fix it, but there's another bug which causes None to show up as an object :) That involves fixing Dict, which is a little more involved, but is still the right thing to do. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: Thursday, June 29, 2006 10:19 AM To: Discussion of IronPython Subject: Re: [IronPython] Adding None to a set Thanks for reporting this. Luckily this one is quite easy to fix. The reason for this bug is that .NET dictionaries don't allow null as a value, and the Set class used to be backed off of a .NET dictionary. But these days it's backed by a Python dictionary, but there's still some checks to handle null values that seem to have lingered on. If you remove every instance of: if (o == null) o = NoneType.InstanceOfNoneType; from IronPython\Runtime\Set.cs then you'll get rid of this bug. I'll file a CodePlex bug on this & get it fixed for the next release. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of William Reade Sent: Thursday, June 29, 2006 7:15 AM To: Discussion of IronPython Subject: [IronPython] Adding None to a set Hi guys As if you didn't have enough on your plates already... IronPython beta8: >>> st = set([]) >>> st.add(None) >>> st set([]) CPython: >>> st = set([]) >>> st.add(None) >>> st set([None]) Cheers William _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From jorgen.stenarson at bostream.nu Thu Jun 29 21:14:22 2006 From: jorgen.stenarson at bostream.nu (=?ISO-8859-1?Q?J=F6rgen_Stenarson?=) Date: Thu, 29 Jun 2006 21:14:22 +0200 Subject: [IronPython] ironpython alternative to PyOS_ReadlineFunctionPointer In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E03E9FC8268@df-foxhound-msg.exchange.corp.microsoft.com> References: <44A2CE0B.4050107@bostream.nu> <4039D552ADAB094BB1EA670F3E96214E03E9FC8051@df-foxhound-msg.exchange.corp.microsoft.com> <44A2F2C7.90505@bostream.nu> <4039D552ADAB094BB1EA670F3E96214E03E9FC8268@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <44A4268E.9010902@bostream.nu> Dino, I've been sucessful in locating ReadLineFromSrc but not IConsole (from the IronPythonConsole). However ReadLineFromSrc is a read only attribute in the IronPython.Runtime.Operations.Ops module. Ideally I would like to do something like this: import IronPython def my_readline(): txt=System.Console.ReadLine() return txt IronPython.readline=my_readline But I guess it could be difficult if what I want to override a method in a class instance written in C#. Am I right? Could this be changed in that case? /J?rgen Dino Viehland skrev: > Ops.ReadLineFromSrc will be called if for example someone calls raw_input() from Python (one way to read from the user). IConsole.ReadLine gets called when we're reading input from the console for some code you're typing in. > > I think ideally these would be using the same underlying implementation but do to the extra things our fancy console does they're rather divergent today. For readline I suspect you'll want to be updating IConsole.ReadLine instead. > > Also it'd be great if you could keep us updated when you get something working. One of our PMs has wanted good history support, and I think Bruce (who implemented socket as part of his internship this summer) might prefer readline's key bindings :). > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of J?rgen Stenarson > Sent: Wednesday, June 28, 2006 2:21 PM > To: Discussion of IronPython > Subject: Re: [IronPython] ironpython alternative to PyOS_ReadlineFunctionPointer > > Thanks for the response, I will have to investigate this further. > > Just to clarify, what I want to do is replace the function that is called by the ironpython interpreter to read a line of text from the user. > > /J?rgen > > Dino Viehland skrev: >> Is IronPython.Runtime.Operations.Ops.ReadLineFromSrc what you're looking for? This allows you to read a line of input from std-in. >> >> I'm not familiar w/ CPython's internal interfaces so I'm not sure if that's right or not... The other option is that this is the functionality that lives in the console, and you want IConsole.ReadLine. >> >> Currently these two are rather disconnected. >> >> -----Original Message----- >> From: users-bounces at lists.ironpython.com >> [mailto:users-bounces at lists.ironpython.com] On Behalf Of J?rgen >> Stenarson >> Sent: Wednesday, June 28, 2006 11:44 AM >> To: Discussion of IronPython >> Subject: [IronPython] ironpython alternative to >> PyOS_ReadlineFunctionPointer >> >> Hi, >> >> I'm working on a python based implementation of readline (pyreadline available from http://projects.scipy.org/ipython/ipython/wiki/PyReadline/Intro). I'm experimenting with adding support for ironpython, I have been successful in porting some of the ctypes based routines used for keyboard event processing to ironpython using System.Console. It has been quite painless so far. >> >> But to take this further I need to know the ironpython equivalent to PyOS_ReadlineFunctionPointer in cpython and how to use it. Is this functionality exposed and if not do you plan to expose it? >> >> Best regards, >> J?rgen Stenarson >> >> _______________________________________________ >> users mailing list >> users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> _______________________________________________ >> users mailing list >> users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From dinov at exchange.microsoft.com Thu Jun 29 23:43:55 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Thu, 29 Jun 2006 14:43:55 -0700 Subject: [IronPython] ironpython alternative to PyOS_ReadlineFunctionPointer In-Reply-To: <44A4268E.9010902@bostream.nu> References: <44A2CE0B.4050107@bostream.nu> <4039D552ADAB094BB1EA670F3E96214E03E9FC8051@df-foxhound-msg.exchange.corp.microsoft.com> <44A2F2C7.90505@bostream.nu> <4039D552ADAB094BB1EA670F3E96214E03E9FC8268@df-foxhound-msg.exchange.corp.microsoft.com> <44A4268E.9010902@bostream.nu> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03F7B991E7@df-foxhound-msg.exchange.corp.microsoft.com> Unfortunately there's currently no way to switch this from Python code. What we need to do is expose something in IronPythonConsole.exe which lets you set PythonCommandLine.MyConsole (currently you can't do this because PythonCommandLine is private). If you made PythonCommandLine public you could do clr.AddReference('IronPythonConsole.exe') and then from IronPythonConsole import PythonCommandLine, IConsole. Finally you can implement your own console: class MyConsole(IConsole): def ReadLine(autoIndentSize): pass def Write(text, style): pass def WriteLine(text, style): pass and then call PythonCommandLine.MyConsole = MyConsole() and those methods will override the interface implementation (or in other words - it's quite easy to deal with overriding methods :) ). That's the hacky way to get to where you can start experimenting with this. We probably need to come up w/ a better long-term way to do this. This is an unfortunate side effect of the runtime & console being so separated - the runtime doesn't know anything about the console, and the console can't use the runtime's stdin because it needs to be able to deal w/ input such as arrow keys. I don't know that we could do anything here before 1.0, but I'll open a CodePlex bug for improving console <-> runtime interop. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of J?rgen Stenarson Sent: Thursday, June 29, 2006 12:14 PM To: Discussion of IronPython Subject: Re: [IronPython] ironpython alternative to PyOS_ReadlineFunctionPointer Dino, I've been sucessful in locating ReadLineFromSrc but not IConsole (from the IronPythonConsole). However ReadLineFromSrc is a read only attribute in the IronPython.Runtime.Operations.Ops module. Ideally I would like to do something like this: import IronPython def my_readline(): txt=System.Console.ReadLine() return txt IronPython.readline=my_readline But I guess it could be difficult if what I want to override a method in a class instance written in C#. Am I right? Could this be changed in that case? /J?rgen Dino Viehland skrev: > Ops.ReadLineFromSrc will be called if for example someone calls raw_input() from Python (one way to read from the user). IConsole.ReadLine gets called when we're reading input from the console for some code you're typing in. > > I think ideally these would be using the same underlying implementation but do to the extra things our fancy console does they're rather divergent today. For readline I suspect you'll want to be updating IConsole.ReadLine instead. > > Also it'd be great if you could keep us updated when you get something working. One of our PMs has wanted good history support, and I think Bruce (who implemented socket as part of his internship this summer) might prefer readline's key bindings :). > > -----Original Message----- > From: users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] On Behalf Of J?rgen > Stenarson > Sent: Wednesday, June 28, 2006 2:21 PM > To: Discussion of IronPython > Subject: Re: [IronPython] ironpython alternative to > PyOS_ReadlineFunctionPointer > > Thanks for the response, I will have to investigate this further. > > Just to clarify, what I want to do is replace the function that is called by the ironpython interpreter to read a line of text from the user. > > /J?rgen > > Dino Viehland skrev: >> Is IronPython.Runtime.Operations.Ops.ReadLineFromSrc what you're looking for? This allows you to read a line of input from std-in. >> >> I'm not familiar w/ CPython's internal interfaces so I'm not sure if that's right or not... The other option is that this is the functionality that lives in the console, and you want IConsole.ReadLine. >> >> Currently these two are rather disconnected. >> >> -----Original Message----- >> From: users-bounces at lists.ironpython.com >> [mailto:users-bounces at lists.ironpython.com] On Behalf Of J?rgen >> Stenarson >> Sent: Wednesday, June 28, 2006 11:44 AM >> To: Discussion of IronPython >> Subject: [IronPython] ironpython alternative to >> PyOS_ReadlineFunctionPointer >> >> Hi, >> >> I'm working on a python based implementation of readline (pyreadline available from http://projects.scipy.org/ipython/ipython/wiki/PyReadline/Intro). I'm experimenting with adding support for ironpython, I have been successful in porting some of the ctypes based routines used for keyboard event processing to ironpython using System.Console. It has been quite painless so far. >> >> But to take this further I need to know the ironpython equivalent to PyOS_ReadlineFunctionPointer in cpython and how to use it. Is this functionality exposed and if not do you plan to expose it? >> >> Best regards, >> J?rgen Stenarson >> >> _______________________________________________ >> users mailing list >> users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> _______________________________________________ >> users mailing list >> users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From KBjorke at nvidia.com Fri Jun 30 01:52:15 2006 From: KBjorke at nvidia.com (Kevin Bjorke) Date: Thu, 29 Jun 2006 16:52:15 -0700 Subject: [IronPython] Python Module Scopes versus WinForms Event Handlers In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E03F7B991E7@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <590FCAE72E27D54CA1EADE7293BB444F04422AFC@hqemmail04.nvidia.com> A typical idiom for a global value is to define it in some imported module, e.g. # config.py gVal = 3 And then all the other modules can import config And get/set the value by accessing "config.gVal" Unfortunately, this gets broken when using WinForms! It seems that in methods called as event handlers (or any methods called by those methods) that (in this case) "config.gVal" is not a valid attribute. For all other method contexts, "config.gVal" works perfectly. A global declared within the scope of the module containg the event handler CAN be used within the event handler, so my modules end up doing something like this: import config global gVal # ...and somewhere before any other code in the current mdule gets executed.... gVal = config.gVal ...so that event handlers can use the local-module "global" version. Obviously if the value of "config.gVal" changes a lot this would be an even huger hassle (fortunately, all I want is to maintain a globally-available pointer to my top-level app, which never changes once the app is initialized) ----------------------------------------------------------------------------------- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ----------------------------------------------------------------------------------- From dinov at exchange.microsoft.com Thu Jun 29 23:48:14 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Thu, 29 Jun 2006 14:48:14 -0700 Subject: [IronPython] Bug when calling ironpythonconsole from powershell In-Reply-To: <44A2CC41.3020903@bostream.nu> References: <44A2CC41.3020903@bostream.nu> Message-ID: <4039D552ADAB094BB1EA670F3E96214E03F7B991F6@df-foxhound-msg.exchange.corp.microsoft.com> This actually sounds more like a PowerShell bug than an IronPython bug (it's splitting a command line option or maybe : is a special character in PowerShell?). I don't currently have PowerShell installed, but does \: instead of : work (it's just a crazy guess that maybe it needs to be escaped). -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of J?rgen Stenarson Sent: Wednesday, June 28, 2006 11:37 AM To: Discussion of IronPython Subject: [IronPython] Bug when calling ironpythonconsole from powershell Hi I have a problem calling ironpythonconsole from windows powershell using the -X: options. Below are excerpts from sessions both in cmd.exe and powershell: From cmd.exe: C:\IronPython>IronPythonConsole.exe -X:SaveAssemblies hej.py HELLO WORLD! From windows powershell: PS C:\IronPython> IronPythonConsole.exe -X:SaveAssemblies hej.py File -X: does not exist looks like there is some issue with commandline parsing. Best regards, J?rgen Stenarson _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From jvm_cop at spamcop.net Fri Jun 30 04:31:28 2006 From: jvm_cop at spamcop.net (J. Merrill) Date: Thu, 29 Jun 2006 22:31:28 -0400 Subject: [IronPython] Bug when calling ironpythonconsole from powershell Message-ID: <7.0.1.0.2.20060629223122.03dabee0@usa.net> I'd guess that the "File -X: does not exist" message coming from Powershell, rather than from IPC. You could prove that by -- for example -- calling echo instead of IPC. (Of course, powershell could be doing something special when it sees that you're calling an executable. What happens if you don't put ".exe" after IPC?) Another way to see if IPC is getting called would be to turn SysInternals' FILEMON on... Good luck. At 02:36 PM 6/28/2006, J?rgen Stenarson wrote >Hi > >I have a problem calling ironpythonconsole from windows powershell using >the -X: options. Below are excerpts from sessions both in cmd.exe and >powershell: > > From cmd.exe: >C:\IronPython>IronPythonConsole.exe -X:SaveAssemblies hej.py >HELLO WORLD! > > > From windows powershell: >PS C:\IronPython> IronPythonConsole.exe -X:SaveAssemblies hej.py >File -X: does not exist > >looks like there is some issue with commandline parsing. > > >Best regards, >J?rgen Stenarson J. Merrill / Analytical Software Corp From kristof.wagemans at gmail.com Fri Jun 30 15:58:49 2006 From: kristof.wagemans at gmail.com (Kristof Wagemans) Date: Fri, 30 Jun 2006 15:58:49 +0200 Subject: [IronPython] Windows Forms interactively Message-ID: <000301c69c4d$50eb71a0$0f01a8c0@notebook> I'm trying to make my own console control that can run inside a window. I've come across a problem that I haven't got a solution for. I can demonstrate the problem with one of the tutorials. If you try Tutorial 2 - Exercise 2 - Task 1 and follow all the steps from 1 through 4 you end up with a visible form. If you then run the command input() in the console the form locks up until you enter a value. The ReadLine instruction blocks and because all commands are dispatched to the GUI thread it gets executed there instead of on the console thread. Is there a solution for this problem? I think it would require detecting when a ReadLine is issued and then not dispatching this special case and run it on the console thread. -------------- next part -------------- An HTML attachment was scrubbed... URL: From kristof.wagemans at gmail.com Fri Jun 30 16:05:49 2006 From: kristof.wagemans at gmail.com (Kristof Wagemans) Date: Fri, 30 Jun 2006 16:05:49 +0200 Subject: [IronPython] Python console control for WPF In-Reply-To: <50B69702CA6E6D4E849D30CD4989AB8E197F64A8CE@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <000801c69c4e$4b5101a0$0f01a8c0@notebook> Thanks for the info about directly calling a Python method. This is definitively going to be useful. Maybe someone else has answers for my other questions about FilterStackFrame, no overload with name for SetGlobal and format specifiers for double and decimal? _____ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Shri Borde Sent: Wednesday 28 June 2006 0:05 To: Discussion of IronPython Subject: Re: [IronPython] Python console control for WPF Hi Kristof, You can call a Python method as such. public delegate int IntIntDelegate(int arg); engine.Execute("def IntIntMethod(a): return a * 100"); IntIntDelegate d = engine.Evaluate("IntIntMethod"); Console.WriteLine(d(2)); // This prints "200" I have opened this bug http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython &WorkItemId=632 to track the issue with setdefaultencoding. Shri ________ Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F 0-45DF-8B78-DC1B43134038) _____ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kristof Wagemans Sent: Sunday, June 25, 2006 1:09 AM To: users at lists.ironpython.com Subject: [IronPython] Python console control for WPF I've been experimenting with a Python console control for WPF. The improvements made for IronPython beta 8 make this a lot easier thanks to several new functions on the PythonEngine: ExecuteToConsole, FormatException and ParseInteractiveInput. One of the things I need to do to communicate with a C# application is to change the default encoding to receive non-ascii characters. For this I execute several commands after the PythonEngine instance is created. import sys sys.setdefaultencoding('utf_16_le') del(sys) Setting the default encoding seems like a good candidate for the options you can pass to the engine while creating a new instance. It would also be easier if I could get at the options through a PythonEngine instance. I hope you're not going to remove the FilterStackFrame delegate from the FormatException method as the comment seems to indicate. I think it's very useful to filter my own C# application from the stack trace. Maybe you could add an overload with just the Exception and FilterStackFrame? To set a variable in the PythonEngine you need to use SetGlobal with a SymbolId. Am I correct to use SymbolTable.StringToId(name) to generate a SymbolId? It used to be easier with just a string to specify the name. A useful enhancement for the PythonEngine might be if there was a way to directly call a Python function loaded in the engine and pass parameters to it and get the return value. You could also support out parameters similar to calling a method through reflection. If you want to specify that a number is a long you can write 10L. Is there a way to specify that a number is a double or a decimal? -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Fri Jun 30 18:03:17 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Fri, 30 Jun 2006 09:03:17 -0700 Subject: [IronPython] Python console control for WPF In-Reply-To: <000801c69c4e$4b5101a0$0f01a8c0@notebook> References: <50B69702CA6E6D4E849D30CD4989AB8E197F64A8CE@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <000801c69c4e$4b5101a0$0f01a8c0@notebook> Message-ID: <4039D552ADAB094BB1EA670F3E96214E0445BB6478@df-foxhound-msg.exchange.corp.microsoft.com> I think we can keep FilterStackFrame public and like you suggest make it just take an Exception object. I think we're going to make the switch from SetGlobal taking a SymbolId to using a string, but until we do that you're right to use SymbolTable.StringToId. For double you should ensure there's a decimal point in the number, or you could always do float(1) which will give you the floating point version - although the decimal point is preferred (in C# you can do 1D for this). For Decimal are you referring to System.Decimal or Python's decimal type in the standard library? I assume it's the Python one, and I don't believe there's any special syntax for that. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kristof Wagemans Sent: Friday, June 30, 2006 7:06 AM To: 'Discussion of IronPython' Subject: Re: [IronPython] Python console control for WPF Thanks for the info about directly calling a Python method. This is definitively going to be useful. Maybe someone else has answers for my other questions about FilterStackFrame, no overload with name for SetGlobal and format specifiers for double and decimal? ________________________________ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Shri Borde Sent: Wednesday 28 June 2006 0:05 To: Discussion of IronPython Subject: Re: [IronPython] Python console control for WPF Hi Kristof, You can call a Python method as such. public delegate int IntIntDelegate(int arg); engine.Execute("def IntIntMethod(a): return a * 100"); IntIntDelegate d = engine.Evaluate("IntIntMethod"); Console.WriteLine(d(2)); // This prints "200" I have opened this bug http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&WorkItemId=632 to track the issue with setdefaultencoding. Shri ________ Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038) ________________________________ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kristof Wagemans Sent: Sunday, June 25, 2006 1:09 AM To: users at lists.ironpython.com Subject: [IronPython] Python console control for WPF I've been experimenting with a Python console control for WPF. The improvements made for IronPython beta 8 make this a lot easier thanks to several new functions on the PythonEngine: ExecuteToConsole, FormatException and ParseInteractiveInput. One of the things I need to do to communicate with a C# application is to change the default encoding to receive non-ascii characters. For this I execute several commands after the PythonEngine instance is created. import sys sys.setdefaultencoding('utf_16_le') del(sys) Setting the default encoding seems like a good candidate for the options you can pass to the engine while creating a new instance. It would also be easier if I could get at the options through a PythonEngine instance. I hope you're not going to remove the FilterStackFrame delegate from the FormatException method as the comment seems to indicate. I think it's very useful to filter my own C# application from the stack trace. Maybe you could add an overload with just the Exception and FilterStackFrame? To set a variable in the PythonEngine you need to use SetGlobal with a SymbolId. Am I correct to use SymbolTable.StringToId(name) to generate a SymbolId? It used to be easier with just a string to specify the name. A useful enhancement for the PythonEngine might be if there was a way to directly call a Python function loaded in the engine and pass parameters to it and get the return value. You could also support out parameters similar to calling a method through reflection. If you want to specify that a number is a long you can write 10L. Is there a way to specify that a number is a double or a decimal? -------------- next part -------------- An HTML attachment was scrubbed... URL: From kristof.wagemans at gmail.com Fri Jun 30 18:28:28 2006 From: kristof.wagemans at gmail.com (Kristof Wagemans) Date: Fri, 30 Jun 2006 18:28:28 +0200 Subject: [IronPython] Python console control for WPF In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E0445BB6478@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <001901c69c62$38d4b530$0f01a8c0@notebook> I was actually thinking of System.Decimal. I can now create one with Decimal(5), but it would be more convenient if I could just add a single character or so to the number. You probably wouldn't like extending the Python language for this, I would guess. _____ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: Friday 30 June 2006 18:03 To: Discussion of IronPython Subject: Re: [IronPython] Python console control for WPF I think we can keep FilterStackFrame public and like you suggest make it just take an Exception object. I think we're going to make the switch from SetGlobal taking a SymbolId to using a string, but until we do that you're right to use SymbolTable.StringToId. For double you should ensure there's a decimal point in the number, or you could always do float(1) which will give you the floating point version - although the decimal point is preferred (in C# you can do 1D for this). For Decimal are you referring to System.Decimal or Python's decimal type in the standard library? I assume it's the Python one, and I don't believe there's any special syntax for that. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kristof Wagemans Sent: Friday, June 30, 2006 7:06 AM To: 'Discussion of IronPython' Subject: Re: [IronPython] Python console control for WPF Thanks for the info about directly calling a Python method. This is definitively going to be useful. Maybe someone else has answers for my other questions about FilterStackFrame, no overload with name for SetGlobal and format specifiers for double and decimal? _____ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Shri Borde Sent: Wednesday 28 June 2006 0:05 To: Discussion of IronPython Subject: Re: [IronPython] Python console control for WPF Hi Kristof, You can call a Python method as such. public delegate int IntIntDelegate(int arg); engine.Execute("def IntIntMethod(a): return a * 100"); IntIntDelegate d = engine.Evaluate("IntIntMethod"); Console.WriteLine(d(2)); // This prints "200" I have opened this bug http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython &WorkItemId=632 to track the issue with setdefaultencoding. Shri ________ Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F 0-45DF-8B78-DC1B43134038) _____ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kristof Wagemans Sent: Sunday, June 25, 2006 1:09 AM To: users at lists.ironpython.com Subject: [IronPython] Python console control for WPF I've been experimenting with a Python console control for WPF. The improvements made for IronPython beta 8 make this a lot easier thanks to several new functions on the PythonEngine: ExecuteToConsole, FormatException and ParseInteractiveInput. One of the things I need to do to communicate with a C# application is to change the default encoding to receive non-ascii characters. For this I execute several commands after the PythonEngine instance is created. import sys sys.setdefaultencoding('utf_16_le') del(sys) Setting the default encoding seems like a good candidate for the options you can pass to the engine while creating a new instance. It would also be easier if I could get at the options through a PythonEngine instance. I hope you're not going to remove the FilterStackFrame delegate from the FormatException method as the comment seems to indicate. I think it's very useful to filter my own C# application from the stack trace. Maybe you could add an overload with just the Exception and FilterStackFrame? To set a variable in the PythonEngine you need to use SetGlobal with a SymbolId. Am I correct to use SymbolTable.StringToId(name) to generate a SymbolId? It used to be easier with just a string to specify the name. A useful enhancement for the PythonEngine might be if there was a way to directly call a Python function loaded in the engine and pass parameters to it and get the return value. You could also support out parameters similar to calling a method through reflection. If you want to specify that a number is a long you can write 10L. Is there a way to specify that a number is a double or a decimal? -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Fri Jun 30 18:38:26 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Fri, 30 Jun 2006 09:38:26 -0700 Subject: [IronPython] Python console control for WPF In-Reply-To: <001901c69c62$38d4b530$0f01a8c0@notebook> References: <4039D552ADAB094BB1EA670F3E96214E0445BB6478@df-foxhound-msg.exchange.corp.microsoft.com> <001901c69c62$38d4b530$0f01a8c0@notebook> Message-ID: <4039D552ADAB094BB1EA670F3E96214E0445BB64C1@df-foxhound-msg.exchange.corp.microsoft.com> Yeah, in general we don't want to extend the language. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kristof Wagemans Sent: Friday, June 30, 2006 9:28 AM To: 'Discussion of IronPython' Subject: Re: [IronPython] Python console control for WPF I was actually thinking of System.Decimal. I can now create one with Decimal(5), but it would be more convenient if I could just add a single character or so to the number. You probably wouldn't like extending the Python language for this, I would guess. ________________________________ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: Friday 30 June 2006 18:03 To: Discussion of IronPython Subject: Re: [IronPython] Python console control for WPF I think we can keep FilterStackFrame public and like you suggest make it just take an Exception object. I think we're going to make the switch from SetGlobal taking a SymbolId to using a string, but until we do that you're right to use SymbolTable.StringToId. For double you should ensure there's a decimal point in the number, or you could always do float(1) which will give you the floating point version - although the decimal point is preferred (in C# you can do 1D for this). For Decimal are you referring to System.Decimal or Python's decimal type in the standard library? I assume it's the Python one, and I don't believe there's any special syntax for that. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kristof Wagemans Sent: Friday, June 30, 2006 7:06 AM To: 'Discussion of IronPython' Subject: Re: [IronPython] Python console control for WPF Thanks for the info about directly calling a Python method. This is definitively going to be useful. Maybe someone else has answers for my other questions about FilterStackFrame, no overload with name for SetGlobal and format specifiers for double and decimal? ________________________________ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Shri Borde Sent: Wednesday 28 June 2006 0:05 To: Discussion of IronPython Subject: Re: [IronPython] Python console control for WPF Hi Kristof, You can call a Python method as such. public delegate int IntIntDelegate(int arg); engine.Execute("def IntIntMethod(a): return a * 100"); IntIntDelegate d = engine.Evaluate("IntIntMethod"); Console.WriteLine(d(2)); // This prints "200" I have opened this bug http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&WorkItemId=632 to track the issue with setdefaultencoding. Shri ________ Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038) ________________________________ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kristof Wagemans Sent: Sunday, June 25, 2006 1:09 AM To: users at lists.ironpython.com Subject: [IronPython] Python console control for WPF I've been experimenting with a Python console control for WPF. The improvements made for IronPython beta 8 make this a lot easier thanks to several new functions on the PythonEngine: ExecuteToConsole, FormatException and ParseInteractiveInput. One of the things I need to do to communicate with a C# application is to change the default encoding to receive non-ascii characters. For this I execute several commands after the PythonEngine instance is created. import sys sys.setdefaultencoding('utf_16_le') del(sys) Setting the default encoding seems like a good candidate for the options you can pass to the engine while creating a new instance. It would also be easier if I could get at the options through a PythonEngine instance. I hope you're not going to remove the FilterStackFrame delegate from the FormatException method as the comment seems to indicate. I think it's very useful to filter my own C# application from the stack trace. Maybe you could add an overload with just the Exception and FilterStackFrame? To set a variable in the PythonEngine you need to use SetGlobal with a SymbolId. Am I correct to use SymbolTable.StringToId(name) to generate a SymbolId? It used to be easier with just a string to specify the name. A useful enhancement for the PythonEngine might be if there was a way to directly call a Python function loaded in the engine and pass parameters to it and get the return value. You could also support out parameters similar to calling a method through reflection. If you want to specify that a number is a long you can write 10L. Is there a way to specify that a number is a double or a decimal? -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.foord at resolversystems.com Fri Jun 30 18:36:55 2006 From: michael.foord at resolversystems.com (Michael Foord) Date: Fri, 30 Jun 2006 17:36:55 +0100 Subject: [IronPython] .NET Attribute None Message-ID: <44A55327.60902@resolversystems.com> Hello all, We are using some third party .NET classes. One of these defines an enumeration with various members, one of which is "None". In CPython "object.None" would not be a valid identifier, however in IronPython this works fine. Believe me, we don't want you to fix this. :-) However, if this did become invalid how would we access the property ? All the best, Michael Foord http://www.resolversystems.com http://www.voidspace.org.uk/python/index.shtml From dinov at exchange.microsoft.com Fri Jun 30 18:48:48 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Fri, 30 Jun 2006 09:48:48 -0700 Subject: [IronPython] .NET Attribute None In-Reply-To: <44A55327.60902@resolversystems.com> References: <44A55327.60902@resolversystems.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E0445BB64E3@df-foxhound-msg.exchange.corp.microsoft.com> You could use getattr / setattr to access this off the type: getattr(enumType, 'None') (we do have a bug on this but currently it's marked as low priority so we may or may not get to fixing this for 1.0). -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Friday, June 30, 2006 9:37 AM To: Discussion of IronPython Subject: [IronPython] .NET Attribute None Hello all, We are using some third party .NET classes. One of these defines an enumeration with various members, one of which is "None". In CPython "object.None" would not be a valid identifier, however in IronPython this works fine. Believe me, we don't want you to fix this. :-) However, if this did become invalid how would we access the property ? All the best, Michael Foord http://www.resolversystems.com http://www.voidspace.org.uk/python/index.shtml _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From KBjorke at nvidia.com Fri Jun 30 18:55:24 2006 From: KBjorke at nvidia.com (Kevin Bjorke) Date: Fri, 30 Jun 2006 09:55:24 -0700 Subject: [IronPython] .NET Attribute None In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E0445BB64E3@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <590FCAE72E27D54CA1EADE7293BB444F04422AFE@hqemmail04.nvidia.com> Beat me to it by 3 or 4 seconds, got you email while reaching for "send" ha :) -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: Friday, June 30, 2006 9:49 AM To: Discussion of IronPython Subject: Re: [IronPython] .NET Attribute None You could use getattr / setattr to access this off the type: getattr(enumType, 'None') (we do have a bug on this but currently it's marked as low priority so we may or may not get to fixing this for 1.0). -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Friday, June 30, 2006 9:37 AM To: Discussion of IronPython Subject: [IronPython] .NET Attribute None Hello all, We are using some third party .NET classes. One of these defines an enumeration with various members, one of which is "None". In CPython "object.None" would not be a valid identifier, however in IronPython this works fine. Believe me, we don't want you to fix this. :-) However, if this did become invalid how would we access the property ? All the best, Michael Foord http://www.resolversystems.com http://www.voidspace.org.uk/python/index.shtml _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com ----------------------------------------------------------------------------------- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ----------------------------------------------------------------------------------- From fuzzyman at voidspace.org.uk Fri Jun 30 19:09:37 2006 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Fri, 30 Jun 2006 18:09:37 +0100 Subject: [IronPython] .NET Attribute None In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E0445BB64E3@df-foxhound-msg.exchange.corp.microsoft.com> References: <44A55327.60902@resolversystems.com> <4039D552ADAB094BB1EA670F3E96214E0445BB64E3@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <44A55AD1.6080407@voidspace.org.uk> Dino Viehland wrote: > You could use getattr / setattr to access this off the type: > > getattr(enumType, 'None') > Thanks > (we do have a bug on this but currently it's marked as low priority so we may or may not get to fixing this for 1.0). > > Take your time. :-) By the way, interesting things happen if you access .NET object properties via their __dict__. You can get a reference to the property, and its getter and setter. I failed to get the property to *do anything* though. Michael http://www.resolversystems.com http://www.voidspace.org.uk/python/index.shtml > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Friday, June 30, 2006 9:37 AM > To: Discussion of IronPython > Subject: [IronPython] .NET Attribute None > > Hello all, > > We are using some third party .NET classes. One of these defines an enumeration with various members, one of which is "None". > > In CPython "object.None" would not be a valid identifier, however in IronPython this works fine. Believe me, we don't want you to fix this. :-) > > However, if this did become invalid how would we access the property ? > > All the best, > > Michael Foord > http://www.resolversystems.com > http://www.voidspace.org.uk/python/index.shtml > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > From dinov at exchange.microsoft.com Fri Jun 30 19:22:29 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Fri, 30 Jun 2006 10:22:29 -0700 Subject: [IronPython] .NET Attribute None In-Reply-To: <44A55AD1.6080407@voidspace.org.uk> References: <44A55327.60902@resolversystems.com> <4039D552ADAB094BB1EA670F3E96214E0445BB64E3@df-foxhound-msg.exchange.corp.microsoft.com> <44A55AD1.6080407@voidspace.org.uk> Message-ID: <4039D552ADAB094BB1EA670F3E96214E0445BB6532@df-foxhound-msg.exchange.corp.microsoft.com> If you get the "ReflectedProperty (it's repr is ", and you can also get it via the type object - it's the descriptor which controls access to the property) you can call it via __get__ and __set__. That's a little cumbersome: fooType.propertyX.__get__(fooInstance, fooType) or fooType.propertyX.__set__(fooInstance, value) I actually checked in a change this morning which also exposes GetValue and SetValue methods on this for use when you have an interface that defines a property, that property gets explicitly implemented on a type, and the property name collides w/ a property name that's not explicitly implemented - although they're available on all reflected properties now. So that's how you can make it actually do something. ReflectedField's are similar, but they don't have the collision problem so we won't expose GetValue/SetValue on them. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Friday, June 30, 2006 10:10 AM To: Discussion of IronPython Subject: Re: [IronPython] .NET Attribute None Dino Viehland wrote: > You could use getattr / setattr to access this off the type: > > getattr(enumType, 'None') > Thanks > (we do have a bug on this but currently it's marked as low priority so we may or may not get to fixing this for 1.0). > > Take your time. :-) By the way, interesting things happen if you access .NET object properties via their __dict__. You can get a reference to the property, and its getter and setter. I failed to get the property to *do anything* though. Michael http://www.resolversystems.com http://www.voidspace.org.uk/python/index.shtml > -----Original Message----- > From: users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Friday, June 30, 2006 9:37 AM > To: Discussion of IronPython > Subject: [IronPython] .NET Attribute None > > Hello all, > > We are using some third party .NET classes. One of these defines an enumeration with various members, one of which is "None". > > In CPython "object.None" would not be a valid identifier, however in > IronPython this works fine. Believe me, we don't want you to fix this. > :-) > > However, if this did become invalid how would we access the property ? > > All the best, > > Michael Foord > http://www.resolversystems.com > http://www.voidspace.org.uk/python/index.shtml > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > users mailing list > users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From Seth_Milman at bose.com Fri Jun 30 21:03:29 2006 From: Seth_Milman at bose.com (Milman, Seth ) Date: Fri, 30 Jun 2006 15:03:29 -0400 Subject: [IronPython] list -> Array conversion in Beta 8 Message-ID: Hi, I just upgraded from Beta 7 to Beta 8 and I'm having a problem passing runtime lists to assembly functions that expect an array. In beta 7, the list went through function IronPython.Runtime.Converter.TryConvertToArray. In beta 8, it is passed to IronPython.Runtime.NewConverter.ConvertToArray. Beta 7 seemed to work, Beta 8 doesn't. Is this new behavior by design? If so, how should I work around it? Here is a repro: // C# Code Namespace mySpace { public class myClass { public static double SumArray( System.Double[] a ) { double sum = 0.0; foreach( double d in a ) { sum += d; } return sum; } } } # Python code ... L = [1.0, 2.0, 3.0] print myClass.SumArray( L ) In beta 7 it works. In beta 8, I get this exception trace: expected array_float, found list at IronPython.Runtime.NewConverter.ConvertToArray(Object value, Type to) in C :\source\VnV~sm15019\VnV\Automation\IronPython-1.0-Beta8\Src\IronPython\ Runtime\ Converter.cs:line 527 at IronPython.Runtime.NewConverter.Convert(Object value, Type toType) in C:\s ource\VnV~sm15019\VnV\Automation\IronPython-1.0-Beta8\Src\IronPython\Run time\Con verter.cs:line 599 at IronPython.Runtime.NewConverter.ConvertToReferenceType(Object fromObject, RuntimeTypeHandle typeHandle) in C:\source\VnV~sm15019\VnV\Automation\IronPython -1.0-Beta8\Src\IronPython\Runtime\Converter.cs:line 408 at StaticSumArray##15(Object ) at IronPython.Runtime.Calls.CallTarget1.Invoke(Object arg0) at IronPython.Runtime.Calls.FastCallable1.Call(ICallerContext context, Object arg0) in c:\source\VnV~sm15019\VnV\Automation\IronPython-1.0-Beta8\Src\IronPyth on\Runtime\Calls\FastCallable.Generated.cs:line 434 at IronPython.Runtime.Calls.BuiltinFunction.Call(ICallerContext context, Obje ct arg0) in c:\source\VnV~sm15019\VnV\Automation\IronPython-1.0-Beta8\Src\IronPy thon\Runtime\Calls\BuiltinFunction.Generated.cs:line 32 at IronPython.Runtime.Operations.Ops.CallWithContext(ICallerContext context, Object func, Object arg0) in c:\source\VnV~sm15019\VnV\Automation\IronPython-1.0 -Beta8\Src\IronPython\Runtime\Operations\Ops.Generated.cs:line 85 at ##14(ModuleScope ) at IronPython.Runtime.CompiledCodeDelegate.Invoke(ModuleScope moduleScope) at IronPython.Runtime.CompiledCode.Run(ModuleScope moduleScope) in c:\source\ VnV~sm15019\VnV\Automation\IronPython-1.0-Beta8\Src\IronPython\Runtime\M oduleSco pe.cs:line 264 at IronPython.Hosting.PythonEngine.ExecuteToConsole(String text, ModuleScope defaultScope) in c:\source\VnV~sm15019\VnV\Automation\IronPython-1.0-Beta8\Src\I ronPython\Hosting\PythonEngine.cs:line 400 at IronPythonConsole.PythonCommandLine.DoOneInteractive(ModuleScope topFrame) in C:\source\VnV~sm15019\VnV\Automation\IronPython-1.0-Beta8\Src\IronPython Cons ole\PythonCommandLine.cs:line 491 at IronPythonConsole.PythonCommandLine.b__6(Boolean& cont inueInteractionArgument) in C:\source\VnV~sm15019\VnV\Automation\IronPython-1.0- Beta8\Src\IronPythonConsole\PythonCommandLine.cs:line 631 at IronPythonConsole.PythonCommandLine.TryInteractiveAction(InteractiveActi on interactiveAction, Boolean& continueInteraction) in C:\source\VnV~sm15019\VnV\A utomation\IronPython-1.0-Beta8\Src\IronPythonConsole\PythonCommandLine.c s:line 5 41 TypeError: expected array_float, found list Any suggestions? Thanks, Seth Milman From t-bruch at microsoft.com Fri Jun 30 21:11:46 2006 From: t-bruch at microsoft.com (Bruce Christensen) Date: Fri, 30 Jun 2006 12:11:46 -0700 Subject: [IronPython] list -> Array conversion in Beta 8 In-Reply-To: References: Message-ID: <3581AA168D87A2479D88EA319BDF7D32BC268E@RED-MSG-80.redmond.corp.microsoft.com> Implicit conversion from list to array was removed in beta 8. For more details, see: http://lists.ironpython.com/pipermail/users-ironpython.com/2006-June/002 583.html For an easy workaround, you can use the technique mentioned here: http://lists.ironpython.com/pipermail/users-ironpython.com/2006-June/002 621.html --Bruce -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Milman, Seth Sent: Friday, June 30, 2006 12:03 PM To: Discussion of IronPython Subject: [IronPython] list -> Array conversion in Beta 8 Hi, I just upgraded from Beta 7 to Beta 8 and I'm having a problem passing runtime lists to assembly functions that expect an array. In beta 7, the list went through function IronPython.Runtime.Converter.TryConvertToArray. In beta 8, it is passed to IronPython.Runtime.NewConverter.ConvertToArray. Beta 7 seemed to work, Beta 8 doesn't. Is this new behavior by design? If so, how should I work around it? Here is a repro: // C# Code Namespace mySpace { public class myClass { public static double SumArray( System.Double[] a ) { double sum = 0.0; foreach( double d in a ) { sum += d; } return sum; } } } # Python code ... L = [1.0, 2.0, 3.0] print myClass.SumArray( L ) In beta 7 it works. In beta 8, I get this exception trace: From daftspaniel at gmail.com Fri Jun 30 21:21:18 2006 From: daftspaniel at gmail.com (Davy Mitchell) Date: Fri, 30 Jun 2006 20:21:18 +0100 Subject: [IronPython] Module issue? In-Reply-To: <4039D552ADAB094BB1EA670F3E96214E03EEF22EEC@df-foxhound-msg.exchange.corp.microsoft.com> References: <20253b0c0606290449g5d072e38y545eb2572f700b90@mail.gmail.com> <4039D552ADAB094BB1EA670F3E96214E03EEF22EEC@df-foxhound-msg.exchange.corp.microsoft.com> Message-ID: <20253b0c0606301221k2d5d75b4s3bb9dc02c70f88df@mail.gmail.com> Thanks Dino - fast response appreciated! Davy -- Davy Mitchell Mood News - BBC News Headlines Auto-Classified as Good, Bad or Neutral. http://www.latedecember.com/sites/moodnews/ From dinov at exchange.microsoft.com Fri Jun 30 21:48:08 2006 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Fri, 30 Jun 2006 12:48:08 -0700 Subject: [IronPython] Module issue? In-Reply-To: <20253b0c0606301221k2d5d75b4s3bb9dc02c70f88df@mail.gmail.com> References: <20253b0c0606290449g5d072e38y545eb2572f700b90@mail.gmail.com> <4039D552ADAB094BB1EA670F3E96214E03EEF22EEC@df-foxhound-msg.exchange.corp.microsoft.com> <20253b0c0606301221k2d5d75b4s3bb9dc02c70f88df@mail.gmail.com> Message-ID: <4039D552ADAB094BB1EA670F3E96214E0445BB671A@df-foxhound-msg.exchange.corp.microsoft.com> FYI I checked this change in this morning, so if you want to see if the fix works for you can download the latest sources from www.codeplex.com Now we only implement ~80% of the datetime module, and it's the last 20% that's the toughest, but hopefully we've got enough to unblock you. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Davy Mitchell Sent: Friday, June 30, 2006 12:21 PM To: Discussion of IronPython Subject: Re: [IronPython] Module issue? Thanks Dino - fast response appreciated! Davy -- Davy Mitchell Mood News - BBC News Headlines Auto-Classified as Good, Bad or Neutral. http://www.latedecember.com/sites/moodnews/ _______________________________________________ users mailing list users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com