From ASchmidt at sysdesign-edv.de Sun Mar 1 12:02:49 2009 From: ASchmidt at sysdesign-edv.de (ASchmidt at sysdesign-edv.de) Date: Sun, 01 Mar 2009 12:02:49 +0100 Subject: [IronPython] Microsoft.Scripting and IronPython Message-ID: <20090301120249.13681xsqdabztkdc@mail.sysdesign-edv.de> Hello all, I'm not sure whether this question is right on the users list but I didn't find a developer list or something similar. I think IronPython is one of the most exciting projects I've seen the last months and I would like to understand it better and maybe contribute some stuff I've developed before for CPython. But I didn't understand how Microsoft.Scripting, Microsoft.Scripting.Core und IronPython are related to each other. I also find no documentation about these internals. Can anyone give me some hint where to start? Thanks a lot!! Best regards Andy HELPING HEADS for Hard- and Software ------------------------------------------------------------------------- Fuer Ihre Projekte entwickeln wir massgeschneiderte Loesungen - schnell, flexibel und direkt vor Ort. Unser eingespieltes Team an erfahrenen Hard- und Software-Spezialisten unterstuetzt Sie dort, wo Sie uns brauchen. -------------------------------------------------------------------------- SysDesign GmbH Saentisstrasse 25 D-88079 Kressbronn am Bodensee Geschaeftsfuehrer: Franz Kleiner Handelsregister: Ulm 632138 -------------------------------------------------------------------------- From empirebuilder at gmail.com Sun Mar 1 12:21:47 2009 From: empirebuilder at gmail.com (Dody Gunawinata) Date: Sun, 1 Mar 2009 13:21:47 +0200 Subject: [IronPython] Microsoft.Scripting and IronPython In-Reply-To: <20090301120249.13681xsqdabztkdc@mail.sysdesign-edv.de> References: <20090301120249.13681xsqdabztkdc@mail.sysdesign-edv.de> Message-ID: <8cd017b80903010321i47f81a85l91f3a8c580d44e24@mail.gmail.com> Microsoft.Scripting and Microsoft.Script.Core is related to DLR (Dynamic Language Runtime) http://www.codeplex.com/dlr. IronPython is the Python implementation for .Net platform and relies heavily on DLR, which provides common infrastructure for dynamic language implementation on the .Net framework. One good document to read is http://compilerlab.members.winisp.net/hosting-tour.doc, the hosting API shows the interaction between the DLR and the language itself. For the rest, go to http://ironpython-urls.blogspot.com/ and you'll find all the link and infos you need. Dody G. On Sun, Mar 1, 2009 at 1:02 PM, wrote: > Hello all, > > I'm not sure whether this question is right on the users list but I didn't > find a developer list or something similar. > > I think IronPython is one of the most exciting projects I've seen the last > months and I would like to understand it better and maybe contribute some > stuff I've developed before for CPython. But I didn't understand how > Microsoft.Scripting, Microsoft.Scripting.Core und IronPython are related to > each other. I also find no documentation about these internals. > > Can anyone give me some hint where to start? > > Thanks a lot!! > > Best regards > Andy > > > HELPING HEADS for Hard- and Software > ------------------------------------------------------------------------- > Fuer Ihre Projekte entwickeln wir massgeschneiderte Loesungen - schnell, > flexibel und direkt vor Ort. Unser eingespieltes Team an erfahrenen Hard- > und Software-Spezialisten unterstuetzt Sie dort, wo Sie uns brauchen. > > > > -------------------------------------------------------------------------- > SysDesign GmbH > Saentisstrasse 25 > D-88079 Kressbronn am Bodensee > > Geschaeftsfuehrer: Franz Kleiner > Handelsregister: Ulm 632138 > -------------------------------------------------------------------------- > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- nomadlife.org From Jimmy.Schementi at microsoft.com Sun Mar 1 17:03:42 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Sun, 1 Mar 2009 08:03:42 -0800 Subject: [IronPython] IronPython to JavaScript In-Reply-To: References: <21413681.post@talk.nabble.com> <496BB5D5.30800@voidspace.org.uk> <1dab55500901130059k6c7f42b0t99c4d799e205bf06@mail.gmail.com> <496D1D5D.8020602@voidspace.org.uk> <1dab55500901140415u39298362n231f6245aef3132d@mail.gmail.com> <5283CA0A4168DF4FBBD71AE9ECA5A3284BDF1B5005@NA-EXMSG-C116.redmond.corp.microsoft.com> <1dab55500901141404n78edc71bn5bce5c7b46453568@mail.gmail.com> <5283CA0A4168DF4FBBD71AE9ECA5A3284BDF1B5157@NA-EXMSG-C116.redmond.corp.microsoft.com> Message-ID: <5283CA0A4168DF4FBBD71AE9ECA5A3284BEB61C756@NA-EXMSG-C116.redmond.corp.microsoft.com> Kristian wrote: > Just curios... Has anyone had time to look at my sample yet? Yes, and sorry for the horrifically late reply ... http://jimmy.schementi.com/silverlight/scriptable source is here: http://jimmy.schementi.com/silverlight/scriptable.zip There was a few small changes I made to Michael's code: 1. The Python code used to load the C# assembly will fail, since there's no namespace defined as Scriptable. It should be change to: clr.AddReferenceToFile("Scriptable.dll") import ScriptableForString ... and "Scriptable.dll" doesn't need to be added to the AppManifest.xaml, just needs to be present in the XAP. I use clr.AddReferenceToFile because clr.AddReference or clr.AddReferenceByName can fail depending on whether or not Microsoft.Scripting.Silverlight.dll is signed (which can differ if you get the bits from codeplex or build them yourself from github), because you didn't give the fully-qualified assembly name. 2. The SomeClass class needs to take new_string as a parameter, instead of "string" 3. There are both "some_class" and "someClass" variables, but there are intended to mean the same thing. So I changed them all to "someClass". 4. Calling event.OnEvent(args) in top-level Python code can run before JavaScript has a chance to hook the event, so either an error will happen, or nothing. It's strange because it executes onload of the Silverlight control, but sounds like that happens before the start script has a chance to finish. In my demo I trigger the event from a link. 5. http://jimmy.schementi.com/silverlight/scriptable/csharp/scriptable.cs MSDN documentation said that events need to be marked with ScriptableMemberAttribute, rather than ScriptableMember. I don't think I makes a difference ... From fuzzyman at voidspace.org.uk Sun Mar 1 17:27:18 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sun, 01 Mar 2009 08:27:18 -0800 Subject: [IronPython] IronPython to JavaScript In-Reply-To: <5283CA0A4168DF4FBBD71AE9ECA5A3284BEB61C756@NA-EXMSG-C116.redmond.corp.microsoft.com> References: <21413681.post@talk.nabble.com> <496BB5D5.30800@voidspace.org.uk> <1dab55500901130059k6c7f42b0t99c4d799e205bf06@mail.gmail.com> <496D1D5D.8020602@voidspace.org.uk> <1dab55500901140415u39298362n231f6245aef3132d@mail.gmail.com> <5283CA0A4168DF4FBBD71AE9ECA5A3284BDF1B5005@NA-EXMSG-C116.redmond.corp.microsoft.com> <1dab55500901141404n78edc71bn5bce5c7b46453568@mail.gmail.com> <5283CA0A4168DF4FBBD71AE9ECA5A3284BDF1B5157@NA-EXMSG-C116.redmond.corp.microsoft.com> <5283CA0A4168DF4FBBD71AE9ECA5A3284BEB61C756@NA-EXMSG-C116.redmond.corp.microsoft.com> Message-ID: <49AAB766.1020403@voidspace.org.uk> Jimmy Schementi wrote: > Kristian wrote: > >> Just curios... Has anyone had time to look at my sample yet? >> > > Yes, and sorry for the horrifically late reply ... > > http://jimmy.schementi.com/silverlight/scriptable > > source is here: > http://jimmy.schementi.com/silverlight/scriptable.zip > > There was a few small changes I made to Michael's code: > > 1. The Python code used to load the C# assembly will fail, since there's no namespace defined as Scriptable. It should be change to: > > clr.AddReferenceToFile("Scriptable.dll") > import ScriptableForString > > ... and "Scriptable.dll" doesn't need to be added to the AppManifest.xaml, just needs to be present in the XAP. I use clr.AddReferenceToFile because clr.AddReference or clr.AddReferenceByName can fail depending on whether or not Microsoft.Scripting.Silverlight.dll is signed (which can differ if you get the bits from codeplex or build them yourself from github), because you didn't give the fully-qualified assembly name. > > 2. The SomeClass class needs to take new_string as a parameter, instead of "string" > > 3. There are both "some_class" and "someClass" variables, but there are intended to mean the same thing. So I changed them all to "someClass". > > 4. Calling event.OnEvent(args) in top-level Python code can run before JavaScript has a chance to hook the event, so either an error will happen, or nothing. It's strange because it executes onload of the Silverlight control, but sounds like that happens before the start script has a chance to finish. In my demo I trigger the event from a link. > > 5. http://jimmy.schementi.com/silverlight/scriptable/csharp/scriptable.cs MSDN documentation said that events need to be marked with ScriptableMemberAttribute, rather than ScriptableMember. I don't think I makes a difference ... > > Thanks Jimmy - I'll look at these changes and incorporate them back into the article. Michael > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ From pub at patrickwolf.net Sun Mar 1 23:29:00 2009 From: pub at patrickwolf.net (Patrick Wolf) Date: Sun, 1 Mar 2009 14:29:00 -0800 Subject: [IronPython] IronPython console embeded References: Message-ID: <002301c99abd$24067830$6c136890$@net> Hi, I was wondering if it's possible to embed the IronPython console with syntax highlighting into a winform project. There is a sample on code project: http://www.codeproject.com/KB/edit/irontextbox2.aspx but it's missing the syntax highlighting of the console. Thanks, Patrick From fuzzyman at voidspace.org.uk Mon Mar 2 19:41:33 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 02 Mar 2009 10:41:33 -0800 Subject: [IronPython] IronPython console embeded In-Reply-To: <002301c99abd$24067830$6c136890$@net> References: <002301c99abd$24067830$6c136890$@net> Message-ID: <49AC285D.7040201@voidspace.org.uk> Patrick Wolf wrote: > Hi, > > I was wondering if it's possible to embed the IronPython console with syntax > highlighting into a winform project. > > There is a sample on code project: > http://www.codeproject.com/KB/edit/irontextbox2.aspx but it's missing the > syntax highlighting of the console. > Well, it's definitely possible but you would have to implement it yourself I guess. The console app is open source, so you can get at the analysis parts of the console - but doing highlighting in winforms is very different to highlighting in the console so it would need porting (can't be *directly* embedded). Michael > Thanks, > Patrick > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ From Jimmy.Schementi at microsoft.com Mon Mar 2 19:49:42 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Mon, 2 Mar 2009 10:49:42 -0800 Subject: [IronPython] IronPython console embeded In-Reply-To: <49AC285D.7040201@voidspace.org.uk> References: <002301c99abd$24067830$6c136890$@net> <49AC285D.7040201@voidspace.org.uk> Message-ID: <5283CA0A4168DF4FBBD71AE9ECA5A3284BEB61C9FA@NA-EXMSG-C116.redmond.corp.microsoft.com> It's be great to have a DLR-console library that has different UI-adapters, like Winforms, WPF, Silverlight, etc. It's something we were considering adding to Microsoft.Scripting.Hosting.Shell, but no one ever had time/a reason to do it. So, keep that in mind if you actually try to build it, and others might help add more UI-framework support. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Monday, March 02, 2009 10:42 AM > To: Discussion of IronPython > Subject: Re: [IronPython] IronPython console embeded > > Patrick Wolf wrote: > > Hi, > > > > I was wondering if it's possible to embed the IronPython console with > syntax > > highlighting into a winform project. > > > > There is a sample on code project: > > http://www.codeproject.com/KB/edit/irontextbox2.aspx but it's missing > the > > syntax highlighting of the console. > > > > Well, it's definitely possible but you would have to implement it > yourself I guess. The console app is open source, so you can get at the > analysis parts of the console - but doing highlighting in winforms is > very different to highlighting in the console so it would need porting > (can't be *directly* embedded). > > Michael > > Thanks, > > Patrick > > > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > -- > http://www.ironpythoninaction.com/ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From rbear at rbear.net Mon Mar 2 20:53:41 2009 From: rbear at rbear.net (R. Bear Smith) Date: Mon, 2 Mar 2009 14:53:41 -0500 Subject: [IronPython] CustomSymbolDictionary question Message-ID: <001801c99b70$97092090$c51b61b0$@net> Hi all, I have a situation where I need to run a script many times with a different scope each time. I want to be able to substitute an instance of a class each time it is asked for. For example, x = MyCSharpClass() Using CustomSymbolDictionary I am able to store the class created on the first call and then substitute it for every additional call to x from different scopes. While this works to provide the same class instance to every scope, a new class is being created on every call and replaced with the original class. Is there a way to only create the class once. The script will be user code so I have no prior knowledge of variable names and such. Any ideas would be appreciated. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jimmy.Schementi at microsoft.com Mon Mar 2 21:09:54 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Mon, 2 Mar 2009 12:09:54 -0800 Subject: [IronPython] CustomSymbolDictionary question In-Reply-To: <001801c99b70$97092090$c51b61b0$@net> References: <001801c99b70$97092090$c51b61b0$@net> Message-ID: <5283CA0A4168DF4FBBD71AE9ECA5A3284BEB61CD57@NA-EXMSG-C116.redmond.corp.microsoft.com> So, if I understand this right, you have user code, which you need to run each time first ... and then your code which you want to run once after. Something like: // when your app starts, or something, compile your code, but don't run yet var compiledCode = engine.CreateScriptSourceFromString(code).Compile(); // do other stuff .... // execute user code var userScope = engine.ExecuteFile("usercode.py"); // run your code in the user's code's scope compiledCode.Execute(userScope); From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of R. Bear Smith Sent: Monday, March 02, 2009 11:54 AM To: users at lists.ironpython.com Subject: [IronPython] CustomSymbolDictionary question Hi all, I have a situation where I need to run a script many times with a different scope each time. I want to be able to substitute an instance of a class each time it is asked for. For example, x = MyCSharpClass() Using CustomSymbolDictionary I am able to store the class created on the first call and then substitute it for every additional call to x from different scopes. While this works to provide the same class instance to every scope, a new class is being created on every call and replaced with the original class. Is there a way to only create the class once. The script will be user code so I have no prior knowledge of variable names and such. Any ideas would be appreciated. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From rbear at rbear.net Mon Mar 2 21:38:30 2009 From: rbear at rbear.net (R. Bear Smith) Date: Mon, 2 Mar 2009 15:38:30 -0500 Subject: [IronPython] CustomSymbolDictionary question In-Reply-To: <5283CA0A4168DF4FBBD71AE9ECA5A3284BEB61CD57@NA-EXMSG-C116.redmond.corp.microsoft.com> References: <001801c99b70$97092090$c51b61b0$@net> <5283CA0A4168DF4FBBD71AE9ECA5A3284BEB61CD57@NA-EXMSG-C116.redmond.corp.microsoft.com> Message-ID: <002901c99b76$d9a56070$8cf02150$@net> What I am trying to do is run a user script over and over. Each time it runs there will be different data in the object model that they access to compute there values and such. The trick is they need to be able to access values from prior runs. So the way I have addressed this is they create a c# class called DataSeries, I maintain state on it behind the scenes as to what run they are on, then they can use an indexer on it to get prior values. so x = DataSeries() do some calculations x.set(somevalue) // then on the next run of the script they can y = x[1] // which gives them access to the value of x from the prior scope run. accessing prior values is required for what the user is doing and while there are many ways to code it, keeping it very simple for the users is a priority. Hope that helps From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jimmy Schementi Sent: Monday, March 02, 2009 3:10 PM To: Discussion of IronPython Subject: Re: [IronPython] CustomSymbolDictionary question So, if I understand this right, you have user code, which you need to run each time first ... and then your code which you want to run once after. Something like: // when your app starts, or something, compile your code, but don't run yet var compiledCode = engine.CreateScriptSourceFromString(code).Compile(); // do other stuff .... // execute user code var userScope = engine.ExecuteFile("usercode.py"); // run your code in the user's code's scope compiledCode.Execute(userScope); From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of R. Bear Smith Sent: Monday, March 02, 2009 11:54 AM To: users at lists.ironpython.com Subject: [IronPython] CustomSymbolDictionary question Hi all, I have a situation where I need to run a script many times with a different scope each time. I want to be able to substitute an instance of a class each time it is asked for. For example, x = MyCSharpClass() Using CustomSymbolDictionary I am able to store the class created on the first call and then substitute it for every additional call to x from different scopes. While this works to provide the same class instance to every scope, a new class is being created on every call and replaced with the original class. Is there a way to only create the class once. The script will be user code so I have no prior knowledge of variable names and such. Any ideas would be appreciated. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Mon Mar 2 22:50:59 2009 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 2 Mar 2009 13:50:59 -0800 Subject: [IronPython] CustomSymbolDictionary question In-Reply-To: <002901c99b76$d9a56070$8cf02150$@net> References: <001801c99b70$97092090$c51b61b0$@net> <5283CA0A4168DF4FBBD71AE9ECA5A3284BEB61CD57@NA-EXMSG-C116.redmond.corp.microsoft.com> <002901c99b76$d9a56070$8cf02150$@net> Message-ID: <350E7D38B6D819428718949920EC2355571BF4326B@NA-EXMSG-C102.redmond.corp.microsoft.com> You can create the DataSeries object for them and include it in each call? Or can you do something like: def Init(): return DataSeries() and only call their Init function once? From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of R. Bear Smith Sent: Monday, March 02, 2009 12:38 PM To: 'Discussion of IronPython' Subject: Re: [IronPython] CustomSymbolDictionary question What I am trying to do is run a user script over and over. Each time it runs there will be different data in the object model that they access to compute there values and such. The trick is they need to be able to access values from prior runs. So the way I have addressed this is they create a c# class called DataSeries, I maintain state on it behind the scenes as to what run they are on, then they can use an indexer on it to get prior values. so x = DataSeries() do some calculations x.set(somevalue) // then on the next run of the script they can y = x[1] // which gives them access to the value of x from the prior scope run. accessing prior values is required for what the user is doing and while there are many ways to code it, keeping it very simple for the users is a priority. Hope that helps From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jimmy Schementi Sent: Monday, March 02, 2009 3:10 PM To: Discussion of IronPython Subject: Re: [IronPython] CustomSymbolDictionary question So, if I understand this right, you have user code, which you need to run each time first ... and then your code which you want to run once after. Something like: // when your app starts, or something, compile your code, but don't run yet var compiledCode = engine.CreateScriptSourceFromString(code).Compile(); // do other stuff .... // execute user code var userScope = engine.ExecuteFile("usercode.py"); // run your code in the user's code's scope compiledCode.Execute(userScope); From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of R. Bear Smith Sent: Monday, March 02, 2009 11:54 AM To: users at lists.ironpython.com Subject: [IronPython] CustomSymbolDictionary question Hi all, I have a situation where I need to run a script many times with a different scope each time. I want to be able to substitute an instance of a class each time it is asked for. For example, x = MyCSharpClass() Using CustomSymbolDictionary I am able to store the class created on the first call and then substitute it for every additional call to x from different scopes. While this works to provide the same class instance to every scope, a new class is being created on every call and replaced with the original class. Is there a way to only create the class once. The script will be user code so I have no prior knowledge of variable names and such. Any ideas would be appreciated. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Mon Mar 2 23:13:36 2009 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 2 Mar 2009 14:13:36 -0800 Subject: [IronPython] Please vote up this DLR memory leak bug In-Reply-To: <8cd017b80902260007w7a719b52m2db893bd6a4d7d0b@mail.gmail.com> References: <8cd017b80902221409p564cf1b0j31018982f3e51f1a@mail.gmail.com> <350E7D38B6D819428718949920EC2355571BE89BBD@NA-EXMSG-C102.redmond.corp.microsoft.com> <8cd017b80902250838s7349e6bct830546fc3b34fce5@mail.gmail.com> <350E7D38B6D819428718949920EC2355571BE8A18E@NA-EXMSG-C102.redmond.corp.microsoft.com> <8cd017b80902260007w7a719b52m2db893bd6a4d7d0b@mail.gmail.com> Message-ID: <350E7D38B6D819428718949920EC2355571BF432A3@NA-EXMSG-C102.redmond.corp.microsoft.com> Sorry for the slow response there's nothing that jumped out me immediately. And the older versions make me inclined towards not investigating this too deeply. Instead I talked to Jimmy about getting a new release of the ASP.Net support for IronPython out so hopefully we can do that soon. That will be based off of IronPython 2.0.x which has the re-named namespaces for 3.5 compatability. If you want to drill into this more I'd suggest looking at all the strings that exist: !DumpHeap -mt 790fd8c4 (note this number may change between runs) and: Dump all of the object arrays: !DumpHeap -mt 7912d8f8 And then doing a: !da On some of the individual arrays to see what they are holding onto. Depending on what's in those arrays it may be an IronPython, DLR, or someone else's bugs. The presence of so many strings leads me to believe this could be a case of interned strings being a problem like in one of the repro cases, for example doing: for i in xrange(10000000): exec 'def f' + str(i) + '(): pass' would be an example of this. You can also do !GCRoot on individual objects such as the strings. If the strings are being kept alive by a Dictionary or Dictionary then it's our interning which is doing this. Let me know what you get from here and maybe there'll be something obvious or maybe I can have some other suggestions. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Dody Gunawinata > Sent: Thursday, February 26, 2009 12:07 AM > To: Dino Viehland > Cc: Discussion of IronPython > Subject: Re: [IronPython] Please vote up this DLR memory leak bug > > Microsoft.Scripting2.Core is a namespace copy of the IP source code - > based on IP 2.0 Beta 3 - just before one version that introduced > incompatibility with .Net 3.5 > > We are using ASP.Net with IronPython support based on July CTP 2007 > (which I think ran on IP 2.0 Alpha X). The latest drop of IP for > ASP.Net was based on IP 2.0 Beta 4 which contained the .Net 3.5 > incompatibility which makes in unusable for our application. > > So my application has 2 copies of IP - one that runs the asp.net > dynamic support and the other that runs the scripting support (with 2 > suffix in the namespace). It's a stupid situation but we rely a IP for > ASP.Net and that piece of technology has not been brought up to date > to a working state for .Net 3.5 framework- and our web productions > people rely on the software so it's full speed ahead regardless of the > technology limitation. > > This memory leak might be gone if we have an up to date IP for ASP.Net > but one never know so here's the last 25 lines of the heap dump. I > hope this is useful. > > > > 79104368 3939 94536 System.Collections.ArrayList > 7911f030 1708 95648 System.Reflection.Emit.DynamicMethod > 7911f400 2999 95968 System.Reflection.Emit.SignatureHelper > 109cbc9c 2516 100640 > System.Linq.Expressions2.ConditionalExpression > 1085c930 3181 101792 System.Scripting.SourceSpan > 109c4594 3244 103808 > System.Linq.Expressions2.ParameterExpression > 10f63bcc 1237 110188 > System.Collections.Generic.Dictionary`2+Entry[[System.Linq.Expressions2 > .Expression, > Microsoft.Scripting2.Core],[System.Linq.Expressions2.CompilerScope+Stor > age, > Microsoft.Scripting2.Core]][] > 79135014 3 114968 > System.Collections.Generic.Dictionary`2+Entry[[System.Int32, > mscorlib],[System.String, mscorlib]][] > 10f60a2c 2260 117520 > System.Collections.Generic.Dictionary`2[[System.Linq.Expressions2.Expre > ssion, > Microsoft.Scripting2.Core],[System.Object, mscorlib]] > 109cfb1c 2736 120384 > System.Linq.Expressions2.BinaryExpression > 10f6145c 1743 125700 > System.Collections.Generic.Dictionary`2+Entry[[System.Linq.Expressions2 > .Expression, > Microsoft.Scripting2.Core],[System.Object, mscorlib]][] > 109c4e4c 3164 126560 System.Linq.Expressions2.ScopeExpression > 109c4274 4142 132544 > System.Linq.Expressions2.VariableExpression > 109caf7c 3735 134460 System.Linq.Expressions2.UnaryExpression > 10f5cd24 3762 135432 > System.Linq.Expressions2.StackSpiller+ChildRewriter > 106fa09c 40 138784 > System.Collections.Generic.Dictionary`2+Entry[[Microsoft.Scripting.Symb > olId, > Microsoft.Scripting],[Microsoft.Scripting.DynamicMixin+SlotInfo, > Microsoft.Scripting]][] > 79111038 2585 144760 System.Reflection.RuntimePropertyInfo > 79110680 3086 148128 System.Signature > 106f63bc 4183 150588 Microsoft.Scripting.BuiltinFunction > 109cbb3c 4327 155772 > System.Linq.Expressions2.MemberExpression > 791336d8 37 162960 > System.Collections.Generic.Dictionary`2+Entry[[System.String, > mscorlib],[System.Int32, mscorlib]][] > 109c320c 4726 170136 > System.Linq.Expressions2.AssignmentExpression > 7912f348 7171 172104 > System.Collections.Generic.List`1[[System.Reflection.MethodInfo, > mscorlib]] > 7911f538 1708 177632 > System.Reflection.Emit.DynamicILGenerator > 7910ea30 15685 188220 System.RuntimeMethodHandle > 109c76cc 6304 201728 System.Linq.Expressions2.Block > 7912d9bc 889 204576 System.Collections.Hashtable+bucket[] > 790ff734 10742 214840 System.RuntimeType > 79130510 11613 223528 System.RuntimeTypeHandle[] > 791208b4 16407 262512 System.Reflection.Emit.GenericFieldInfo > 10f552cc 18594 297504 > System.Collections.ObjectModel.ReadOnlyCollection`1[[System.Linq.Expres > sions2.Expression, > Microsoft.Scripting2.Core]] > 109c4f1c 9671 386840 > System.Linq.Expressions2.MethodCallExpression > 7912dd40 646 432936 System.Char[] > 109c7634 16161 517152 > System.Linq.Expressions2.ConstantExpression > 79109778 12835 718760 System.Reflection.RuntimeMethodInfo > 79135538 1494 1167624 System.Reflection.Emit.__FixupData[] > 7910dd38 124487 1493844 System.RuntimeTypeHandle > 7912d7c0 17031 1846316 System.Int32[] > 7912dae8 11218 1877012 System.Byte[] > 790fd8c4 46924 2987964 System.String > 7912d8f8 134460 5074708 System.Object[] > > > On Wed, Feb 25, 2009 at 10:51 PM, Dino Viehland > wrote: > > Your approach should be perfectly fine (it's basically what > CompiledCode was designed for) and it's not clear to me what would be > leaking in this scenario. > > > > One suggestion I'd have for you is to download and install windbg > (http://www.microsoft.com/whdc/DevTools/Debugging/default.mspx). > > > > Then attach to your process which is using all the memory and type > in: > > > > .loadby sos mscorwks > > !DumpHeap -stat > > > > And send back the about the last 25 lines of that output. ?That'll > give us the most common objects which are using memory in the GC heap > and we might be able to track it down from there. ?If that's not > sufficient maybe we can iterate and figure out what's going on. > > > >> -----Original Message----- > >> From: users-bounces at lists.ironpython.com [mailto:users- > >> bounces at lists.ironpython.com] On Behalf Of Dody Gunawinata > >> Sent: Wednesday, February 25, 2009 8:38 AM > >> To: Dino Viehland > >> Cc: Discussion of IronPython > >> Subject: Re: [IronPython] Please vote up this DLR memory leak bug > >> > >> What is the impact of caching CompiledCode into this > "collectability" > >> issue? > >> > >> I am working on a CMS that expose functions implemented in > IronPython > >> to a template engine. So I read a directory of 40 or 50 xx.py files, > >> load it up and compiled them. This is off course a costly operation > to > >> do it in every single HTTP request (and SLOW) so I compiled the > source > >> code to CompiledCode and cache them. > >> > >> Then for every HTTP request, I retrieve these CompiledCode's from > the > >> Cache and call Execute(scope) to make the frozen code to be a real > >> function. So with X HTTP request, there will be X scope and ?(X * > 40) > >> functions being generated at runtime. > >> > >> Now our memory consumption is huge and is getting bigger until IIS > >> gave up and recycle the process. > >> > >> Dody G. > >> > >> > >> > >> > >> > Just some comments on this as there's a few issues intertwined > here: > >> > > >> > 1.?????? Optimized code - this is currently the default and part > of > >> the > >> > original problem.? If you execute code in "optimized" mode we > >> generate an > >> > uncollectible type.? In 2.6 I'm switching the default to be non- > >> optimized > >> > and I also am trying out a change that should reduce the amount of > >> leakage > >> > when we do this.? That will make the out of the box experience > much > >> better. > >> > > >> > >> > >> > 2.?????? Multiple script runtimes - there's a bug in the DLR when > you > >> > repeatedly create script runtimes that the rules aren't getting > >> collected. > >> > This is supposed to be fixed in 2.6 but I'm still seeing some > leaks > >> in this > >> > scenario that I'll look into and fix.? Back-porting this to 2.0 > would > >> be > >> > quite difficult as a lot of things have changed but we could > >> certainly look > >> > at backporting a different fix to 2.0. > >> > > >> > >> > 3.?????? There's a repro that defines "TestScriptOldClass" + n > which > >> leaks. > >> > All class / function / member names in code get interned and this > is > >> where > >> > this leak is coming from.? If you remove the + n then everything > >> works.? We > >> > may get rid of this interning at some point in the future but it's > a > >> fairly > >> > significant change.? I'm inclined to believe this one isn't as > much > >> of an > >> > issue as usually you aren't compiling code with new names every > >> single > >> > type. > >> > > >> > >> > >> > >> > >> > > >> > > >> > From: users-bounces at lists.ironpython.com > >> > [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dody > >> Gunawinata > >> > Sent: Sunday, February 22, 2009 2:10 PM > >> > To: Discussion of IronPython > >> > Subject: [IronPython] Please vote up this DLR memory leak bug > >> > > >> > > >> > > >> > There's only 5 votes so far. > >> > > >> > > >> > > >> > > >> > http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=20399 > >> > > >> > > >> > > >> > -- > >> > nomadlife.org > >> > >> > >> > >> -- > >> nomadlife.org > >> _______________________________________________ > >> Users mailing list > >> Users at lists.ironpython.com > >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > -- > nomadlife.org > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From empirebuilder at gmail.com Tue Mar 3 12:55:09 2009 From: empirebuilder at gmail.com (Dody Gunawinata) Date: Tue, 3 Mar 2009 13:55:09 +0200 Subject: [IronPython] Please vote up this DLR memory leak bug In-Reply-To: <350E7D38B6D819428718949920EC2355571BF432A3@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <8cd017b80902221409p564cf1b0j31018982f3e51f1a@mail.gmail.com> <350E7D38B6D819428718949920EC2355571BE89BBD@NA-EXMSG-C102.redmond.corp.microsoft.com> <8cd017b80902250838s7349e6bct830546fc3b34fce5@mail.gmail.com> <350E7D38B6D819428718949920EC2355571BE8A18E@NA-EXMSG-C102.redmond.corp.microsoft.com> <8cd017b80902260007w7a719b52m2db893bd6a4d7d0b@mail.gmail.com> <350E7D38B6D819428718949920EC2355571BF432A3@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <8cd017b80903030355h652aee80ra934e007b0f4cdac@mail.gmail.com> OK, thanks for the tips. I'll dig around. IronPython on ASP.Net is awesome - especially because it is instantly hackable by non programmers (web designers). It has better approachability than PHP or C# and low learning curve for simple web programming. I notice similar thing with our XML on HTTP API. We have people building a Visio client application and Excel (go figure) for the CMS using VBScript just because they can concatenate xml string and send it using built in http library and get their job done. No design patterns, or OO or programming practice. Just code by casual coders. Dody G. On Tue, Mar 3, 2009 at 12:13 AM, Dino Viehland wrote: > Sorry for the slow response there's nothing that jumped out me immediately. ?And the older versions make me inclined towards not investigating this too deeply. ?Instead I talked to Jimmy about getting a new release of the ASP.Net support for IronPython out so hopefully we can do that soon. ?That will be based off of IronPython 2.0.x which has the re-named namespaces for 3.5 compatability. > > If you want to drill into this more I'd suggest looking at all the strings that exist: > > !DumpHeap -mt 790fd8c4 > > (note this number may change between runs) and: > > Dump all of the object arrays: > !DumpHeap -mt 7912d8f8 > > And then doing a: > > !da > > On some of the individual arrays to see what they are holding onto. ?Depending on what's in those arrays it may be an IronPython, DLR, or someone else's bugs. > > The presence of so many strings leads me to believe this could be a case of interned strings being a problem like in one of the repro cases, for example doing: > > for i in xrange(10000000): > ? ? ? ?exec 'def f' + str(i) + '(): pass' > > would be an example of this. > > You can also do !GCRoot on individual objects such as the strings. ?If the strings are being kept alive by a Dictionary or Dictionary then it's our interning which is doing this. > > Let me know what you get from here and maybe there'll be something obvious or maybe I can have some other suggestions. > > >> -----Original Message----- >> From: users-bounces at lists.ironpython.com [mailto:users- >> bounces at lists.ironpython.com] On Behalf Of Dody Gunawinata >> Sent: Thursday, February 26, 2009 12:07 AM >> To: Dino Viehland >> Cc: Discussion of IronPython >> Subject: Re: [IronPython] Please vote up this DLR memory leak bug >> >> Microsoft.Scripting2.Core is a namespace copy of the IP source code - >> based on IP 2.0 Beta 3 - just before one version that introduced >> incompatibility with .Net 3.5 >> >> We are using ASP.Net with IronPython support based on July CTP 2007 >> (which I think ran on IP 2.0 Alpha X). The latest drop of IP for >> ASP.Net was based on IP 2.0 Beta 4 which contained the .Net 3.5 >> incompatibility which makes in unusable for our application. >> >> So my application has 2 copies of IP - one that runs the asp.net >> dynamic support and the other that runs the scripting support (with 2 >> suffix in the namespace). It's a stupid situation but we rely a IP for >> ASP.Net and that piece of technology has not been brought up to date >> to a working state for .Net 3.5 framework- and our web productions >> people rely on the software so it's full speed ahead regardless of the >> technology limitation. >> >> This memory leak might be gone if we have an up to date IP for ASP.Net >> but one never know so here's the last 25 lines of the heap dump. I >> hope this is useful. >> >> >> >> 79104368 ? ? 3939 ? ? ? ?94536 System.Collections.ArrayList >> 7911f030 ? ? 1708 ? ? ? ?95648 System.Reflection.Emit.DynamicMethod >> 7911f400 ? ? 2999 ? ? ? ?95968 System.Reflection.Emit.SignatureHelper >> 109cbc9c ? ? 2516 ? ? ? 100640 >> System.Linq.Expressions2.ConditionalExpression >> 1085c930 ? ? 3181 ? ? ? 101792 System.Scripting.SourceSpan >> 109c4594 ? ? 3244 ? ? ? 103808 >> System.Linq.Expressions2.ParameterExpression >> 10f63bcc ? ? 1237 ? ? ? 110188 >> System.Collections.Generic.Dictionary`2+Entry[[System.Linq.Expressions2 >> .Expression, >> Microsoft.Scripting2.Core],[System.Linq.Expressions2.CompilerScope+Stor >> age, >> Microsoft.Scripting2.Core]][] >> 79135014 ? ? ? ?3 ? ? ? 114968 >> System.Collections.Generic.Dictionary`2+Entry[[System.Int32, >> mscorlib],[System.String, mscorlib]][] >> 10f60a2c ? ? 2260 ? ? ? 117520 >> System.Collections.Generic.Dictionary`2[[System.Linq.Expressions2.Expre >> ssion, >> Microsoft.Scripting2.Core],[System.Object, mscorlib]] >> 109cfb1c ? ? 2736 ? ? ? 120384 >> System.Linq.Expressions2.BinaryExpression >> 10f6145c ? ? 1743 ? ? ? 125700 >> System.Collections.Generic.Dictionary`2+Entry[[System.Linq.Expressions2 >> .Expression, >> Microsoft.Scripting2.Core],[System.Object, mscorlib]][] >> 109c4e4c ? ? 3164 ? ? ? 126560 System.Linq.Expressions2.ScopeExpression >> 109c4274 ? ? 4142 ? ? ? 132544 >> System.Linq.Expressions2.VariableExpression >> 109caf7c ? ? 3735 ? ? ? 134460 System.Linq.Expressions2.UnaryExpression >> 10f5cd24 ? ? 3762 ? ? ? 135432 >> System.Linq.Expressions2.StackSpiller+ChildRewriter >> 106fa09c ? ? ? 40 ? ? ? 138784 >> System.Collections.Generic.Dictionary`2+Entry[[Microsoft.Scripting.Symb >> olId, >> Microsoft.Scripting],[Microsoft.Scripting.DynamicMixin+SlotInfo, >> Microsoft.Scripting]][] >> 79111038 ? ? 2585 ? ? ? 144760 System.Reflection.RuntimePropertyInfo >> 79110680 ? ? 3086 ? ? ? 148128 System.Signature >> 106f63bc ? ? 4183 ? ? ? 150588 Microsoft.Scripting.BuiltinFunction >> 109cbb3c ? ? 4327 ? ? ? 155772 >> System.Linq.Expressions2.MemberExpression >> 791336d8 ? ? ? 37 ? ? ? 162960 >> System.Collections.Generic.Dictionary`2+Entry[[System.String, >> mscorlib],[System.Int32, mscorlib]][] >> 109c320c ? ? 4726 ? ? ? 170136 >> System.Linq.Expressions2.AssignmentExpression >> 7912f348 ? ? 7171 ? ? ? 172104 >> System.Collections.Generic.List`1[[System.Reflection.MethodInfo, >> mscorlib]] >> 7911f538 ? ? 1708 ? ? ? 177632 >> System.Reflection.Emit.DynamicILGenerator >> 7910ea30 ? ?15685 ? ? ? 188220 System.RuntimeMethodHandle >> 109c76cc ? ? 6304 ? ? ? 201728 System.Linq.Expressions2.Block >> 7912d9bc ? ? ?889 ? ? ? 204576 System.Collections.Hashtable+bucket[] >> 790ff734 ? ?10742 ? ? ? 214840 System.RuntimeType >> 79130510 ? ?11613 ? ? ? 223528 System.RuntimeTypeHandle[] >> 791208b4 ? ?16407 ? ? ? 262512 System.Reflection.Emit.GenericFieldInfo >> 10f552cc ? ?18594 ? ? ? 297504 >> System.Collections.ObjectModel.ReadOnlyCollection`1[[System.Linq.Expres >> sions2.Expression, >> Microsoft.Scripting2.Core]] >> 109c4f1c ? ? 9671 ? ? ? 386840 >> System.Linq.Expressions2.MethodCallExpression >> 7912dd40 ? ? ?646 ? ? ? 432936 System.Char[] >> 109c7634 ? ?16161 ? ? ? 517152 >> System.Linq.Expressions2.ConstantExpression >> 79109778 ? ?12835 ? ? ? 718760 System.Reflection.RuntimeMethodInfo >> 79135538 ? ? 1494 ? ? ?1167624 System.Reflection.Emit.__FixupData[] >> 7910dd38 ? 124487 ? ? ?1493844 System.RuntimeTypeHandle >> 7912d7c0 ? ?17031 ? ? ?1846316 System.Int32[] >> 7912dae8 ? ?11218 ? ? ?1877012 System.Byte[] >> 790fd8c4 ? ?46924 ? ? ?2987964 System.String >> 7912d8f8 ? 134460 ? ? ?5074708 System.Object[] >> >> >> On Wed, Feb 25, 2009 at 10:51 PM, Dino Viehland >> wrote: >> > Your approach should be perfectly fine (it's basically what >> CompiledCode was designed for) and it's not clear to me what would be >> leaking in this scenario. >> > >> > One suggestion I'd have for you is to download and install windbg >> (http://www.microsoft.com/whdc/DevTools/Debugging/default.mspx). >> > >> > Then attach to your process which is using all the memory and type >> in: >> > >> > .loadby sos mscorwks >> > !DumpHeap -stat >> > >> > And send back the about the last 25 lines of that output. ?That'll >> give us the most common objects which are using memory in the GC heap >> and we might be able to track it down from there. ?If that's not >> sufficient maybe we can iterate and figure out what's going on. >> > >> >> -----Original Message----- >> >> From: users-bounces at lists.ironpython.com [mailto:users- >> >> bounces at lists.ironpython.com] On Behalf Of Dody Gunawinata >> >> Sent: Wednesday, February 25, 2009 8:38 AM >> >> To: Dino Viehland >> >> Cc: Discussion of IronPython >> >> Subject: Re: [IronPython] Please vote up this DLR memory leak bug >> >> >> >> What is the impact of caching CompiledCode into this >> "collectability" >> >> issue? >> >> >> >> I am working on a CMS that expose functions implemented in >> IronPython >> >> to a template engine. So I read a directory of 40 or 50 xx.py files, >> >> load it up and compiled them. This is off course a costly operation >> to >> >> do it in every single HTTP request (and SLOW) so I compiled the >> source >> >> code to CompiledCode and cache them. >> >> >> >> Then for every HTTP request, I retrieve these CompiledCode's from >> the >> >> Cache and call Execute(scope) to make the frozen code to be a real >> >> function. So with X HTTP request, there will be X scope and ?(X * >> 40) >> >> functions being generated at runtime. >> >> >> >> Now our memory consumption is huge and is getting bigger until IIS >> >> gave up and recycle the process. >> >> >> >> Dody G. >> >> >> >> >> >> >> >> >> >> > Just some comments on this as there's a few issues intertwined >> here: >> >> > >> >> > 1.?????? Optimized code - this is currently the default and part >> of >> >> the >> >> > original problem.? If you execute code in "optimized" mode we >> >> generate an >> >> > uncollectible type.? In 2.6 I'm switching the default to be non- >> >> optimized >> >> > and I also am trying out a change that should reduce the amount of >> >> leakage >> >> > when we do this.? That will make the out of the box experience >> much >> >> better. >> >> > >> >> >> >> >> >> > 2.?????? Multiple script runtimes - there's a bug in the DLR when >> you >> >> > repeatedly create script runtimes that the rules aren't getting >> >> collected. >> >> > This is supposed to be fixed in 2.6 but I'm still seeing some >> leaks >> >> in this >> >> > scenario that I'll look into and fix.? Back-porting this to 2.0 >> would >> >> be >> >> > quite difficult as a lot of things have changed but we could >> >> certainly look >> >> > at backporting a different fix to 2.0. >> >> > >> >> >> >> > 3.?????? There's a repro that defines "TestScriptOldClass" + n >> which >> >> leaks. >> >> > All class / function / member names in code get interned and this >> is >> >> where >> >> > this leak is coming from.? If you remove the + n then everything >> >> works.? We >> >> > may get rid of this interning at some point in the future but it's >> a >> >> fairly >> >> > significant change.? I'm inclined to believe this one isn't as >> much >> >> of an >> >> > issue as usually you aren't compiling code with new names every >> >> single >> >> > type. >> >> > >> >> >> >> >> >> >> >> >> >> > >> >> > >> >> > From: users-bounces at lists.ironpython.com >> >> > [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dody >> >> Gunawinata >> >> > Sent: Sunday, February 22, 2009 2:10 PM >> >> > To: Discussion of IronPython >> >> > Subject: [IronPython] Please vote up this DLR memory leak bug >> >> > >> >> > >> >> > >> >> > There's only 5 votes so far. >> >> > >> >> > >> >> > >> >> > >> >> >> http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=20399 >> >> > >> >> > >> >> > >> >> > -- >> >> > nomadlife.org >> >> >> >> >> >> >> >> -- >> >> nomadlife.org >> >> _______________________________________________ >> >> Users mailing list >> >> Users at lists.ironpython.com >> >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > >> >> >> >> -- >> nomadlife.org >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- nomadlife.org From bernd.viehmann at ascom-ac.de Tue Mar 3 17:03:51 2009 From: bernd.viehmann at ascom-ac.de (Bernd Viehmann) Date: Tue, 03 Mar 2009 17:03:51 +0100 Subject: [IronPython] Array of Objects in IronPython Message-ID: <49AD54E7.3010000@ascom-ac.de> Hi, I have a question regarding a typed array. Basically I want to use IronPython and ADO.NET to get some data from a stored procedure. My first idea was to use a SQL DataReader to get all the lines of my result table into an array. Csharp way looks like this: *ArrayList rowList = new ArrayList();* SqlDataReader reader = storedProcCommand.ExecuteReader(); while (reader.Read()) { *object[] values = new object[reader.FieldCount];* *reader.GetValues(values);* *rowList.Add(values);* } My problem is to generate an array of type object to feed *reader.GetValues(values) with it. Any ideas how this can be done? Kind regards from Germany Bernd * From empirebuilder at gmail.com Tue Mar 3 17:07:49 2009 From: empirebuilder at gmail.com (Dody Gunawinata) Date: Tue, 3 Mar 2009 18:07:49 +0200 Subject: [IronPython] Array of Objects in IronPython In-Reply-To: <49AD54E7.3010000@ascom-ac.de> References: <49AD54E7.3010000@ascom-ac.de> Message-ID: <8cd017b80903030807q1a5db22m8ffed72080e58d90@mail.gmail.com> values = System.Array.CreateInstance(System.Object, reader.FieldCount) On Tue, Mar 3, 2009 at 6:03 PM, Bernd Viehmann wrote: > Hi, > > I have a question regarding a typed array. > > Basically I want to use IronPython and ADO.NET to get some data from a > stored procedure. My first idea was to use a SQL DataReader to get all the > lines of my result table into an array. Csharp way looks like this: > > *ArrayList rowList = new ArrayList();* > SqlDataReader reader = storedProcCommand.ExecuteReader(); > while (reader.Read()) > { > ?*object[] values = new object[reader.FieldCount];* > ?*reader.GetValues(values);* > ?*rowList.Add(values);* > } > > My problem is to generate an array of type object to feed > *reader.GetValues(values) with it. Any ideas how this can be done? > > Kind regards from Germany > > Bernd > > * > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- nomadlife.org From desleo at gmail.com Tue Mar 3 17:30:47 2009 From: desleo at gmail.com (Leo Carbajal) Date: Tue, 3 Mar 2009 10:30:47 -0600 Subject: [IronPython] IronPython 2.0 RC 2 on Mono In-Reply-To: <499F0431.3000708@brynmawr.edu> References: <5b0248170812072110j6a2694c8v8f221a9575cf1f22@mail.gmail.com> <22120412.post@talk.nabble.com> <499F0431.3000708@brynmawr.edu> Message-ID: According to MoMA, there are over 40 red flags between the IPY dlls and the DLR (Microsoft Scripting) dlls. One of them has 2 P\Invokes that it doesn't like and the others are a mix of TODOs on the mono side, or not-implementeds. Another block (for me) is that Mono doesn't implement the following method: AppDomain AppDomain.CreateDomain (string, Evidence, AppDomainSetup, PermissionSet, StrongName[]) Though for the latter I'm sure theres a long way to accomplish the same thing. It seems moot anyway, since IPY2 will not run as-is yet. I'm sure it will be better as Mono keeps on maturing. On Fri, Feb 20, 2009 at 1:27 PM, Douglas S. Blank wrote: > Doug Blank wrote: > >> Now that IronPython2 is out, wondering about IronPython on Mono... >> >> Seo Sanghyeon-3 wrote: >> >>> Currently you need Mono SVN (both to run and to compile). Using SVN >>> r120972 below. >>> >> >> Any idea what version of Mono that is? Does IP2 build with Mono 2.2? It >> would be great to put out a IPCE r8 for IP2. >> >> Also, what would be the matching versions of IronRuby that would work with >> IP on Mono? I see that DevHawk has a DLR nightly build that comes with >> Ruby >> and Python: >> >> http://nightlybuilds.cloudapp.net/rss.ashx?project=dlr >> >> but the early builds seem to be empty (I've sent Harry a note about that). >> The latest versions of those builds don't quite work with Mono 2.0, but >> perhaps Mono 2.2? >> > > Answering part of my own question: Mono 2.2 that comes with OpenSuse is not > capable of running the IP from the DLR nightly builds, versions 10209 and > later (earlier versions are unavailable there). > > So, I'm still in quest of a IP/IR combo that I can run on mono. I will try > building mono from SVN next... > > -Doug > > > Thanks for any assistance! >> >> -Doug >> >> >> Seo Sanghyeon-3 wrote: >> >>> The binary runs fine. >>> >>> IronPython includes its own copy of ExtensionAttribute, but this >>> doesn't seem to work with Mono C# compiler: that is, extension methods >>> don't get recognized as extension methods. This causes trouble where >>> MetaObject is defined in Microsoft.Scripting.Core.dll, and its >>> extensions are defined in MetaObjectExtensions in >>> Microsoft.Scripting.dll. My hack below copies MetaObjectExtensions and >>> its dependencies to Microsoft.Scripting.Core and patch it to be a >>> partial class instead of a static class housing extension methods. Any >>> better idea? >>> >>> Also there are some unused files in the source distribution. >>> >>> Below are steps I used to compile the source on Mono. >>> >>> Download source from >>> >>> http://www.codeplex.com/IronPython/Release/ProjectReleases.aspx?ReleaseId=19841 >>> $ unzip IronPython-2.0-Src.zip >>> $ cd IronPython-2.0 >>> >>> Some hacks... >>> $ svn co -r 597 >>> https://fepy.svn.sourceforge.net/svnroot/fepy/trunk/patches/latest >>> build >>> >>> This deletes unused files and does copying mentioned above >>> $ sh build/pre.sh >>> >>> Copies NAnt build file: it uses noconfig to avoid pulling System.Core.dll >>> $ cp build/IronPython.build Src >>> >>> Patches >>> $ patch -p1 < build/patch-exthack >>> $ patch -p1 < build/patch-console >>> >>> Build >>> $ cd Src >>> $ nant >>> >>> -- >>> Seo Sanghyeon >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >>> >> > > -- > Douglas S. Blank > Director, Institute for Personal Robots in Education (IPRE) > http://www.roboteducation.org > Chair, and Associate Professor, Computer Science, Bryn Mawr College > http://cs.brynmawr.edu/~dblank (610)526-6501 > > _______________________________________________ > 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 vernondcole at gmail.com Wed Mar 4 16:19:39 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Wed, 4 Mar 2009 08:19:39 -0700 Subject: [IronPython] Array of Objects in IronPython In-Reply-To: <8cd017b80903030807q1a5db22m8ffed72080e58d90@mail.gmail.com> References: <49AD54E7.3010000@ascom-ac.de> <8cd017b80903030807q1a5db22m8ffed72080e58d90@mail.gmail.com> Message-ID: or you can use a python standard dbapi to get to your SQL data. http://adodbapi.sourceforge.net On Tue, Mar 3, 2009 at 9:07 AM, Dody Gunawinata wrote: > values = System.Array.CreateInstance(System.Object, reader.FieldCount) > > > On Tue, Mar 3, 2009 at 6:03 PM, Bernd Viehmann > wrote: >> Hi, >> >> I have a question regarding a typed array. >> >> Basically I want to use IronPython and ADO.NET to get some data from a >> stored procedure. My first idea was to use a SQL DataReader to get all the >> lines of my result table into an array. Csharp way looks like this: >> >> *ArrayList rowList = new ArrayList();* >> SqlDataReader reader = storedProcCommand.ExecuteReader(); >> while (reader.Read()) >> { >> *object[] values = new object[reader.FieldCount];* >> *reader.GetValues(values);* >> *rowList.Add(values);* >> } >> >> My problem is to generate an array of type object to feed >> *reader.GetValues(values) with it. Any ideas how this can be done? >> >> Kind regards from Germany >> >> Bernd >> >> * >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > > > > -- > nomadlife.org > _______________________________________________ > 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 kamil at dworakowski.name Fri Mar 6 12:05:07 2009 From: kamil at dworakowski.name (Kamil Dworakowski) Date: Fri, 6 Mar 2009 03:05:07 -0800 (PST) Subject: [IronPython] dir returning protected members Message-ID: <9b6650af-3bfc-419a-b739-59a639d06267@j8g2000yql.googlegroups.com> For my purpose this is bad that dir returns protected members, but I don't know if it is a bug. Is it a bug? From fuzzyman at voidspace.org.uk Fri Mar 6 15:40:44 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Fri, 06 Mar 2009 14:40:44 +0000 Subject: [IronPython] Patching __import__ can break .NET attribute access Message-ID: <49B135EC.2090402@voidspace.org.uk> Hello all, If you patch __builtin__.__import__, even with something that delegates to the real __import__, then accessing .NET attributes can break. Attached are two Python files, place them in the same directory and run: ipy first.py and get this error: Traceback (most recent call last): File "first.py", line 12, in first.py File "C:\buildshare\test.py", line 6, in function AttributeError: 'int' object has no attribute 'MaxValue' All it does is patch __import__ so that all imports are printed. This is with Python 2.0.1. All the best, Michael -- http://www.ironpythoninaction.com/ -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: first.py URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: test.py URL: From fuzzyman at voidspace.org.uk Fri Mar 6 18:21:51 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Fri, 06 Mar 2009 17:21:51 +0000 Subject: [IronPython] [python-uk] EuroPython in England. DON'T MISS OUT Message-ID: <49B15BAF.10704@voidspace.org.uk> Hello, Just a reminder that Extra Early Bird rate runs out next Tuesday. See http://www.europython.eu EuroPython runs from 30th June to 3rd July in Birmingham, with Tutorials and Sprints before/after. Jim Hugunin is giving one of the keynotes and Jonathan Hartley and I will be giving an IronPython tutorial. Act now! All the best, Michael Foord From maps at darrellhawley.com Sat Mar 7 17:10:40 2009 From: maps at darrellhawley.com (Darrell Hawley) Date: Sat, 7 Mar 2009 11:10:40 -0500 Subject: [IronPython] Exceptions Running nose and IronPython Message-ID: I was talking to some of the Dynamic folks at the Microsoft MVP Summit about my experience using nose in IronPython. I blogged about it and sent a link to both Harry P. and Michael Foord, but I left everyone else out. You can find my original post at http://srtsolutions.com/blogs/darrellhawley/archive/2009/03/06/running-nose-with-ironpython.aspx . Just so you don't have to go clicking on links, here's my script: import sys sys.path.append(r"C:\Python25\Lib\site-packages\nose-0.10.4-py2.5.egg") sys.path.append(r"C:\python25\lib") sys.path.append(r"C:\Python25\Lib\email") sys.path.append(r"C:\Python25\Scripts") import nose nose.main() Performance is awful probably due to the number of GeneratorExitExceptions being thrown. If anyone has any ideas, I'd love to hear them. Darrell Hawley SRT Solutions www.srtsolutions.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Sat Mar 7 20:44:51 2009 From: dinov at microsoft.com (Dino Viehland) Date: Sat, 7 Mar 2009 11:44:51 -0800 Subject: [IronPython] Exceptions Running nose and IronPython In-Reply-To: References: Message-ID: <350E7D38B6D819428718949920EC2355571C033D05@NA-EXMSG-C102.redmond.corp.microsoft.com> I can't run it right now but if these are happening on the finalizer thread then this has most likely been fixed in the 2.6 branch already. The issue is that when a generator is not run to exhaustion we need to call close() on it which causes an exception to be thrown. But we can avoid the exception if the generator has no except/finally blocks as no user code will run when the throw occurs. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Darrell Hawley Sent: Saturday, March 07, 2009 8:11 AM To: IronPython Mailing List Subject: [IronPython] Exceptions Running nose and IronPython I was talking to some of the Dynamic folks at the Microsoft MVP Summit about my experience using nose in IronPython. I blogged about it and sent a link to both Harry P. and Michael Foord, but I left everyone else out. You can find my original post at http://srtsolutions.com/blogs/darrellhawley/archive/2009/03/06/running-nose-with-ironpython.aspx. Just so you don't have to go clicking on links, here's my script: import sys sys.path.append(r"C:\Python25\Lib\site-packages\nose-0.10.4-py2.5.egg") sys.path.append(r"C:\python25\lib") sys.path.append(r"C:\Python25\Lib\email") sys.path.append(r"C:\Python25\Scripts") import nose nose.main() Performance is awful probably due to the number of GeneratorExitExceptions being thrown. If anyone has any ideas, I'd love to hear them. Darrell Hawley SRT Solutions www.srtsolutions.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Sat Mar 7 20:47:40 2009 From: dinov at microsoft.com (Dino Viehland) Date: Sat, 7 Mar 2009 11:47:40 -0800 Subject: [IronPython] Patching __import__ can break .NET attribute access In-Reply-To: <49B135EC.2090402@voidspace.org.uk> References: <49B135EC.2090402@voidspace.org.uk> Message-ID: <350E7D38B6D819428718949920EC2355571C033D06@NA-EXMSG-C102.redmond.corp.microsoft.com> This one is technically by design. The python code which calls __import__/does import is the one that gets tainted with the ability to see clr attributes. We have discussed changing the design so that "import clr" is recognized at compile time and works like from __future__ ... instead of being a runtime feature. If we were to make that change it'd also mean "import System" wouldn't bring in .NET attributes either. But that'd probably be something for IronPython 3k as it's a fairly significant breaking change. It'd be interesting to hear if people would like one way over the other. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Friday, March 06, 2009 6:41 AM > To: Discussion of IronPython > Subject: [IronPython] Patching __import__ can break .NET attribute > access > > Hello all, > If you patch __builtin__.__import__, even with something that delegates > to the real __import__, then accessing .NET attributes can break. > > Attached are two Python files, place them in the same directory and > run: > > ipy first.py > > and get this error: > > Traceback (most recent call last): > File "first.py", line 12, in first.py > File "C:\buildshare\test.py", line 6, in function > AttributeError: 'int' object has no attribute 'MaxValue' > > All it does is patch __import__ so that all imports are printed. > > This is with Python 2.0.1. > > All the best, > > Michael > -- > http://www.ironpythoninaction.com/ > From dinov at microsoft.com Sat Mar 7 20:49:21 2009 From: dinov at microsoft.com (Dino Viehland) Date: Sat, 7 Mar 2009 11:49:21 -0800 Subject: [IronPython] dir returning protected members In-Reply-To: <9b6650af-3bfc-419a-b739-59a639d06267@j8g2000yql.googlegroups.com> References: <9b6650af-3bfc-419a-b739-59a639d06267@j8g2000yql.googlegroups.com> Message-ID: <350E7D38B6D819428718949920EC2355571C033D07@NA-EXMSG-C102.redmond.corp.microsoft.com> This is the correct behavior. We expose protected members as normal members that throw when the instance isn't a subclass defined in Python. But they need to exist on the base class so that you can do things like super calls to them. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Kamil Dworakowski > Sent: Friday, March 06, 2009 3:05 AM > To: users at lists.ironpython.com > Subject: [IronPython] dir returning protected members > > For my purpose this is bad that dir returns protected members, but I > don't know if it is a bug. Is it a bug? > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Sat Mar 7 20:50:58 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sat, 07 Mar 2009 19:50:58 +0000 Subject: [IronPython] Patching __import__ can break .NET attribute access In-Reply-To: <350E7D38B6D819428718949920EC2355571C033D06@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <49B135EC.2090402@voidspace.org.uk> <350E7D38B6D819428718949920EC2355571C033D06@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <49B2D022.7090701@voidspace.org.uk> Dino Viehland wrote: > This one is technically by design. The python code which calls __import__/does import is the one that gets tainted with the ability to see clr attributes. We have discussed changing the design so that "import clr" is recognized at compile time and works like from __future__ ... instead of being a runtime feature. If we were to make that change it'd also mean "import System" wouldn't bring in .NET attributes either. But that'd probably be something for IronPython 3k as it's a fairly significant breaking change. It'd be interesting to hear if people would like one way over the other. > > The difficulty is that adding an (apparently innocuous) import hook in your code can break third party code (in the form of compiled IronPython modules) which you may not have the source code to. Michael >> -----Original Message----- >> From: users-bounces at lists.ironpython.com [mailto:users- >> bounces at lists.ironpython.com] On Behalf Of Michael Foord >> Sent: Friday, March 06, 2009 6:41 AM >> To: Discussion of IronPython >> Subject: [IronPython] Patching __import__ can break .NET attribute >> access >> >> Hello all, >> If you patch __builtin__.__import__, even with something that delegates >> to the real __import__, then accessing .NET attributes can break. >> >> Attached are two Python files, place them in the same directory and >> run: >> >> ipy first.py >> >> and get this error: >> >> Traceback (most recent call last): >> File "first.py", line 12, in first.py >> File "C:\buildshare\test.py", line 6, in function >> AttributeError: 'int' object has no attribute 'MaxValue' >> >> All it does is patch __import__ so that all imports are printed. >> >> This is with Python 2.0.1. >> >> All the best, >> >> Michael >> -- >> http://www.ironpythoninaction.com/ >> >> > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From dinov at microsoft.com Sat Mar 7 20:55:50 2009 From: dinov at microsoft.com (Dino Viehland) Date: Sat, 7 Mar 2009 11:55:50 -0800 Subject: [IronPython] Patching __import__ can break .NET attribute access In-Reply-To: <49B2D022.7090701@voidspace.org.uk> References: <49B135EC.2090402@voidspace.org.uk> <350E7D38B6D819428718949920EC2355571C033D06@NA-EXMSG-C102.redmond.corp.microsoft.com> <49B2D022.7090701@voidspace.org.uk> Message-ID: <350E7D38B6D819428718949920EC2355571C033D09@NA-EXMSG-C102.redmond.corp.microsoft.com> Yep, that's definitely a problem and definitely a good reason to make it a compile time hook instead. Another reason is that when the import code is written entirely in Python we'll have the same problem. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Saturday, March 07, 2009 11:51 AM > To: Discussion of IronPython > Subject: Re: [IronPython] Patching __import__ can break .NET attribute > access > > Dino Viehland wrote: > > This one is technically by design. The python code which calls > __import__/does import is the one that gets tainted with the ability to > see clr attributes. We have discussed changing the design so that > "import clr" is recognized at compile time and works like from > __future__ ... instead of being a runtime feature. If we were to make > that change it'd also mean "import System" wouldn't bring in .NET > attributes either. But that'd probably be something for IronPython 3k > as it's a fairly significant breaking change. It'd be interesting to > hear if people would like one way over the other. > > > > > > The difficulty is that adding an (apparently innocuous) import hook in > your code can break third party code (in the form of compiled > IronPython > modules) which you may not have the source code to. > > Michael > > >> -----Original Message----- > >> From: users-bounces at lists.ironpython.com [mailto:users- > >> bounces at lists.ironpython.com] On Behalf Of Michael Foord > >> Sent: Friday, March 06, 2009 6:41 AM > >> To: Discussion of IronPython > >> Subject: [IronPython] Patching __import__ can break .NET attribute > >> access > >> > >> Hello all, > >> If you patch __builtin__.__import__, even with something that > delegates > >> to the real __import__, then accessing .NET attributes can break. > >> > >> Attached are two Python files, place them in the same directory and > >> run: > >> > >> ipy first.py > >> > >> and get this error: > >> > >> Traceback (most recent call last): > >> File "first.py", line 12, in first.py > >> File "C:\buildshare\test.py", line 6, in function > >> AttributeError: 'int' object has no attribute 'MaxValue' > >> > >> All it does is patch __import__ so that all imports are printed. > >> > >> This is with Python 2.0.1. > >> > >> All the best, > >> > >> Michael > >> -- > >> http://www.ironpythoninaction.com/ > >> > >> > > > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From kamil at dworakowski.name Sat Mar 7 21:35:21 2009 From: kamil at dworakowski.name (Kamil Dworakowski) Date: Sat, 7 Mar 2009 12:35:21 -0800 (PST) Subject: [IronPython] dir returning protected members In-Reply-To: <350E7D38B6D819428718949920EC2355571C033D07@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <9b6650af-3bfc-419a-b739-59a639d06267@j8g2000yql.googlegroups.com> <350E7D38B6D819428718949920EC2355571C033D07@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: Is there a way to check if it is a protected member or not? On Mar 7, 7:49?pm, Dino Viehland wrote: > This is the correct behavior. ?We expose protected members as normal members that throw when the instance isn't a subclass defined in Python. ?But they need to exist on the base class so that you can do things like super calls to them. > > > -----Original Message----- > > From: users-boun... at lists.ironpython.com [mailto:users- > > boun... at lists.ironpython.com] On Behalf Of Kamil Dworakowski > > Sent: Friday, March 06, 2009 3:05 AM > > To: us... at lists.ironpython.com > > Subject: [IronPython] dir returning protected members > > > For my purpose this is bad that dir returns protected members, but I > > don't know if it is a bug. Is it a bug? > > _______________________________________________ > > Users mailing list > > Us... at lists.ironpython.com > >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > Users mailing list > Us... at lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at microsoft.com Sat Mar 7 21:47:49 2009 From: dinov at microsoft.com (Dino Viehland) Date: Sat, 7 Mar 2009 12:47:49 -0800 Subject: [IronPython] dir returning protected members In-Reply-To: References: <9b6650af-3bfc-419a-b739-59a639d06267@j8g2000yql.googlegroups.com> <350E7D38B6D819428718949920EC2355571C033D07@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <350E7D38B6D819428718949920EC2355571C033D0D@NA-EXMSG-C102.redmond.corp.microsoft.com> In the 2.6 branch there is. After importing clr there's an Overloads property on built-in functions (that's been there for a while). In 2.6 off of the overloads object there is a Targets property which includes all of the CLR MethodBase objects. You can check the IsFamily, IsFamilyOrAssembly, or IsFamilyAndAssembly properties. IsFamily is protected, IsFamilyOrAssembly is C#'s protected internal - basically protected to you, IsFamilyAndAssembly is basically an internal method to you (I'm not sure what languages expose this, C# doesn't). > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Kamil Dworakowski > Sent: Saturday, March 07, 2009 12:35 PM > To: users at lists.ironpython.com > Subject: Re: [IronPython] dir returning protected members > > Is there a way to check if it is a protected member or not? > > On Mar 7, 7:49?pm, Dino Viehland wrote: > > This is the correct behavior. ?We expose protected members as normal > members that throw when the instance isn't a subclass defined in > Python. ?But they need to exist on the base class so that you can do > things like super calls to them. > > > > > -----Original Message----- > > > From: users-boun... at lists.ironpython.com [mailto:users- > > > boun... at lists.ironpython.com] On Behalf Of Kamil Dworakowski > > > Sent: Friday, March 06, 2009 3:05 AM > > > To: us... at lists.ironpython.com > > > Subject: [IronPython] dir returning protected members > > > > > For my purpose this is bad that dir returns protected members, but > I > > > don't know if it is a bug. Is it a bug? > > > _______________________________________________ > > > Users mailing list > > > Us... at lists.ironpython.com > > >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > > Users mailing list > > > Us... at lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/user > s-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Mon Mar 9 00:39:49 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sun, 08 Mar 2009 23:39:49 +0000 Subject: [IronPython] IronPython to JavaScript In-Reply-To: <5283CA0A4168DF4FBBD71AE9ECA5A3284BEB61C756@NA-EXMSG-C116.redmond.corp.microsoft.com> References: <21413681.post@talk.nabble.com> <496BB5D5.30800@voidspace.org.uk> <1dab55500901130059k6c7f42b0t99c4d799e205bf06@mail.gmail.com> <496D1D5D.8020602@voidspace.org.uk> <1dab55500901140415u39298362n231f6245aef3132d@mail.gmail.com> <5283CA0A4168DF4FBBD71AE9ECA5A3284BDF1B5005@NA-EXMSG-C116.redmond.corp.microsoft.com> <1dab55500901141404n78edc71bn5bce5c7b46453568@mail.gmail.com> <5283CA0A4168DF4FBBD71AE9ECA5A3284BDF1B5157@NA-EXMSG-C116.redmond.corp.microsoft.com> <5283CA0A4168DF4FBBD71AE9ECA5A3284BEB61C756@NA-EXMSG-C116.redmond.corp.microsoft.com> Message-ID: <49B45745.6010801@voidspace.org.uk> Jimmy Schementi wrote: > Kristian wrote: > >> Just curios... Has anyone had time to look at my sample yet? >> > > Yes, and sorry for the horrifically late reply ... > > http://jimmy.schementi.com/silverlight/scriptable > > source is here: > http://jimmy.schementi.com/silverlight/scriptable.zip > > There was a few small changes I made to Michael's code: > > 1. The Python code used to load the C# assembly will fail, since there's no namespace defined as Scriptable. It should be change to: > > clr.AddReferenceToFile("Scriptable.dll") > import ScriptableForString > In the actual source for download the namespace was defined. It was omitted for brevity in the article. I'm adding it to avoid confusion in the future. > ... and "Scriptable.dll" doesn't need to be added to the AppManifest.xaml, just needs to be present in the XAP. I use clr.AddReferenceToFile because clr.AddReference or clr.AddReferenceByName can fail depending on whether or not Microsoft.Scripting.Silverlight.dll is signed (which can differ if you get the bits from codeplex or build them yourself from github), because you didn't give the fully-qualified assembly name. > Interesting. AddReference can fail if you put the dll in the xap file - that sounds like a big scary gotcha. > 2. The SomeClass class needs to take new_string as a parameter, instead of "string" > The _method returns new_string to indicate that it returns a new string (and probably not the one you pass in). This is what the ellipsis in the code body is for - to indicate the missing implementation. > 3. There are both "some_class" and "someClass" variables, but there are intended to mean the same thing. So I changed them all to "someClass". > > 4. Calling event.OnEvent(args) in top-level Python code can run before JavaScript has a chance to hook the event, so either an error will happen, or nothing. It's strange because it executes onload of the Silverlight control, but sounds like that happens before the start script has a chance to finish. In my demo I trigger the event from a link. > So onload isn't reliable - great. > 5. http://jimmy.schementi.com/silverlight/scriptable/csharp/scriptable.cs MSDN documentation said that events need to be marked with ScriptableMemberAttribute, rather than ScriptableMember. I don't think I makes a difference ... > This applies to *all* of the references. I don't think ScriptableType and ScriptableMember exist any more - thanks. In the process of making these updates. Michael > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From Jimmy.Schementi at microsoft.com Mon Mar 9 10:21:37 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Mon, 9 Mar 2009 02:21:37 -0700 Subject: [IronPython] IronPython to JavaScript In-Reply-To: <49B45745.6010801@voidspace.org.uk> References: <21413681.post@talk.nabble.com> <496BB5D5.30800@voidspace.org.uk> <1dab55500901130059k6c7f42b0t99c4d799e205bf06@mail.gmail.com> <496D1D5D.8020602@voidspace.org.uk> <1dab55500901140415u39298362n231f6245aef3132d@mail.gmail.com> <5283CA0A4168DF4FBBD71AE9ECA5A3284BDF1B5005@NA-EXMSG-C116.redmond.corp.microsoft.com> <1dab55500901141404n78edc71bn5bce5c7b46453568@mail.gmail.com> <5283CA0A4168DF4FBBD71AE9ECA5A3284BDF1B5157@NA-EXMSG-C116.redmond.corp.microsoft.com> <5283CA0A4168DF4FBBD71AE9ECA5A3284BEB61C756@NA-EXMSG-C116.redmond.corp.microsoft.com>, <49B45745.6010801@voidspace.org.uk> Message-ID: <5283CA0A4168DF4FBBD71AE9ECA5A3284BEB399E5F@NA-EXMSG-C116.redmond.corp.microsoft.com> The AddReference issue sounds bad ... I have to figure out exactly what's happening there. And the onload thing is also really messed up; I'll ask around to find out what it actually does. ________________________________________ From: users-bounces at lists.ironpython.com [users-bounces at lists.ironpython.com] On Behalf Of Michael Foord [fuzzyman at voidspace.org.uk] Sent: Sunday, March 08, 2009 4:39 PM To: Discussion of IronPython Subject: Re: [IronPython] IronPython to JavaScript Jimmy Schementi wrote: > Kristian wrote: > >> Just curios... Has anyone had time to look at my sample yet? >> > > Yes, and sorry for the horrifically late reply ... > > http://jimmy.schementi.com/silverlight/scriptable > > source is here: > http://jimmy.schementi.com/silverlight/scriptable.zip > > There was a few small changes I made to Michael's code: > > 1. The Python code used to load the C# assembly will fail, since there's no namespace defined as Scriptable. It should be change to: > > clr.AddReferenceToFile("Scriptable.dll") > import ScriptableForString > In the actual source for download the namespace was defined. It was omitted for brevity in the article. I'm adding it to avoid confusion in the future. > ... and "Scriptable.dll" doesn't need to be added to the AppManifest.xaml, just needs to be present in the XAP. I use clr.AddReferenceToFile because clr.AddReference or clr.AddReferenceByName can fail depending on whether or not Microsoft.Scripting.Silverlight.dll is signed (which can differ if you get the bits from codeplex or build them yourself from github), because you didn't give the fully-qualified assembly name. > Interesting. AddReference can fail if you put the dll in the xap file - that sounds like a big scary gotcha. > 2. The SomeClass class needs to take new_string as a parameter, instead of "string" > The _method returns new_string to indicate that it returns a new string (and probably not the one you pass in). This is what the ellipsis in the code body is for - to indicate the missing implementation. > 3. There are both "some_class" and "someClass" variables, but there are intended to mean the same thing. So I changed them all to "someClass". > > 4. Calling event.OnEvent(args) in top-level Python code can run before JavaScript has a chance to hook the event, so either an error will happen, or nothing. It's strange because it executes onload of the Silverlight control, but sounds like that happens before the start script has a chance to finish. In my demo I trigger the event from a link. > So onload isn't reliable - great. > 5. http://jimmy.schementi.com/silverlight/scriptable/csharp/scriptable.cs MSDN documentation said that events need to be marked with ScriptableMemberAttribute, rather than ScriptableMember. I don't think I makes a difference ... > This applies to *all* of the references. I don't think ScriptableType and ScriptableMember exist any more - thanks. In the process of making these updates. Michael > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Mon Mar 9 14:19:02 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 09 Mar 2009 13:19:02 +0000 Subject: [IronPython] __slots__ Message-ID: <49B51746.3070102@voidspace.org.uk> Hello guys, It looks like __slots__ and inheritance are a bit odd in IronPython (2.0.1). slots.py: class A(object): __slots__ = [] class B(A): __slots__ = [] i = B() i.test = 3 Running with IronPython and CPython: C:\compile\resolver-michael>"C:\Program Files (x86)\IronPython 2.0.1\ipy.exe" -D -X:TabCompletion -X:ColorfulConsole slots.py C:\compile\resolver-michael>python slots.py Traceback (most recent call last): File "slots.py", line 8, in ? i.test = 3 AttributeError: 'B' object has no attribute 'test' C:\compile\resolver-michael> Michael -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From curt at hagenlocher.org Mon Mar 9 14:27:22 2009 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 9 Mar 2009 05:27:22 -0800 Subject: [IronPython] __slots__ In-Reply-To: <49B51746.3070102@voidspace.org.uk> References: <49B51746.3070102@voidspace.org.uk> Message-ID: I believe this is already fixed in the current (ie 2.6ish) source. On Mon, Mar 9, 2009 at 5:19 AM, Michael Foord wrote: > Hello guys, > > It looks like __slots__ and inheritance are a bit odd in IronPython > (2.0.1). slots.py: > > class A(object): > __slots__ = [] > class B(A): > __slots__ = [] > i = B() > i.test = 3 > > > Running with IronPython and CPython: > > C:\compile\resolver-michael>"C:\Program Files (x86)\IronPython > 2.0.1\ipy.exe" -D > -X:TabCompletion -X:ColorfulConsole slots.py > > C:\compile\resolver-michael>python slots.py > Traceback (most recent call last): > File "slots.py", line 8, in ? > i.test = 3 > AttributeError: 'B' object has no attribute 'test' > > C:\compile\resolver-michael> > > Michael > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > > _______________________________________________ > 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 fuzzyman at voidspace.org.uk Mon Mar 9 14:28:38 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 09 Mar 2009 13:28:38 +0000 Subject: [IronPython] __slots__ In-Reply-To: References: <49B51746.3070102@voidspace.org.uk> Message-ID: <49B51986.2010008@voidspace.org.uk> Curt Hagenlocher wrote: > I believe this is already fixed in the current (ie 2.6ish) source. Any chance for 2.0.2? Michael > > On Mon, Mar 9, 2009 at 5:19 AM, Michael Foord > > wrote: > > Hello guys, > > It looks like __slots__ and inheritance are a bit odd in > IronPython (2.0.1). slots.py: > > class A(object): > __slots__ = [] > class B(A): > __slots__ = [] > i = B() > i.test = 3 > > > Running with IronPython and CPython: > > C:\compile\resolver-michael>"C:\Program Files (x86)\IronPython > 2.0.1\ipy.exe" -D > -X:TabCompletion -X:ColorfulConsole slots.py > > C:\compile\resolver-michael>python slots.py > Traceback (most recent call last): > File "slots.py", line 8, in ? > i.test = 3 > AttributeError: 'B' object has no attribute 'test' > > C:\compile\resolver-michael> > > Michael > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > > _______________________________________________ > 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 > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From curt at hagenlocher.org Mon Mar 9 14:34:08 2009 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 9 Mar 2009 05:34:08 -0800 Subject: [IronPython] __slots__ In-Reply-To: <49B51986.2010008@voidspace.org.uk> References: <49B51746.3070102@voidspace.org.uk> <49B51986.2010008@voidspace.org.uk> Message-ID: On Mon, Mar 9, 2009 at 5:28 AM, Michael Foord wrote: > > Curt Hagenlocher wrote: >> >> I believe this is already fixed in the current (ie 2.6ish) source. > > Any chance for 2.0.2? That's Dino's call. The fix in 2.6 is actually a massive restructuring of some code, so the backport would likely have to be done from scratch against the 2.0 branch. Fun fact: it wasn't fixed intentionally, and I only discovered the problem in 2.0 by noticing that some (buggy) code was now broken with 2.6... :) -- Curt Hagenlocher curt at hagenlocher.org From fuzzyman at voidspace.org.uk Mon Mar 9 14:35:37 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 09 Mar 2009 13:35:37 +0000 Subject: [IronPython] __slots__ In-Reply-To: References: <49B51746.3070102@voidspace.org.uk> <49B51986.2010008@voidspace.org.uk> Message-ID: <49B51B29.600@voidspace.org.uk> Curt Hagenlocher wrote: > On Mon, Mar 9, 2009 at 5:28 AM, Michael Foord wrote: > >> Curt Hagenlocher wrote: >> >>> I believe this is already fixed in the current (ie 2.6ish) source. >>> >> Any chance for 2.0.2? >> > > That's Dino's call. The fix in 2.6 is actually a massive > restructuring of some code, so the backport would likely have to be > done from scratch against the 2.0 branch. > > Fun fact: it wasn't fixed intentionally, and I only discovered the > problem in 2.0 by noticing that some (buggy) code was now broken with > 2.6... :) > :-) We're trying to see if we can get a performance benefit from using __slots__ and the odd behaviour of 2.0.1. is, well, odd. Michael > -- > Curt Hagenlocher > curt at hagenlocher.org > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From dinov at microsoft.com Mon Mar 9 18:57:23 2009 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 9 Mar 2009 10:57:23 -0700 Subject: [IronPython] __slots__ In-Reply-To: <49B51B29.600@voidspace.org.uk> References: <49B51746.3070102@voidspace.org.uk> <49B51986.2010008@voidspace.org.uk> <49B51B29.600@voidspace.org.uk> Message-ID: <350E7D38B6D819428718949920EC2355571C136CEF@NA-EXMSG-C102.redmond.corp.microsoft.com> The fact that we allow setting to the dictionary when we shouldn't be much to worry about - it is just odd. In either case we still have a .NET type defined something like: class NewType : YourBaseTypeHere { public PythonDictionary __dict__; public object[] __slots__; ... } And it's just in one case we don't allow anything in __dict__ and in another case we do (the types do look a little different between v2 and v2.6 but not enough to matter). I could see us backporting just the fix for calculating whether or not slots is allowed but not the restructuring of the new-type maker code. But I think the justification for that isn't the oddness here but cases where in 2.0.1 slots are valid but we don't allow them (which I'm fairly sure exist as well). > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Monday, March 09, 2009 6:36 AM > To: Discussion of IronPython > Subject: Re: [IronPython] __slots__ > > Curt Hagenlocher wrote: > > On Mon, Mar 9, 2009 at 5:28 AM, Michael Foord > wrote: > > > >> Curt Hagenlocher wrote: > >> > >>> I believe this is already fixed in the current (ie 2.6ish) source. > >>> > >> Any chance for 2.0.2? > >> > > > > That's Dino's call. The fix in 2.6 is actually a massive > > restructuring of some code, so the backport would likely have to be > > done from scratch against the 2.0 branch. > > > > Fun fact: it wasn't fixed intentionally, and I only discovered the > > problem in 2.0 by noticing that some (buggy) code was now broken with > > 2.6... :) > > > > :-) > > We're trying to see if we can get a performance benefit from using > __slots__ and the odd behaviour of 2.0.1. is, well, odd. > > Michael > > -- > > Curt Hagenlocher > > curt at hagenlocher.org > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Mon Mar 9 19:05:29 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 09 Mar 2009 18:05:29 +0000 Subject: [IronPython] __slots__ In-Reply-To: <350E7D38B6D819428718949920EC2355571C136CEF@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <49B51746.3070102@voidspace.org.uk> <49B51986.2010008@voidspace.org.uk> <49B51B29.600@voidspace.org.uk> <350E7D38B6D819428718949920EC2355571C136CEF@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <49B55A69.4000907@voidspace.org.uk> Dino Viehland wrote: > The fact that we allow setting to the dictionary when we shouldn't be much to worry about - it is just odd. In either case we still have a .NET type defined something like: > > class NewType : YourBaseTypeHere { > public PythonDictionary __dict__; > public object[] __slots__; > ... > } > > And it's just in one case we don't allow anything in __dict__ and in another case we do (the types do look a little different between v2 and v2.6 but not enough to matter). > > I could see us backporting just the fix for calculating whether or not slots is allowed but not the restructuring of the new-type maker code. But I think the justification for that isn't the oddness here but cases where in 2.0.1 slots are valid but we don't allow them (which I'm fairly sure exist as well). > > I'm also seeing another oddity with __slots__ - even if __doc__ is in the __slots__ list you can't set __doc__ on an instance. It would be nice to have this in 2.0.2 because as well as the performance gains we would prefer users be warned with an AttributeError if they set non-existent attributes on our spreadsheet object model classes. Michael >> -----Original Message----- >> From: users-bounces at lists.ironpython.com [mailto:users- >> bounces at lists.ironpython.com] On Behalf Of Michael Foord >> Sent: Monday, March 09, 2009 6:36 AM >> To: Discussion of IronPython >> Subject: Re: [IronPython] __slots__ >> >> Curt Hagenlocher wrote: >> >>> On Mon, Mar 9, 2009 at 5:28 AM, Michael Foord >>> >> wrote: >> >>>> Curt Hagenlocher wrote: >>>> >>>> >>>>> I believe this is already fixed in the current (ie 2.6ish) source. >>>>> >>>>> >>>> Any chance for 2.0.2? >>>> >>>> >>> That's Dino's call. The fix in 2.6 is actually a massive >>> restructuring of some code, so the backport would likely have to be >>> done from scratch against the 2.0 branch. >>> >>> Fun fact: it wasn't fixed intentionally, and I only discovered the >>> problem in 2.0 by noticing that some (buggy) code was now broken with >>> 2.6... :) >>> >>> >> :-) >> >> We're trying to see if we can get a performance benefit from using >> __slots__ and the odd behaviour of 2.0.1. is, well, odd. >> >> Michael >> >>> -- >>> Curt Hagenlocher >>> curt at hagenlocher.org >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >> -- >> http://www.ironpythoninaction.com/ >> http://www.voidspace.org.uk/blog >> >> >> _______________________________________________ >> 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 > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From Kyle.Howland-Rose at aar.com.au Mon Mar 9 22:40:20 2009 From: Kyle.Howland-Rose at aar.com.au (Howland-Rose, Kyle) Date: Tue, 10 Mar 2009 08:40:20 +1100 Subject: [IronPython] IPy2.0 and VS 2008 Message-ID: Hi all, I have been using IPy from the command line but want others at work to use it too and they pretty much use Visual Studio all the time. Mainly we work in Visual Studio 2008 but there is not much information about IPy 2.0 and Visual Studio that I could find. What are people's experiences with IPy 2.0 under VS 2008? I assume there is interactive debugging and intellisense - did these work well? Is there good information somewhere about what to install and how to get IPy 2.0 going under VS 2008? Thanks for any help :) Kyle ************************************************************************ Allens Arthur Robinson online: http://www.aar.com.au This email is confidential and may be subject to legal or other professional privilege. It is also subject to copyright. If you have received it in error, confidentiality and privilege are not waived and you must not disclose or use the information in it. Please notify the sender by return email and delete it from your system. Any personal information in this email must be handled in accordance with the Privacy Act 1988 (Cth). ************************************************************************* -------------- next part -------------- An HTML attachment was scrubbed... URL: From Kyle.Howland-Rose at aar.com.au Tue Mar 10 04:27:55 2009 From: Kyle.Howland-Rose at aar.com.au (Howland-Rose, Kyle) Date: Tue, 10 Mar 2009 14:27:55 +1100 Subject: [IronPython] 2.0 deployment Message-ID: Hi all, My understanding of http://www.ironpython.info/index.php/Deployment is that when deploying to Windows the following need to be deployed: * .NET 2.0 or 3.0 installed * ipy.exe * IronPython.dll * IronMath.dll I thought the IPy 2.0 equiv might be to copy: * ipy.exe * IronPython.dll * IronPython.Modules.dll * Microsoft.Scripting.Core.dll * Microsoft.Scripting.dll * Microsoft.Scripting.ExtensionAttribute.dll but if I then run test.py which imports types I get C:\test>ipy.exe test.py Traceback (most recent call last): File "test.py", line 1, in test.py ImportError: No module named types C:\test> Questions: 1. Do I need to deploy all of Lib? 2. Where should I have been reading about this (sorry). Thanks all. Regards, Kyle ************************************************************************ Allens Arthur Robinson online: http://www.aar.com.au This email is confidential and may be subject to legal or other professional privilege. It is also subject to copyright. If you have received it in error, confidentiality and privilege are not waived and you must not disclose or use the information in it. Please notify the sender by return email and delete it from your system. Any personal information in this email must be handled in accordance with the Privacy Act 1988 (Cth). ************************************************************************* -------------- next part -------------- An HTML attachment was scrubbed... URL: From sjmachin at lexicon.net Tue Mar 10 05:10:14 2009 From: sjmachin at lexicon.net (John Machin) Date: Tue, 10 Mar 2009 15:10:14 +1100 Subject: [IronPython] unchanged version numbers (was Re: Announcing IronPython 2.0.1) In-Reply-To: <350E7D38B6D819428718949920EC2355571BBD9DEE@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <515335F32AA04440B3DE6FEA1993E9AD03F36484@srv-be-101.Symyx-IC.symyx.com> <350E7D38B6D819428718949920EC2355571BBD9DEE@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <49B5E826.1000805@lexicon.net> On 14/02/2009 9:39 AM, Dino Viehland wrote: > It?s an in-place upgrade so you don?t need to re-build hosts that were > built against the previous versions of IronPython ? they?ll just > continue to work. If we changed the .NET assembly version then you?d > either have to apply policy or rebuild. The assembly file version is > updated and that?s how you can distinguish the two builds. > > > > *From:* users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Marty Nelson > *Sent:* Friday, February 13, 2009 2:32 PM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] Announcing IronPython 2.0.1 > > > > Why is the assembly version the same as 2.0? But the output of sys.version and sys.version_info doesn't appear to change either ... why not? and what is there that does change that apps can access as easily as sys.version_info and put it out on a logfile so that support people know exactly what binary is being run? From empirebuilder at gmail.com Tue Mar 10 06:37:45 2009 From: empirebuilder at gmail.com (Dody Gunawinata) Date: Tue, 10 Mar 2009 07:37:45 +0200 Subject: [IronPython] 2.0 deployment In-Reply-To: References: Message-ID: <8cd017b80903092237j3a2d944cy90be28c13610a20f@mail.gmail.com> What kind of application are you trying to deploy? ASP.Net with IP support? Application with hosted IP? IP scripts? Dody G. On Tue, Mar 10, 2009 at 5:27 AM, Howland-Rose, Kyle wrote: > Hi all, > > My understanding of http://www.ironpython.info/index.php/Deployment?is that > when deploying to Windows the following need to be deployed: > * .NET 2.0 or 3.0 installed > * ipy.exe > * IronPython.dll > * IronMath.dll > > I thought the IPy 2.0 equiv might be to copy: > * ipy.exe > * IronPython.dll > * IronPython.Modules.dll > * Microsoft.Scripting.Core.dll > * Microsoft.Scripting.dll > * Microsoft.Scripting.ExtensionAttribute.dll > > but if I then run test.py which imports types I get > C:\test>ipy.exe test.py > Traceback (most recent call last): > ? File "test.py", line 1, in test.py > ImportError: No module named types > C:\test> > > Questions: > > 1. Do I need to?deploy all of Lib? > > 2. Where should I have been reading about this (sorry). > > Thanks all. > > Regards, > Kyle > > > > ************************************************************************ > > Allens Arthur Robinson online: http://www.aar.com.au > > This email is confidential and may be subject to legal or other professional > privilege. It is also subject to copyright. If you have received it in > error, confidentiality and privilege are not waived and you must not > disclose or use the information in it. Please notify the sender by return > email and delete it from your system. Any personal information in this email > must be handled in accordance with the Privacy Act 1988 (Cth). > > ************************************************************************* > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -- nomadlife.org From Kyle.Howland-Rose at aar.com.au Tue Mar 10 06:57:01 2009 From: Kyle.Howland-Rose at aar.com.au (Howland-Rose, Kyle) Date: Tue, 10 Mar 2009 16:57:01 +1100 Subject: [IronPython] 2.0 deployment In-Reply-To: <8cd017b80903092237j3a2d944cy90be28c13610a20f@mail.gmail.com> References: <8cd017b80903092237j3a2d944cy90be28c13610a20f@mail.gmail.com> Message-ID: Hi Dody, Fair question :) Just a script run from the Windows scheduler that reads a database and writes some files. Kyle -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dody Gunawinata Sent: Tuesday, 10 March 2009 4:38 PM To: Discussion of IronPython Subject: Re: [IronPython] 2.0 deployment What kind of application are you trying to deploy? ASP.Net with IP support? Application with hosted IP? IP scripts? Dody G. On Tue, Mar 10, 2009 at 5:27 AM, Howland-Rose, Kyle wrote: > Hi all, > > My understanding of http://www.ironpython.info/index.php/Deployment?is that > when deploying to Windows the following need to be deployed: > * .NET 2.0 or 3.0 installed > * ipy.exe > * IronPython.dll > * IronMath.dll > > I thought the IPy 2.0 equiv might be to copy: > * ipy.exe > * IronPython.dll > * IronPython.Modules.dll > * Microsoft.Scripting.Core.dll > * Microsoft.Scripting.dll > * Microsoft.Scripting.ExtensionAttribute.dll > > but if I then run test.py which imports types I get > C:\test>ipy.exe test.py > Traceback (most recent call last): > ? File "test.py", line 1, in test.py > ImportError: No module named types > C:\test> > > Questions: > > 1. Do I need to?deploy all of Lib? > > 2. Where should I have been reading about this (sorry). > > Thanks all. > > Regards, > Kyle > > > > ************************************************************************ > > Allens Arthur Robinson online: http://www.aar.com.au > > This email is confidential and may be subject to legal or other professional > privilege. It is also subject to copyright. If you have received it in > error, confidentiality and privilege are not waived and you must not > disclose or use the information in it. Please notify the sender by return > email and delete it from your system. Any personal information in this email > must be handled in accordance with the Privacy Act 1988 (Cth). > > ************************************************************************* > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -- nomadlife.org _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com ************************************************************************ Allens Arthur Robinson online: http://www.aar.com.au This email is confidential and may be subject to legal or other professional privilege. It is also subject to copyright. If you have received it in error, confidentiality and privilege are not waived and you must not disclose or use the information in it. Please notify the sender by return email and delete it from your system. Any personal information in this email must be handled in accordance with the Privacy Act 1988 (Cth). ************************************************************************* From kfarmer at thuban.org Tue Mar 10 07:16:38 2009 From: kfarmer at thuban.org (Keith J. Farmer) Date: Mon, 9 Mar 2009 23:16:38 -0700 Subject: [IronPython] DLR Source typo Message-ID: In case someone wants to catch it before it's too late: CallSiteBinder.Bind's comment: "hte" -> "the" J -------------- next part -------------- An HTML attachment was scrubbed... URL: From empirebuilder at gmail.com Tue Mar 10 07:29:26 2009 From: empirebuilder at gmail.com (Dody Gunawinata) Date: Tue, 10 Mar 2009 08:29:26 +0200 Subject: [IronPython] 2.0 deployment In-Reply-To: References: <8cd017b80903092237j3a2d944cy90be28c13610a20f@mail.gmail.com> Message-ID: <8cd017b80903092329x68940dd6t9abd6f0ca8acecc2@mail.gmail.com> 1. You will need to deploy all the lib * ipy.exe * IronPython.dll * IronPython.Modules.dll * Microsoft.Scripting.Core.dll * Microsoft.Scripting.dll * Microsoft.Scripting.ExtensionAttribute.dll The last three dlls are DLR which IP 2.0 relies on. I never use ipy to deploy application so I'm not sure about the error you get. It looks like a search path problem. Run ipy.exe in interactive mode and - I think - type in dir(type) to check whether ipy has access to the types you need. Dody G. On Tue, Mar 10, 2009 at 7:57 AM, Howland-Rose, Kyle wrote: > > Hi Dody, > > Fair question :) > > Just a script run from the Windows scheduler that reads a database and writes some files. > > Kyle > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dody Gunawinata > Sent: Tuesday, 10 March 2009 4:38 PM > To: Discussion of IronPython > Subject: Re: [IronPython] 2.0 deployment > > What kind of application are you trying to deploy? ?ASP.Net with IP > support? Application with hosted IP? IP scripts? > > Dody G. > > On Tue, Mar 10, 2009 at 5:27 AM, Howland-Rose, Kyle > wrote: >> Hi all, >> >> My understanding of http://www.ironpython.info/index.php/Deployment?is that >> when deploying to Windows the following need to be deployed: >> * .NET 2.0 or 3.0 installed >> * ipy.exe >> * IronPython.dll >> * IronMath.dll >> >> I thought the IPy 2.0 equiv might be to copy: >> * ipy.exe >> * IronPython.dll >> * IronPython.Modules.dll >> * Microsoft.Scripting.Core.dll >> * Microsoft.Scripting.dll >> * Microsoft.Scripting.ExtensionAttribute.dll >> >> but if I then run test.py which imports types I get >> C:\test>ipy.exe test.py >> Traceback (most recent call last): >> ? File "test.py", line 1, in test.py >> ImportError: No module named types >> C:\test> >> >> Questions: >> >> 1. Do I need to?deploy all of Lib? >> >> 2. Where should I have been reading about this (sorry). >> >> Thanks all. >> >> Regards, >> Kyle >> >> >> >> ************************************************************************ >> >> Allens Arthur Robinson online: http://www.aar.com.au >> >> This email is confidential and may be subject to legal or other professional >> privilege. It is also subject to copyright. If you have received it in >> error, confidentiality and privilege are not waived and you must not >> disclose or use the information in it. Please notify the sender by return >> email and delete it from your system. Any personal information in this email >> must be handled in accordance with the Privacy Act 1988 (Cth). >> >> ************************************************************************* >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > > > -- > nomadlife.org > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > ************************************************************************ > > Allens Arthur Robinson online: http://www.aar.com.au > > This email is confidential and may be subject to legal or other professional privilege. It is also subject to copyright. If you have received it in error, confidentiality and privilege are not waived and you must not disclose or use the information in it. Please notify the sender by return email and delete it from your system. Any personal information in this email must be handled in accordance with the Privacy Act 1988 (Cth). > > ************************************************************************* > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- nomadlife.org From Kyle.Howland-Rose at aar.com.au Tue Mar 10 08:08:50 2009 From: Kyle.Howland-Rose at aar.com.au (Howland-Rose, Kyle) Date: Tue, 10 Mar 2009 18:08:50 +1100 Subject: [IronPython] 2.0 deployment In-Reply-To: <8cd017b80903092329x68940dd6t9abd6f0ca8acecc2@mail.gmail.com> References: <8cd017b80903092237j3a2d944cy90be28c13610a20f@mail.gmail.com> <8cd017b80903092329x68940dd6t9abd6f0ca8acecc2@mail.gmail.com> Message-ID: Thanks Dody. The error was because I did not deploy Lib and the types module is in Lib. I can see that I can successfully deploy by copying the whole of IronPython. It would be neater to turn the script(s) into an exe and deploy that. I have only found IPy 1.0 doco on this and the 1.0 doco did not work on 2.0. Does anyone know of good IPy 2.0 doco on how to turn IPy scripts into an exe? Thanks Dody, thanks all. Kyle -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dody Gunawinata Sent: Tuesday, 10 March 2009 5:29 PM To: Discussion of IronPython Subject: Re: [IronPython] 2.0 deployment 1. You will need to deploy all the lib * ipy.exe * IronPython.dll * IronPython.Modules.dll * Microsoft.Scripting.Core.dll * Microsoft.Scripting.dll * Microsoft.Scripting.ExtensionAttribute.dll The last three dlls are DLR which IP 2.0 relies on. I never use ipy to deploy application so I'm not sure about the error you get. It looks like a search path problem. Run ipy.exe in interactive mode and - I think - type in dir(type) to check whether ipy has access to the types you need. Dody G. On Tue, Mar 10, 2009 at 7:57 AM, Howland-Rose, Kyle wrote: > > Hi Dody, > > Fair question :) > > Just a script run from the Windows scheduler that reads a database and writes some files. > > Kyle > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dody Gunawinata > Sent: Tuesday, 10 March 2009 4:38 PM > To: Discussion of IronPython > Subject: Re: [IronPython] 2.0 deployment > > What kind of application are you trying to deploy? ?ASP.Net with IP > support? Application with hosted IP? IP scripts? > > Dody G. > > On Tue, Mar 10, 2009 at 5:27 AM, Howland-Rose, Kyle > wrote: >> Hi all, >> >> My understanding of http://www.ironpython.info/index.php/Deployment?is that >> when deploying to Windows the following need to be deployed: >> * .NET 2.0 or 3.0 installed >> * ipy.exe >> * IronPython.dll >> * IronMath.dll >> >> I thought the IPy 2.0 equiv might be to copy: >> * ipy.exe >> * IronPython.dll >> * IronPython.Modules.dll >> * Microsoft.Scripting.Core.dll >> * Microsoft.Scripting.dll >> * Microsoft.Scripting.ExtensionAttribute.dll >> >> but if I then run test.py which imports types I get >> C:\test>ipy.exe test.py >> Traceback (most recent call last): >> ? File "test.py", line 1, in test.py >> ImportError: No module named types >> C:\test> >> >> Questions: >> >> 1. Do I need to?deploy all of Lib? >> >> 2. Where should I have been reading about this (sorry). >> >> Thanks all. >> >> Regards, >> Kyle >> >> >> >> ************************************************************************ >> >> Allens Arthur Robinson online: http://www.aar.com.au >> >> This email is confidential and may be subject to legal or other professional >> privilege. It is also subject to copyright. If you have received it in >> error, confidentiality and privilege are not waived and you must not >> disclose or use the information in it. Please notify the sender by return >> email and delete it from your system. Any personal information in this email >> must be handled in accordance with the Privacy Act 1988 (Cth). >> >> ************************************************************************* >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > > > -- > nomadlife.org > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > ************************************************************************ > > Allens Arthur Robinson online: http://www.aar.com.au > > This email is confidential and may be subject to legal or other professional privilege. It is also subject to copyright. If you have received it in error, confidentiality and privilege are not waived and you must not disclose or use the information in it. Please notify the sender by return email and delete it from your system. Any personal information in this email must be handled in accordance with the Privacy Act 1988 (Cth). > > ************************************************************************* > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- nomadlife.org _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com ************************************************************************ Allens Arthur Robinson online: http://www.aar.com.au This email is confidential and may be subject to legal or other professional privilege. It is also subject to copyright. If you have received it in error, confidentiality and privilege are not waived and you must not disclose or use the information in it. Please notify the sender by return email and delete it from your system. Any personal information in this email must be handled in accordance with the Privacy Act 1988 (Cth). ************************************************************************* From fuzzyman at voidspace.org.uk Tue Mar 10 11:33:11 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 10 Mar 2009 10:33:11 +0000 Subject: [IronPython] 2.0 deployment In-Reply-To: References: <8cd017b80903092237j3a2d944cy90be28c13610a20f@mail.gmail.com> <8cd017b80903092329x68940dd6t9abd6f0ca8acecc2@mail.gmail.com> Message-ID: <49B641E7.6010004@voidspace.org.uk> Howland-Rose, Kyle wrote: > Thanks Dody. The error was because I did not deploy Lib and the types module is in Lib. > The types module is part of the Python standard library - you only need to deploy it if you use it. You can compile your Python file and libraries into an executable / assemblies using the Pyc compiler sample - which is available for download on the the IronPython codeplex site. There are some caveats about its use; you will need to add references to any assemblies you import from and some users have reported losing sys.argv when they compile their main executable. In this case it is better to *not* compile your main script, or to create a custom executable in C# which creates the Python engine and executes your main script but doing things like setting up sys.argv and setting the engine search paths. All the best, Michael Foord > I can see that I can successfully deploy by copying the whole of IronPython. > It would be neater to turn the script(s) into an exe and deploy that. > I have only found IPy 1.0 doco on this and the 1.0 doco did not work on 2.0. > > Does anyone know of good IPy 2.0 doco on how to turn IPy scripts into an exe? > > Thanks Dody, thanks all. > > Kyle > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dody Gunawinata > Sent: Tuesday, 10 March 2009 5:29 PM > To: Discussion of IronPython > Subject: Re: [IronPython] 2.0 deployment > > 1. You will need to deploy all the lib > > * ipy.exe > * IronPython.dll > * IronPython.Modules.dll > * Microsoft.Scripting.Core.dll > * Microsoft.Scripting.dll > * Microsoft.Scripting.ExtensionAttribute.dll > > The last three dlls are DLR which IP 2.0 relies on. > > I never use ipy to deploy application so I'm not sure about the error > you get. It looks like a search path problem. Run ipy.exe in > interactive mode and - I think - type in dir(type) to check whether > ipy has access to the types you need. > > Dody G. > > On Tue, Mar 10, 2009 at 7:57 AM, Howland-Rose, Kyle > wrote: > >> Hi Dody, >> >> Fair question :) >> >> Just a script run from the Windows scheduler that reads a database and writes some files. >> >> Kyle >> -----Original Message----- >> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dody Gunawinata >> Sent: Tuesday, 10 March 2009 4:38 PM >> To: Discussion of IronPython >> Subject: Re: [IronPython] 2.0 deployment >> >> What kind of application are you trying to deploy? ASP.Net with IP >> support? Application with hosted IP? IP scripts? >> >> Dody G. >> >> On Tue, Mar 10, 2009 at 5:27 AM, Howland-Rose, Kyle >> wrote: >> >>> Hi all, >>> >>> My understanding of http://www.ironpython.info/index.php/Deployment is that >>> when deploying to Windows the following need to be deployed: >>> * .NET 2.0 or 3.0 installed >>> * ipy.exe >>> * IronPython.dll >>> * IronMath.dll >>> >>> I thought the IPy 2.0 equiv might be to copy: >>> * ipy.exe >>> * IronPython.dll >>> * IronPython.Modules.dll >>> * Microsoft.Scripting.Core.dll >>> * Microsoft.Scripting.dll >>> * Microsoft.Scripting.ExtensionAttribute.dll >>> >>> but if I then run test.py which imports types I get >>> C:\test>ipy.exe test.py >>> Traceback (most recent call last): >>> File "test.py", line 1, in test.py >>> ImportError: No module named types >>> C:\test> >>> >>> Questions: >>> >>> 1. Do I need to deploy all of Lib? >>> >>> 2. Where should I have been reading about this (sorry). >>> >>> Thanks all. >>> >>> Regards, >>> Kyle >>> >>> >>> >>> ************************************************************************ >>> >>> Allens Arthur Robinson online: http://www.aar.com.au >>> >>> This email is confidential and may be subject to legal or other professional >>> privilege. It is also subject to copyright. If you have received it in >>> error, confidentiality and privilege are not waived and you must not >>> disclose or use the information in it. Please notify the sender by return >>> email and delete it from your system. Any personal information in this email >>> must be handled in accordance with the Privacy Act 1988 (Cth). >>> >>> ************************************************************************* >>> >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >>> >> >> -- >> nomadlife.org >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> ************************************************************************ >> >> Allens Arthur Robinson online: http://www.aar.com.au >> >> This email is confidential and may be subject to legal or other professional privilege. It is also subject to copyright. If you have received it in error, confidentiality and privilege are not waived and you must not disclose or use the information in it. Please notify the sender by return email and delete it from your system. Any personal information in this email must be handled in accordance with the Privacy Act 1988 (Cth). >> >> ************************************************************************* >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > > > -- http://www.ironpythoninaction.com/ From kamil at dworakowski.name Tue Mar 10 19:07:34 2009 From: kamil at dworakowski.name (Kamil Dworakowski) Date: Tue, 10 Mar 2009 11:07:34 -0700 (PDT) Subject: [IronPython] import thread-safety Message-ID: <1e60d12d-068e-4c5a-8c52-701864211d26@c36g2000yqn.googlegroups.com> Hello, I tried reactivate parallel importing in Resolver One. More info in this thread from October: http://groups.google.com/group/ironpy/browse_thread/thread/11c5c917d716b7cc/58ce4e4260c2773a?lnk=gst&q=parallel+import#58ce4e4260c2773a I hit a problem. Sometimes during importing I get the following exception. It is a bit of a haisenbug because whenever I try to add some diagnostics Resolver One starts fine. CLS Exception: System.InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.ThrowHelper.ThrowInvalidOperationException (ExceptionResource resource) at System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.MoveNext () at IronPython.Runtime.Types.NewTypeMaker.StoreOverriddenMethod (MethodInfo mi, String newName) at IronPython.Runtime.Types.NewTypeMaker.AddBaseMethods(Type finishedType, Dictionary`2 specialNames) at IronPython.Runtime.Types.NewTypeMaker.CreateNewType() at IronPython.Runtime.Types.NewTypeMaker.<>c__DisplayClass1.b__0 () at Microsoft.Scripting.Utils.Publisher`2.GetOrCreateValue(TKey key, Func`1 create) at IronPython.Runtime.Types.NewTypeMaker.GetNewType(String typeName, PythonTuple bases, IAttributesCollection dict) at IronPython.Runtime.Types.PythonType..ctor(CodeContext context, String name, PythonTuple bases, IAttributesCollection dict) at IronPython.Runtime.Types.PythonType.__new__(CodeContext context, PythonType cls, String name, PythonTuple bases, IAttributesCollection dict) at _stub_$270##128(Closure , CallSite , CodeContext , Object , String , PythonTuple , IAttributesCollection ) at IronPython.Runtime.Operations.PythonOps.MakeClass(CodeContext context, String name, Object[] bases, String selfNames, IAttributesCollection vars) at IronPython.Runtime.Operations.PythonOps.MakeClass(CodeContext context, String name, Object[] bases, String selfNames, CallTarget0 body) at DLRCachedCode.Main\RenameWorksheetTextBoxAdaptor(Scope $scope, LanguageContext $language) at Microsoft.Scripting.ScriptCode.InvokeTarget(LambdaExpression code, Scope scope) at Microsoft.Scripting.ScriptCode.Run(Scope scope) at IronPython.Runtime.PythonContext.CreateModule(String fileName, Scope scope, ScriptCode scriptCode, ModuleOptions options) at IronPython.Runtime.ModuleLoader.load_module(CodeContext context, String fullName) at _stub_$367##225(Closure , CallSite , CodeContext , Object , Object[] ) at IronPython.Runtime.PythonContext.Call(Object func, Object[] args) at IronPython.Runtime.Importer.FindAndLoadModuleFromImporter (CodeContext context, Object importer, String fullName, List path, Object& ret) at IronPython.Runtime.Importer.TryLoadMetaPathModule(CodeContext context, String fullName, List path, Object& ret) at IronPython.Runtime.Importer.TryGetExistingOrMetaPathModule (CodeContext context, String fullName, List path, Object& ret) at IronPython.Runtime.Importer.ImportNestedModule(CodeContext context, Scope scope, String name, List path) at IronPython.Runtime.Importer.ImportModuleFrom(CodeContext context, Object from, String name) at IronPython.Runtime.Importer.ImportModule(CodeContext context, Object globals, String modName, Boolean bottom, Int32 level) at IronPython.Runtime.Builtin.__import__(CodeContext context, String name, Object globals, Object locals, Object fromlist, Int32 level) at IronPython.Runtime.Builtin.__import__(CodeContext context, String name) at _stub_$548##406(Closure , CallSite , CodeContext , Object , Object ) at DLRCachedCode.worker$736(Closure ) CLS Stack trace: at System.ThrowHelper.ThrowInvalidOperationException (ExceptionResource resource) at System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.MoveNext () at IronPython.Runtime.Types.NewTypeMaker.StoreOverriddenMethod (MethodInfo mi, String newName) at IronPython.Runtime.Types.NewTypeMaker.AddBaseMethods(Type finishedType, Dictionary`2 specialNames) at IronPython.Runtime.Types.NewTypeMaker.CreateNewType() at IronPython.Runtime.Types.NewTypeMaker.<>c__DisplayClass1.b__0 () at Microsoft.Scripting.Utils.Publisher`2.GetOrCreateValue(TKey key, Func`1 create) at IronPython.Runtime.Types.NewTypeMaker.GetNewType(String typeName, PythonTuple bases, IAttributesCollection dict) at IronPython.Runtime.Types.PythonType..ctor(CodeContext context, String name, PythonTuple bases, IAttributesCollection dict) at IronPython.Runtime.Types.PythonType.__new__(CodeContext context, PythonType cls, String name, PythonTuple bases, IAttributesCollection dict) at _stub_$270##128(Closure , CallSite , CodeContext , Object , String , PythonTuple , IAttributesCollection ) at IronPython.Runtime.Operations.PythonOps.MakeClass(CodeContext context, String name, Object[] bases, String selfNames, IAttributesCollection vars) at IronPython.Runtime.Operations.PythonOps.MakeClass(CodeContext context, String name, Object[] bases, String selfNames, CallTarget0 body) at DLRCachedCode.Main\RenameWorksheetTextBoxAdaptor(Scope $scope, LanguageContext $language) at Microsoft.Scripting.ScriptCode.InvokeTarget(LambdaExpression code, Scope scope) at Microsoft.Scripting.ScriptCode.Run(Scope scope) at IronPython.Runtime.PythonContext.CreateModule(String fileName, Scope scope, ScriptCode scriptCode, ModuleOptions options) at IronPython.Runtime.ModuleLoader.load_module(CodeContext context, String fullName) at _stub_$367##225(Closure , CallSite , CodeContext , Object , Object[] ) at IronPython.Runtime.PythonContext.Call(Object func, Object[] args) at IronPython.Runtime.Importer.FindAndLoadModuleFromImporter (CodeContext context, Object importer, String fullName, List path, Object& ret) at IronPython.Runtime.Importer.TryLoadMetaPathModule(CodeContext context, String fullName, List path, Object& ret) at IronPython.Runtime.Importer.TryGetExistingOrMetaPathModule (CodeContext context, String fullName, List path, Object& ret) at IronPython.Runtime.Importer.ImportNestedModule(CodeContext context, Scope scope, String name, List path) at IronPython.Runtime.Importer.ImportModuleFrom(CodeContext context, Object from, String name) at IronPython.Runtime.Importer.ImportModule(CodeContext context, Object globals, String modName, Boolean bottom, Int32 level) at IronPython.Runtime.Builtin.__import__(CodeContext context, String name, Object globals, Object locals, Object fromlist, Int32 level) at IronPython.Runtime.Builtin.__import__(CodeContext context, String name) at _stub_$548##406(Closure , CallSite , CodeContext , Object , Object ) at DLRCachedCode.worker$736(Closure ) From dinov at microsoft.com Tue Mar 10 19:21:37 2009 From: dinov at microsoft.com (Dino Viehland) Date: Tue, 10 Mar 2009 11:21:37 -0700 Subject: [IronPython] import thread-safety In-Reply-To: <1e60d12d-068e-4c5a-8c52-701864211d26@c36g2000yqn.googlegroups.com> References: <1e60d12d-068e-4c5a-8c52-701864211d26@c36g2000yqn.googlegroups.com> Message-ID: <350E7D38B6D819428718949920EC2355571C137263@NA-EXMSG-C102.redmond.corp.microsoft.com> This is fixed in 2.6 and we can backport the fix to 2.0. Could you open a bug on CodePlex? If you want to add the fix locally you just need to add the lock statement below to NewTypeMaker.StoreOverriddenMethods: lock(PythonTypeOps._functions) { foreach (BuiltinFunction bf in PythonTypeOps._functions.Values) { if (bf.Name == pythonName && bf.DeclaringType == declType) { bf.AddMethod(mi); break; } } } > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Kamil Dworakowski > Sent: Tuesday, March 10, 2009 11:08 AM > To: users at lists.ironpython.com > Subject: [IronPython] import thread-safety > > Hello, > > I tried reactivate parallel importing in Resolver One. More info in > this thread from October: > http://groups.google.com/group/ironpy/browse_thread/thread/11c5c917d716 > b7cc/58ce4e4260c2773a?lnk=gst&q=parallel+import#58ce4e4260c2773a > > I hit a problem. Sometimes during importing I get the following > exception. It is a bit of a haisenbug because whenever I try to add > some diagnostics Resolver One starts fine. > > CLS Exception: System.InvalidOperationException: Collection was > modified; enumeration operation may not execute. > at System.ThrowHelper.ThrowInvalidOperationException > (ExceptionResource resource) > at > System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.Move > Next > () > at IronPython.Runtime.Types.NewTypeMaker.StoreOverriddenMethod > (MethodInfo mi, String newName) > at IronPython.Runtime.Types.NewTypeMaker.AddBaseMethods(Type > finishedType, Dictionary`2 specialNames) > at IronPython.Runtime.Types.NewTypeMaker.CreateNewType() > at > IronPython.Runtime.Types.NewTypeMaker.<>c__DisplayClass1.b_ > _0 > () > at Microsoft.Scripting.Utils.Publisher`2.GetOrCreateValue(TKey key, > Func`1 create) > at IronPython.Runtime.Types.NewTypeMaker.GetNewType(String > typeName, PythonTuple bases, IAttributesCollection dict) > at IronPython.Runtime.Types.PythonType..ctor(CodeContext context, > String name, PythonTuple bases, IAttributesCollection dict) > at IronPython.Runtime.Types.PythonType.__new__(CodeContext context, > PythonType cls, String name, PythonTuple bases, IAttributesCollection > dict) > at _stub_$270##128(Closure , CallSite , CodeContext , Object , > String , PythonTuple , IAttributesCollection ) > at IronPython.Runtime.Operations.PythonOps.MakeClass(CodeContext > context, String name, Object[] bases, String selfNames, > IAttributesCollection vars) > at IronPython.Runtime.Operations.PythonOps.MakeClass(CodeContext > context, String name, Object[] bases, String selfNames, CallTarget0 > body) > at DLRCachedCode.Main\RenameWorksheetTextBoxAdaptor(Scope $scope, > LanguageContext $language) > at Microsoft.Scripting.ScriptCode.InvokeTarget(LambdaExpression > code, Scope scope) > at Microsoft.Scripting.ScriptCode.Run(Scope scope) > at IronPython.Runtime.PythonContext.CreateModule(String fileName, > Scope scope, ScriptCode scriptCode, ModuleOptions options) > at IronPython.Runtime.ModuleLoader.load_module(CodeContext context, > String fullName) > at _stub_$367##225(Closure , CallSite , CodeContext , Object , > Object[] ) > at IronPython.Runtime.PythonContext.Call(Object func, Object[] > args) > at IronPython.Runtime.Importer.FindAndLoadModuleFromImporter > (CodeContext context, Object importer, String fullName, List path, > Object& ret) > at IronPython.Runtime.Importer.TryLoadMetaPathModule(CodeContext > context, String fullName, List path, Object& ret) > at IronPython.Runtime.Importer.TryGetExistingOrMetaPathModule > (CodeContext context, String fullName, List path, Object& ret) > at IronPython.Runtime.Importer.ImportNestedModule(CodeContext > context, Scope scope, String name, List path) > at IronPython.Runtime.Importer.ImportModuleFrom(CodeContext > context, Object from, String name) > at IronPython.Runtime.Importer.ImportModule(CodeContext context, > Object globals, String modName, Boolean bottom, Int32 level) > at IronPython.Runtime.Builtin.__import__(CodeContext context, > String name, Object globals, Object locals, Object fromlist, Int32 > level) > at IronPython.Runtime.Builtin.__import__(CodeContext context, > String name) > at _stub_$548##406(Closure , CallSite , CodeContext , Object , > Object ) > at DLRCachedCode.worker$736(Closure ) > CLS Stack trace: > > at System.ThrowHelper.ThrowInvalidOperationException > (ExceptionResource resource) > at > System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.Move > Next > () > at IronPython.Runtime.Types.NewTypeMaker.StoreOverriddenMethod > (MethodInfo mi, String newName) > at IronPython.Runtime.Types.NewTypeMaker.AddBaseMethods(Type > finishedType, Dictionary`2 specialNames) > at IronPython.Runtime.Types.NewTypeMaker.CreateNewType() > at > IronPython.Runtime.Types.NewTypeMaker.<>c__DisplayClass1.b_ > _0 > () > at Microsoft.Scripting.Utils.Publisher`2.GetOrCreateValue(TKey key, > Func`1 create) > at IronPython.Runtime.Types.NewTypeMaker.GetNewType(String > typeName, PythonTuple bases, IAttributesCollection dict) > at IronPython.Runtime.Types.PythonType..ctor(CodeContext context, > String name, PythonTuple bases, IAttributesCollection dict) > at IronPython.Runtime.Types.PythonType.__new__(CodeContext context, > PythonType cls, String name, PythonTuple bases, IAttributesCollection > dict) > at _stub_$270##128(Closure , CallSite , CodeContext , Object , > String , PythonTuple , IAttributesCollection ) > at IronPython.Runtime.Operations.PythonOps.MakeClass(CodeContext > context, String name, Object[] bases, String selfNames, > IAttributesCollection vars) > at IronPython.Runtime.Operations.PythonOps.MakeClass(CodeContext > context, String name, Object[] bases, String selfNames, CallTarget0 > body) > at DLRCachedCode.Main\RenameWorksheetTextBoxAdaptor(Scope $scope, > LanguageContext $language) > at Microsoft.Scripting.ScriptCode.InvokeTarget(LambdaExpression > code, Scope scope) > at Microsoft.Scripting.ScriptCode.Run(Scope scope) > at IronPython.Runtime.PythonContext.CreateModule(String fileName, > Scope scope, ScriptCode scriptCode, ModuleOptions options) > at IronPython.Runtime.ModuleLoader.load_module(CodeContext context, > String fullName) > at _stub_$367##225(Closure , CallSite , CodeContext , Object , > Object[] ) > at IronPython.Runtime.PythonContext.Call(Object func, Object[] > args) > at IronPython.Runtime.Importer.FindAndLoadModuleFromImporter > (CodeContext context, Object importer, String fullName, List path, > Object& ret) > at IronPython.Runtime.Importer.TryLoadMetaPathModule(CodeContext > context, String fullName, List path, Object& ret) > at IronPython.Runtime.Importer.TryGetExistingOrMetaPathModule > (CodeContext context, String fullName, List path, Object& ret) > at IronPython.Runtime.Importer.ImportNestedModule(CodeContext > context, Scope scope, String name, List path) > at IronPython.Runtime.Importer.ImportModuleFrom(CodeContext > context, Object from, String name) > at IronPython.Runtime.Importer.ImportModule(CodeContext context, > Object globals, String modName, Boolean bottom, Int32 level) > at IronPython.Runtime.Builtin.__import__(CodeContext context, > String name, Object globals, Object locals, Object fromlist, Int32 > level) > at IronPython.Runtime.Builtin.__import__(CodeContext context, > String name) > at _stub_$548##406(Closure , CallSite , CodeContext , Object , > Object ) > at DLRCachedCode.worker$736(Closure ) > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From Kyle.Howland-Rose at aar.com.au Tue Mar 10 23:51:03 2009 From: Kyle.Howland-Rose at aar.com.au (Howland-Rose, Kyle) Date: Wed, 11 Mar 2009 09:51:03 +1100 Subject: [IronPython] 2.0 deployment In-Reply-To: <49B641E7.6010004@voidspace.org.uk> References: <8cd017b80903092237j3a2d944cy90be28c13610a20f@mail.gmail.com> <8cd017b80903092329x68940dd6t9abd6f0ca8acecc2@mail.gmail.com> <49B641E7.6010004@voidspace.org.uk> Message-ID: Thanks for this Michael. Regards, Kyle -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Tuesday, 10 March 2009 9:33 PM To: Discussion of IronPython Subject: Re: [IronPython] 2.0 deployment Howland-Rose, Kyle wrote: > Thanks Dody. The error was because I did not deploy Lib and the types module is in Lib. > The types module is part of the Python standard library - you only need to deploy it if you use it. You can compile your Python file and libraries into an executable / assemblies using the Pyc compiler sample - which is available for download on the the IronPython codeplex site. There are some caveats about its use; you will need to add references to any assemblies you import from and some users have reported losing sys.argv when they compile their main executable. In this case it is better to *not* compile your main script, or to create a custom executable in C# which creates the Python engine and executes your main script but doing things like setting up sys.argv and setting the engine search paths. All the best, Michael Foord > I can see that I can successfully deploy by copying the whole of IronPython. > It would be neater to turn the script(s) into an exe and deploy that. > I have only found IPy 1.0 doco on this and the 1.0 doco did not work on 2.0. > > Does anyone know of good IPy 2.0 doco on how to turn IPy scripts into an exe? > > Thanks Dody, thanks all. > > Kyle > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dody Gunawinata > Sent: Tuesday, 10 March 2009 5:29 PM > To: Discussion of IronPython > Subject: Re: [IronPython] 2.0 deployment > > 1. You will need to deploy all the lib > > * ipy.exe > * IronPython.dll > * IronPython.Modules.dll > * Microsoft.Scripting.Core.dll > * Microsoft.Scripting.dll > * Microsoft.Scripting.ExtensionAttribute.dll > > The last three dlls are DLR which IP 2.0 relies on. > > I never use ipy to deploy application so I'm not sure about the error > you get. It looks like a search path problem. Run ipy.exe in > interactive mode and - I think - type in dir(type) to check whether > ipy has access to the types you need. > > Dody G. > > On Tue, Mar 10, 2009 at 7:57 AM, Howland-Rose, Kyle > wrote: > >> Hi Dody, >> >> Fair question :) >> >> Just a script run from the Windows scheduler that reads a database and writes some files. >> >> Kyle >> -----Original Message----- >> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dody Gunawinata >> Sent: Tuesday, 10 March 2009 4:38 PM >> To: Discussion of IronPython >> Subject: Re: [IronPython] 2.0 deployment >> >> What kind of application are you trying to deploy? ASP.Net with IP >> support? Application with hosted IP? IP scripts? >> >> Dody G. >> >> On Tue, Mar 10, 2009 at 5:27 AM, Howland-Rose, Kyle >> wrote: >> >>> Hi all, >>> >>> My understanding of http://www.ironpython.info/index.php/Deployment is that >>> when deploying to Windows the following need to be deployed: >>> * .NET 2.0 or 3.0 installed >>> * ipy.exe >>> * IronPython.dll >>> * IronMath.dll >>> >>> I thought the IPy 2.0 equiv might be to copy: >>> * ipy.exe >>> * IronPython.dll >>> * IronPython.Modules.dll >>> * Microsoft.Scripting.Core.dll >>> * Microsoft.Scripting.dll >>> * Microsoft.Scripting.ExtensionAttribute.dll >>> >>> but if I then run test.py which imports types I get >>> C:\test>ipy.exe test.py >>> Traceback (most recent call last): >>> File "test.py", line 1, in test.py >>> ImportError: No module named types >>> C:\test> >>> >>> Questions: >>> >>> 1. Do I need to deploy all of Lib? >>> >>> 2. Where should I have been reading about this (sorry). >>> >>> Thanks all. >>> >>> Regards, >>> Kyle >>> >>> >>> >>> ************************************************************************ >>> >>> Allens Arthur Robinson online: http://www.aar.com.au >>> >>> This email is confidential and may be subject to legal or other professional >>> privilege. It is also subject to copyright. If you have received it in >>> error, confidentiality and privilege are not waived and you must not >>> disclose or use the information in it. Please notify the sender by return >>> email and delete it from your system. Any personal information in this email >>> must be handled in accordance with the Privacy Act 1988 (Cth). >>> >>> ************************************************************************ * >>> >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >>> >> >> -- >> nomadlife.org >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> ************************************************************************ >> >> Allens Arthur Robinson online: http://www.aar.com.au >> >> This email is confidential and may be subject to legal or other professional privilege. It is also subject to copyright. If you have received it in error, confidentiality and privilege are not waived and you must not disclose or use the information in it. Please notify the sender by return email and delete it from your system. Any personal information in this email must be handled in accordance with the Privacy Act 1988 (Cth). >> >> ************************************************************************ * >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > > > -- http://www.ironpythoninaction.com/ _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com ************************************************************************ Allens Arthur Robinson online: http://www.aar.com.au This email is confidential and may be subject to legal or other professional privilege. It is also subject to copyright. If you have received it in error, confidentiality and privilege are not waived and you must not disclose or use the information in it. Please notify the sender by return email and delete it from your system. Any personal information in this email must be handled in accordance with the Privacy Act 1988 (Cth). ************************************************************************* From kamil at dworakowski.name Wed Mar 11 11:51:35 2009 From: kamil at dworakowski.name (Kamil Dworakowski) Date: Wed, 11 Mar 2009 03:51:35 -0700 (PDT) Subject: [IronPython] import thread-safety In-Reply-To: <350E7D38B6D819428718949920EC2355571C137263@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <1e60d12d-068e-4c5a-8c52-701864211d26@c36g2000yqn.googlegroups.com> <350E7D38B6D819428718949920EC2355571C137263@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: issue added: http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=21574 Please back port it if it is not much trouble. On Mar 10, 6:21?pm, Dino Viehland wrote: > This is fixed in 2.6 and we can backport the fix to 2.0. ?Could you open a bug on CodePlex? ?If you want to add the fix locally you just need to add the lock statement below to NewTypeMaker.StoreOverriddenMethods: > > ? ? ? ? lock(PythonTypeOps._functions) { > ? ? ? ? ? ? foreach (BuiltinFunction bf in PythonTypeOps._functions.Values) { > ? ? ? ? ? ? ? ? if (bf.Name == pythonName && bf.DeclaringType == declType) { > ? ? ? ? ? ? ? ? ? ? bf.AddMethod(mi); > ? ? ? ? ? ? ? ? ? ? break; > ? ? ? ? ? ? ? ? } > ? ? ? ? ? ? } > ? ? ? ? } > > > > > -----Original Message----- > > From: users-boun... at lists.ironpython.com [mailto:users- > > boun... at lists.ironpython.com] On Behalf Of Kamil Dworakowski > > Sent: Tuesday, March 10, 2009 11:08 AM > > To: us... at lists.ironpython.com > > Subject: [IronPython] import thread-safety > > > Hello, > > > I tried reactivate parallel importing in Resolver One. More info in > > this thread from October: > >http://groups.google.com/group/ironpy/browse_thread/thread/11c5c917d716 > > b7cc/58ce4e4260c2773a?lnk=gst&q=parallel+import#58ce4e4260c2773a > > > I hit a problem. Sometimes during importing I get the following > > exception. It is a bit of a haisenbug because whenever I try to add > > some diagnostics Resolver One starts fine. > > > CLS Exception: System.InvalidOperationException: Collection was > > modified; enumeration operation may not execute. > > ? ?at System.ThrowHelper.ThrowInvalidOperationException > > (ExceptionResource resource) > > ? ?at > > System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.Move > > Next > > () > > ? ?at IronPython.Runtime.Types.NewTypeMaker.StoreOverriddenMethod > > (MethodInfo mi, String newName) > > ? ?at IronPython.Runtime.Types.NewTypeMaker.AddBaseMethods(Type > > finishedType, Dictionary`2 specialNames) > > ? ?at IronPython.Runtime.Types.NewTypeMaker.CreateNewType() > > ? ?at > > IronPython.Runtime.Types.NewTypeMaker.<>c__DisplayClass1.b_ > > _0 > > () > > ? ?at Microsoft.Scripting.Utils.Publisher`2.GetOrCreateValue(TKey key, > > Func`1 create) > > ? ?at IronPython.Runtime.Types.NewTypeMaker.GetNewType(String > > typeName, PythonTuple bases, IAttributesCollection dict) > > ? ?at IronPython.Runtime.Types.PythonType..ctor(CodeContext context, > > String name, PythonTuple bases, IAttributesCollection dict) > > ? ?at IronPython.Runtime.Types.PythonType.__new__(CodeContext context, > > PythonType cls, String name, PythonTuple bases, IAttributesCollection > > dict) > > ? ?at _stub_$270##128(Closure , CallSite , CodeContext , Object , > > String , PythonTuple , IAttributesCollection ) > > ? ?at IronPython.Runtime.Operations.PythonOps.MakeClass(CodeContext > > context, String name, Object[] bases, String selfNames, > > IAttributesCollection vars) > > ? ?at IronPython.Runtime.Operations.PythonOps.MakeClass(CodeContext > > context, String name, Object[] bases, String selfNames, CallTarget0 > > body) > > ? ?at DLRCachedCode.Main\RenameWorksheetTextBoxAdaptor(Scope $scope, > > LanguageContext $language) > > ? ?at Microsoft.Scripting.ScriptCode.InvokeTarget(LambdaExpression > > code, Scope scope) > > ? ?at Microsoft.Scripting.ScriptCode.Run(Scope scope) > > ? ?at IronPython.Runtime.PythonContext.CreateModule(String fileName, > > Scope scope, ScriptCode scriptCode, ModuleOptions options) > > ? ?at IronPython.Runtime.ModuleLoader.load_module(CodeContext context, > > String fullName) > > ? ?at _stub_$367##225(Closure , CallSite , CodeContext , Object , > > Object[] ) > > ? ?at IronPython.Runtime.PythonContext.Call(Object func, Object[] > > args) > > ? ?at IronPython.Runtime.Importer.FindAndLoadModuleFromImporter > > (CodeContext context, Object importer, String fullName, List path, > > Object& ret) > > ? ?at IronPython.Runtime.Importer.TryLoadMetaPathModule(CodeContext > > context, String fullName, List path, Object& ret) > > ? ?at IronPython.Runtime.Importer.TryGetExistingOrMetaPathModule > > (CodeContext context, String fullName, List path, Object& ret) > > ? ?at IronPython.Runtime.Importer.ImportNestedModule(CodeContext > > context, Scope scope, String name, List path) > > ? ?at IronPython.Runtime.Importer.ImportModuleFrom(CodeContext > > context, Object from, String name) > > ? ?at IronPython.Runtime.Importer.ImportModule(CodeContext context, > > Object globals, String modName, Boolean bottom, Int32 level) > > ? ?at IronPython.Runtime.Builtin.__import__(CodeContext context, > > String name, Object globals, Object locals, Object fromlist, Int32 > > level) > > ? ?at IronPython.Runtime.Builtin.__import__(CodeContext context, > > String name) > > ? ?at _stub_$548##406(Closure , CallSite , CodeContext , Object , > > Object ) > > ? ?at DLRCachedCode.worker$736(Closure ) > > CLS Stack trace: > > > ? ?at System.ThrowHelper.ThrowInvalidOperationException > > (ExceptionResource resource) > > ? ?at > > System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.Move > > Next > > () > > ? ?at IronPython.Runtime.Types.NewTypeMaker.StoreOverriddenMethod > > (MethodInfo mi, String newName) > > ? ?at IronPython.Runtime.Types.NewTypeMaker.AddBaseMethods(Type > > finishedType, Dictionary`2 specialNames) > > ? ?at IronPython.Runtime.Types.NewTypeMaker.CreateNewType() > > ? ?at > > IronPython.Runtime.Types.NewTypeMaker.<>c__DisplayClass1.b_ > > _0 > > () > > ? ?at Microsoft.Scripting.Utils.Publisher`2.GetOrCreateValue(TKey key, > > Func`1 create) > > ? ?at IronPython.Runtime.Types.NewTypeMaker.GetNewType(String > > typeName, PythonTuple bases, IAttributesCollection dict) > > ? ?at IronPython.Runtime.Types.PythonType..ctor(CodeContext context, > > String name, PythonTuple bases, IAttributesCollection dict) > > ? ?at IronPython.Runtime.Types.PythonType.__new__(CodeContext context, > > PythonType cls, String name, PythonTuple bases, IAttributesCollection > > dict) > > ? ?at _stub_$270##128(Closure , CallSite , CodeContext , Object , > > String , PythonTuple , IAttributesCollection ) > > ? ?at IronPython.Runtime.Operations.PythonOps.MakeClass(CodeContext > > context, String name, Object[] bases, String selfNames, > > IAttributesCollection vars) > > ? ?at IronPython.Runtime.Operations.PythonOps.MakeClass(CodeContext > > context, String name, Object[] bases, String selfNames, CallTarget0 > > body) > > ? ?at DLRCachedCode.Main\RenameWorksheetTextBoxAdaptor(Scope $scope, > > LanguageContext $language) > > ? ?at Microsoft.Scripting.ScriptCode.InvokeTarget(LambdaExpression > > code, Scope scope) > > ? ?at Microsoft.Scripting.ScriptCode.Run(Scope scope) > > ? ?at IronPython.Runtime.PythonContext.CreateModule(String fileName, > > Scope scope, ScriptCode scriptCode, ModuleOptions options) > > ? ?at IronPython.Runtime.ModuleLoader.load_module(CodeContext context, > > String fullName) > > ? ?at _stub_$367##225(Closure , CallSite , CodeContext , Object , > > Object[] ) > > ? ?at IronPython.Runtime.PythonContext.Call(Object func, Object[] > > args) > > ? ?at IronPython.Runtime.Importer.FindAndLoadModuleFromImporter > > (CodeContext context, Object importer, String fullName, List path, > > Object& ret) > > ? ?at IronPython.Runtime.Importer.TryLoadMetaPathModule(CodeContext > > context, String fullName, List path, Object& ret) > > ? ?at IronPython.Runtime.Importer.TryGetExistingOrMetaPathModule > > (CodeContext context, String fullName, List path, Object& ret) > > ? ?at IronPython.Runtime.Importer.ImportNestedModule(CodeContext > > context, Scope scope, String name, List path) > > ? ?at IronPython.Runtime.Importer.ImportModuleFrom(CodeContext > > context, Object from, String name) > > ? ?at IronPython.Runtime.Importer.ImportModule(CodeContext context, > > Object globals, String modName, Boolean bottom, Int32 level) > > ? ?at IronPython.Runtime.Builtin.__import__(CodeContext context, > > String name, Object globals, Object locals, Object fromlist, Int32 > > level) > > ? ?at IronPython.Runtime.Builtin.__import__(CodeContext context, > > String name) > > ? ?at _stub_$548##406(Closure , CallSite , CodeContext , Object , > > Object ) > > ? ?at DLRCachedCode.worker$736(Closure ) > > > _______________________________________________ > > Users mailing list > > Us... at lists.ironpython.com > >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > Users mailing list > Us... at lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users-ironpython.com From sjmachin at lexicon.net Sat Mar 14 01:24:03 2009 From: sjmachin at lexicon.net (John Machin) Date: Sat, 14 Mar 2009 11:24:03 +1100 Subject: [IronPython] Is the list broken? Message-ID: <49BAF923.5000908@lexicon.net> I have received no messages since Wed 11 March. The most recent message in the list archive bears the same date. From fuzzyman at voidspace.org.uk Sat Mar 14 01:56:59 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sat, 14 Mar 2009 00:56:59 +0000 Subject: [IronPython] Is the list broken? In-Reply-To: <49BAF923.5000908@lexicon.net> References: <49BAF923.5000908@lexicon.net> Message-ID: <49BB00DB.80503@voidspace.org.uk> John Machin wrote: > I have received no messages since Wed 11 March. The most recent > message in the list archive bears the same date. The current evidence is against that hypothesis... Michael > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From fuzzyman at voidspace.org.uk Sat Mar 14 02:00:18 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sat, 14 Mar 2009 01:00:18 +0000 Subject: [IronPython] Is the list broken? In-Reply-To: <49BB00DB.80503@voidspace.org.uk> References: <49BAF923.5000908@lexicon.net> <49BB00DB.80503@voidspace.org.uk> Message-ID: <49BB01A2.4070307@voidspace.org.uk> Michael Foord wrote: > John Machin wrote: >> I have received no messages since Wed 11 March. The most recent >> message in the list archive bears the same date. > > The current evidence is against that hypothesis... Sorry - couldn't resist. We do go through quiet patches like this from time to time though. Michael > > Michael > >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From sjmachin at lexicon.net Sat Mar 14 02:18:55 2009 From: sjmachin at lexicon.net (John Machin) Date: Sat, 14 Mar 2009 12:18:55 +1100 Subject: [IronPython] Is the list broken? In-Reply-To: <49BB00DB.80503@voidspace.org.uk> References: <49BAF923.5000908@lexicon.net> <49BB00DB.80503@voidspace.org.uk> Message-ID: <49BB05FF.9020308@lexicon.net> On 14/03/2009 11:56 AM, Michael Foord wrote: > John Machin wrote: >> I have received no messages since Wed 11 March. The most recent >> message in the list archive bears the same date. > > The current evidence is against that hypothesis... > Change hytpothesis: The list was broken between Wed Mar 11 03:51:38 PDT 2009 and very recently. Your message is the first that I have received since Wed 11 March. I have had no other problems with receiving e-mail in general or e-mail from mailman-based mailing lists in particular over that time period. The archive (http://lists.ironpython.com/pipermail/users-ironpython.com/2009-March/date.html) is still showing: """ [snip] * [IronPython] import thread-safety Kamil Dworakowski * [IronPython] import thread-safety Dino Viehland * [IronPython] 2.0 deployment Howland-Rose, Kyle * [IronPython] import thread-safety Kamil Dworakowski [the above 4 messages are the last 4 that I received before this message of yours] Last message date: Wed Mar 11 03:51:35 PDT 2009 Archived on: Wed Mar 11 03:51:38 PDT 2009 """ In Thunderbird, neither my Junk folder nor my Deleted folder contain any messages with [IronPython] in the subject. Cheers, John From diakopter at gmail.com Sat Mar 14 15:57:03 2009 From: diakopter at gmail.com (Matthew Wilson) Date: Sat, 14 Mar 2009 09:57:03 -0500 Subject: [IronPython] Is the list broken? In-Reply-To: <49BB05FF.9020308@lexicon.net> References: <49BAF923.5000908@lexicon.net> <49BB00DB.80503@voidspace.org.uk> <49BB05FF.9020308@lexicon.net> Message-ID: > In Thunderbird, neither my Junk folder nor my Deleted folder contain any > messages with [IronPython] in the subject. > fwiw, I did receive those messages.. -Matthew Wilson -------------- next part -------------- An HTML attachment was scrubbed... URL: From ctrachte at gmail.com Sat Mar 14 21:26:13 2009 From: ctrachte at gmail.com (Carl Trachte) Date: Sat, 14 Mar 2009 13:26:13 -0700 Subject: [IronPython] Is the list broken? In-Reply-To: References: <49BAF923.5000908@lexicon.net> <49BB00DB.80503@voidspace.org.uk> <49BB05FF.9020308@lexicon.net> Message-ID: <426ada670903141326i2594a811u87303dec2bdd95ff@mail.gmail.com> On Sat, Mar 14, 2009 at 7:57 AM, Matthew Wilson wrote: > >> In Thunderbird, neither my Junk folder nor my Deleted folder contain any >> messages with [IronPython] in the subject. > > fwiw, I did receive those messages.. > -Matthew Wilson > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > This may not be germane to the discussion, but I have had IronPython messages put in the Spam folder by gmail on occasion. It is probably due to the Python keyword being interpreted as some kind of pr0n site (python.com, formerly an ActiveState (?) Python page, is now a pr0n site). Not sure if this is what's going on. Carl T. From alex at moreati.org.uk Sun Mar 15 12:40:05 2009 From: alex at moreati.org.uk (Alex Willmer) Date: Sun, 15 Mar 2009 11:40:05 +0000 Subject: [IronPython] Revisiting interfaces and COM Message-ID: <425e93af0903150440l349b52a4y6761324e081f682c@mail.gmail.com> >From IronPython I'm calling ArcObjects, a large COM library that uses interfaces extensively. A .NET interoperability library is provided by the vendor. Currently I'm calling these interfaces as follows, but it's getting verbose very quickly: IFooBar.Foo(object, arg) # Foo is a method IFooBar.Bar.GetValue(object) # Bar is a property IFooBar.Bar.SetValue(object, value) In 2006 Seo Sanghyeon proposed, as documented in issue 1506 [1]: wrapper = IFooBar(object) wrapper.Foo(arg) wrapper.Bar wrapper.Bar = value That issue has been closed, presumably fixed. However when I try this cast with one of the interfaces in ArcObjects it fails. (I don't have the exception to hand, so I can't include it right now. I'll post a follow up with the details.) - Was Seo's proposal implemented? Should I be able to cast/wrap an instance of an object that implements IFooBar to IFooBar in IronPython 2.0? - Is some extra step needed for this, when working with a COM library? - Does how a COM interface has been implemented/exposed to .NET matter, wrt to how IronPython treats it? With thanks, Alex [1] http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&WorkItemId=1506 -- Alex Willmer http://moreati.org.uk/blog From igor_elyas at hotmail.com Sun Mar 15 17:35:21 2009 From: igor_elyas at hotmail.com (Igor Elyas) Date: Sun, 15 Mar 2009 18:35:21 +0200 Subject: [IronPython] IPy embedding problem Message-ID: Hello This sample code throws error on Python object initialization: var engine = Python.CreateEngine(); var Ops = engine.CreateOperations(); engine.Runtime.LoadAssembly(typeof(Decimal).Assembly); var src = @" class Checker: def __init__(self, one, two, three=''): self.one = one self.two = two self.tree = three def Call(self): return self.one + self.two + self.tree "; var cs = engine.CreateScriptSourceFromString(src, SourceCodeKind.Statements).Compile(); cs.Execute(); var tclass = cs.DefaultScope.GetVariable("Checker"); object obj = cs.Engine.Operations.Call(tclass,"one","two","three");// throw NotImplementedException Console.WriteLine(obj); But if I use only 2 parameter in initialize/constructor such as : object obj = cs.Engine.Operations.Call(tclass,"one","two"); , than all works fine. What wrong ? Best regards Igor Elyas -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdhardy at gmail.com Sun Mar 15 21:34:08 2009 From: jdhardy at gmail.com (Jeff Hardy) Date: Sun, 15 Mar 2009 14:34:08 -0600 Subject: [IronPython] [2.6] Byte literals and with statements in nightlies? Message-ID: Hi, Both byte literals (#19544) and the with statement (#19534) are marked as fixed, but I get syntax errors for both using the 48140 nightly build. Have those fixed not made it to the public code yet? - Jeff From curt at hagenlocher.org Sun Mar 15 22:15:47 2009 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sun, 15 Mar 2009 14:15:47 -0700 Subject: [IronPython] [2.6] Byte literals and with statements in nightlies? In-Reply-To: References: Message-ID: You probably need to run with -X:Python26 (for now). On Sun, Mar 15, 2009 at 1:34 PM, Jeff Hardy wrote: > Hi, > Both byte literals (#19544) and the with statement (#19534) are marked > as fixed, but I get syntax errors for both using the 48140 nightly > build. Have those fixed not made it to the public code yet? > > - Jeff > _______________________________________________ > 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 curt at hagenlocher.org Sun Mar 15 22:50:34 2009 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sun, 15 Mar 2009 14:50:34 -0700 Subject: [IronPython] IPy embedding problem In-Reply-To: References: Message-ID: Can you please open a bug for this on the DLR site ( http://www.codeplex.com/dlr)? There's a few methods that basically have code looking like this: switch (parameters.Length) { case 0: // blah case 1: // blah case 2: // blah default: throw new NotImplementedException(); } and these clearly need to be cleaned up. I'm pretty sure there's a workaround for this, but a quick scan through the source code doesn't reveal anything obvious to me :(. One possibility is to get "Checker" from the scope -- it may just give you a delegate you can call directly. On Sun, Mar 15, 2009 at 9:35 AM, Igor Elyas wrote: > Hello > > This sample code throws error on Python object initialization: > > var engine = Python.CreateEngine(); > var Ops = engine.CreateOperations(); > engine.Runtime.LoadAssembly(typeof(Decimal).Assembly); > var src = > @" > class Checker: > def __init__(self, one, two, three=''): > self.one = one > self.two = two > self.tree = three > def Call(self): > return self.one + self.two + self.tree > "; > > var cs = engine.CreateScriptSourceFromString(src, > SourceCodeKind.Statements).Compile(); > cs.Execute(); > var tclass = cs.DefaultScope.GetVariable("Checker"); > object obj = > cs.Engine.Operations.Call(tclass,"one","two","three");// throw > NotImplementedException > > Console.WriteLine(obj); > > But if I use only 2 parameter in initialize/constructor such as : > > object obj = cs.Engine.Operations.Call(tclass,"one","two"); > > , than all works fine. > > What wrong ? > > Best regards > Igor Elyas > > _______________________________________________ > 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 wim at 3win.be Mon Mar 16 10:17:12 2009 From: wim at 3win.be (Wim De Kimpe) Date: Mon, 16 Mar 2009 10:17:12 +0100 Subject: [IronPython] IronPython and COM object useage In-Reply-To: References: Message-ID: <004401c9a617$fdb361a0$f91a24e0$@be> Hi all Not sure if this is the right forum, but I ask my question anyway. I would like to use IronPython for creating a hardware testing environment, consisting of a "Device Under Test" and some measurement equipment like a lab power supply and voltage meter and things like that. These instruments come with a library which enables communication via USB or GPIB. I have been using them in VBA for Excel, C# and VB.Net. Now when I try to do the same in IronPython, I do not seem to get it to work. I have copied the Interop assembly dll's from my example C# program into a separate directory, and then try to do the same steps as I do in the example. Here's the C# example : using System; using Agilent.AgilentU2741A.Interop; namespace Example1 { /// /// Agilent IVI-COM Driver Example Program /// /// Creates a driver object, reads a few Identity interface /// properties, and checks the instrument error queue. /// May include additional instrument specific functionality. /// /// Runs in simulation mode without an instrument. /// /// Requires a COM reference to the driver's type library. /// /// public class App { [STAThread] public static void Main(string[] args) { Agilent.AgilentU2741A.Interop.AgilentU2741A driver = null; try { // Create driver instance driver = new Agilent.AgilentU2741A.Interop.AgilentU2741AClass(); // Setup VISA resource descriptor. Ignored if Simulate=true string resourceDesc = "USB0::2391::18712::SN-4567890::0::INSTR"; // Setup IVI-defined initialization options string standardInitOptions = "QueryInstrStatus=true, Simulate=true"; // Setup driver-specific initialization options string driverSetupOptions = "DriverSetup= Model=, Trace=false"; driver.Initialize(resourceDesc, false, true, standardInitOptions + "," + driverSetupOptions); Console.WriteLine(" Driver Initialized"); // IIviDriverIdentity properties - Initialize required string instModel = driver.Identity.InstrumentModel; Console.WriteLine("InstrumentModel: {0}", instModel); string instFirmwareRevision = driver.Identity.InstrumentFirmwareRevision; Console.WriteLine("InstrumentFirmwareRevision: {0}", instFirmwareRevision); string instManufacturer = driver.Identity.InstrumentManufacturer; Console.WriteLine("InstrumentManufacturer: {0}\n", instManufacturer); // TODO: Exercise driver methods and properties // Check instrument for errors int errorNum = -1; string errorMsg = null; Console.WriteLine(""); while (errorNum != 0) { driver.Utility.ErrorQuery(ref errorNum, ref errorMsg); Console.WriteLine("ErrorQuery: {0}, {1}", errorNum, errorMsg); } } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { if (driver != null && driver.Initialized) { // Close driver driver.Close(); Console.WriteLine(" Driver Closed"); } } Console.WriteLine("\nDone - Press Enter to Exit"); Console.ReadLine(); } } } Here is what I try to do in Ironpython : >>> import sys >>> import clr >>> clr.AddReferenceToFile("Agilent.AgilentU2741A.Interop.dll") >>> from Agilent.AgilentU2741A.Interop import * >>> a = AgilentU2741AClass() >>> a >>> dir(a) ['AC', 'ACCurrent', 'ACVoltage', 'Abort', 'ActualRange', 'Advanced', 'Alpha', 'A pertureTime', 'ApertureTimeUnits', 'AutoRange', 'AutoZero', 'Cache', 'Calibratio n', 'Clear', 'ClearInterchangeWarnings', 'Close', 'Code', 'Configure', 'Configur eBandwidth', 'ConfigureServiceRequest', 'ConfigureSynchronization', 'Continuity' , 'Count', 'CreateObjRef', 'DCCurrent', 'DCVoltage', 'Delay', 'Description', 'Di ode', 'DirectIO', 'Disable', 'DriverOperation', 'DriverSetup', 'Equals', 'ErrorQ uery', 'FResistance', 'Fetch', 'FetchMultiPoint', 'FixedRefJunction', 'Frequency ', 'FrequencyMax', 'FrequencyMin', 'Function', 'GeographicalAddress', 'GetHashCo de', 'GetLifetimeService', 'GetNextCoercionRecord', 'GetNextInterchangeWarning', 'GetType', 'GroupCapabilities', 'IAgilentU2741AACVoltage_AutoRange', 'IAgilentU 2741AACVoltage_Configure', 'IAgilentU2741AACVoltage_Measure', 'IAgilentU2741AACV oltage_Range', 'IAgilentU2741AContinuity_Configure', 'IAgilentU2741AContinuity_M easure', 'IAgilentU2741ADCCurrent_AutoRange', 'IAgilentU2741ADCCurrent_AutoZero' , 'IAgilentU2741ADCCurrent_Range', 'IAgilentU2741ADCVoltage_AutoRange', 'IAgilen tU2741ADCVoltage_AutoZero', 'IAgilentU2741ADCVoltage_Configure', 'IAgilentU2741A DCVoltage_Measure', 'IAgilentU2741ADCVoltage_NPLC', 'IAgilentU2741ADCVoltage_Ran ge', 'IAgilentU2741ADCVoltage_Resolution', 'IAgilentU2741ADiode_Configure', 'IAg ilentU2741ADiode_Measure', 'IAgilentU2741AFResistance_AutoRange', 'IAgilentU2741 AFResistance_AutoZero', 'IAgilentU2741AFResistance_Configure', 'IAgilentU2741AFR esistance_Measure', 'IAgilentU2741AFResistance_NPLC', 'IAgilentU2741AFResistance _Range', 'IAgilentU2741AFResistance_Resolution', 'IAgilentU2741AFrequency_Config ure', 'IAgilentU2741AFrequency_Measure', 'IAgilentU2741AResistance_AutoRange', ' IAgilentU2741AResistance_AutoZero', 'IAgilentU2741AResistance_Configure', 'IAgil entU2741AResistance_Measure', 'IAgilentU2741AResistance_NPLC', 'IAgilentU2741ARe sistance_Range', 'IAgilentU2741AResistance_Resolution', 'IIviComponentIdentity_D escription', 'IIviComponentIdentity_Revision', 'IIviComponentIdentity_Vendor', ' IIviDmmAdvanced_ActualRange', 'IIviDmmAdvanced_ApertureTime', 'IIviDmmAdvanced_A pertureTimeUnits', 'IIviDmmAdvanced_AutoZero', 'IIviDmmAdvanced_PowerlineFrequen cy', 'IIviDmmMeasurement_Abort', 'IIviDmmMeasurement_Fetch', 'IIviDmmMeasurement _Initiate', 'IIviDmmMeasurement_IsOverRange', 'IIviDmmMeasurement_Read', 'IIviDm mMeasurement_SendSoftwareTrigger', 'IIviDmmMultiPoint_Count', 'IIviDmmRTD_Config ure', 'IIviDmmRTD_Resistance', 'IIviDmmThermistor_Resistance', 'IIviDmmTrigger_S lope', 'IIviDmmTrigger_Source', 'IIviDmm_Advanced', 'IIviDmm_Close', 'IIviDmm_Dr iverOperation', 'IIviDmm_Frequency', 'IIviDmm_Function', 'IIviDmm_Identity', 'II viDmm_Initialize', 'IIviDmm_Initialized', 'IIviDmm_Measurement', 'IIviDmm_Range' , 'IIviDmm_Resolution', 'IIviDmm_Temperature', 'IIviDmm_Trigger', 'IIviDmm_Utili ty', 'IIviDriver_Close', 'IIviDriver_DriverOperation', 'IIviDriver_Identity', 'I IviDriver_Initialize', 'IIviDriver_Initialized', 'IIviDriver_Utility', 'Identifi er', 'Identity', 'Initialize', 'InitializeLifetimeService', 'Initialized', 'Init iate', 'InstrumentFirmwareRevision', 'InstrumentManufacturer', 'InstrumentModel' , 'InterchangeCheck', 'InvalidateAllAttributes', 'IoResourceDescriptor', 'IsOver Range', 'LockObject', 'LogicalName', 'Measure', 'Measurement', 'MeasurementCompl ete', 'MemberwiseClone', 'Message', 'MultiPoint', 'NPLC', 'PerformADCCalibration ', 'PerformCalibration', 'PowerlineFrequency', 'Preset', 'QueryInstrumentStatus' , 'RTD', 'Range', 'RangeCheck', 'Read', 'ReadMultiPoint', 'ReadingUnits', 'Recor dCoercions', 'RefJunctionType', 'ReferenceEquals', 'Register', 'Reset', 'ResetCa librationCode', 'ResetInterchangeCheck', 'ResetWithDefaults', 'Resistance', 'Res olution', 'Revision', 'SampleCount', 'SampleInterval', 'SampleTrigger', 'Securit yEnable', 'SecurityState', 'SelfTest', 'SendSoftwareTrigger', 'SerialNumber', 'S erialPoll', 'Simulate', 'Slope', 'Source', 'SpecificationMajorVersion', 'Specifi cationMinorVersion', 'Status', 'StoreCalibrationConstants', 'SupportedInstrument Models', 'SynchronizationBusLine', 'SynchronizationState', 'System', 'Temperatur e', 'Thermistor', 'Thermocouple', 'TimeoutMilliseconds', 'ToString', 'Transducer Type', 'Trigger', 'Type', 'UnitTemperature', 'UnlockObject', 'Utility', 'Value', 'Vendor', 'VoltageRange', 'WaitForOperationComplete', '__class__', '__delattr__ ', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__ ', '__reduce_ex__', '__repr__', '__setattr__', '__str__'] ' object has no attribute 'Load' >>> a.Initialized() Traceback (most recent call last): File "", line 1, in AttributeError: 'GenericComObject' object has no attribute 'Initialized' >>> At this point I was expected to just get : FALSE. Also when I try to call the Initialize method (which seems to be imported correctly), I get the same error : unknown attribute. When I try to step through the available methods, I do not get any of the interesting ones, only the 'generic' ones. Also I have checked the Interop assembly using IL DASM, and there also I get the full list, so I think the interop assembly is ok. What do I do wrong? Is this because it is a COM object ? The IronPython tutorial is not very elaborate on what is actually happening during the exercice, so I am running a bit out of ideas here. Thanks wim -------------- next part -------------- An HTML attachment was scrubbed... URL: From igor_elyas at hotmail.com Mon Mar 16 15:31:03 2009 From: igor_elyas at hotmail.com (Igor Elyas) Date: Mon, 16 Mar 2009 16:31:03 +0200 Subject: [IronPython] IPy embedding problem In-Reply-To: References: Message-ID: Bug added to DLR project. From: Curt Hagenlocher Sent: Sunday, March 15, 2009 11:50 PM To: Discussion of IronPython Subject: Re: [IronPython] IPy embedding problem Can you please open a bug for this on the DLR site (http://www.codeplex.com/dlr)? There's a few methods that basically have code looking like this: switch (parameters.Length) { case 0: // blah case 1: // blah case 2: // blah default: throw new NotImplementedException(); } and these clearly need to be cleaned up. I'm pretty sure there's a workaround for this, but a quick scan through the source code doesn't reveal anything obvious to me :(. One possibility is to get "Checker" from the scope -- it may just give you a delegate you can call directly. On Sun, Mar 15, 2009 at 9:35 AM, Igor Elyas wrote: Hello This sample code throws error on Python object initialization: var engine = Python.CreateEngine(); var Ops = engine.CreateOperations(); engine.Runtime.LoadAssembly(typeof(Decimal).Assembly); var src = @" class Checker: def __init__(self, one, two, three=''): self.one = one self.two = two self.tree = three def Call(self): return self.one + self.two + self.tree "; var cs = engine.CreateScriptSourceFromString(src, SourceCodeKind.Statements).Compile(); cs.Execute(); var tclass = cs.DefaultScope.GetVariable("Checker"); object obj = cs.Engine.Operations.Call(tclass,"one","two","three");// throw NotImplementedException Console.WriteLine(obj); But if I use only 2 parameter in initialize/constructor such as : object obj = cs.Engine.Operations.Call(tclass,"one","two"); , than all works fine. What wrong ? Best regards Igor Elyas _______________________________________________ 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 microsoft.com Mon Mar 16 17:21:13 2009 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 16 Mar 2009 09:21:13 -0700 Subject: [IronPython] Revisiting interfaces and COM In-Reply-To: <425e93af0903150440l349b52a4y6761324e081f682c@mail.gmail.com> References: <425e93af0903150440l349b52a4y6761324e081f682c@mail.gmail.com> Message-ID: <350E7D38B6D819428718949920EC2355571C20200F@NA-EXMSG-C102.redmond.corp.microsoft.com> The resolution of that bug was that we now expose explicitly implemented interfaces automatically if there are no naming conflicts. But with COM it's usually a different story - the members should always just be there. Do the interop libraries use explicit interface implementation (if they did the method names would show up as something like Namespace.IFoo.Bar in ildasm)? > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Alex Willmer > Sent: Sunday, March 15, 2009 4:40 AM > To: Users at lists.ironpython.com > Subject: [IronPython] Revisiting interfaces and COM > > >From IronPython I'm calling ArcObjects, a large COM library that uses > interfaces extensively. A .NET interoperability library is provided by > the vendor. > > Currently I'm calling these interfaces as follows, but it's getting > verbose very quickly: > > IFooBar.Foo(object, arg) # Foo is a method > IFooBar.Bar.GetValue(object) # Bar is a property > IFooBar.Bar.SetValue(object, value) > > In 2006 Seo Sanghyeon proposed, as documented in issue 1506 [1]: > > wrapper = IFooBar(object) > wrapper.Foo(arg) > wrapper.Bar > wrapper.Bar = value > > That issue has been closed, presumably fixed. However when I try this > cast with one of the interfaces in ArcObjects it fails. (I don't have > the exception to hand, so I can't include it right now. I'll post a > follow up with the details.) > > - Was Seo's proposal implemented? Should I be able to cast/wrap an > instance of an object that implements IFooBar to IFooBar in IronPython > 2.0? > - Is some extra step needed for this, when working with a COM library? > - Does how a COM interface has been implemented/exposed to .NET > matter, wrt to how IronPython treats it? > > With thanks, Alex > > [1] > http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&WorkI > temId=1506 > -- > Alex Willmer > http://moreati.org.uk/blog > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at microsoft.com Mon Mar 16 17:25:15 2009 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 16 Mar 2009 09:25:15 -0700 Subject: [IronPython] IronPython and COM object useage In-Reply-To: <004401c9a617$fdb361a0$f91a24e0$@be> References: <004401c9a617$fdb361a0$f91a24e0$@be> Message-ID: <350E7D38B6D819428718949920EC2355571C202019@NA-EXMSG-C102.redmond.corp.microsoft.com> Does get_Initialized work? On 2.0 you might want to run w/ the -X:PreferComInteropAssembly option which will cause us to prefer the interop assembly over using normal COM dispatch. It'd still probably be interesting to track down the real issue here because that option is gone in 2.6. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Wim De Kimpe Sent: Monday, March 16, 2009 2:17 AM To: 'Discussion of IronPython' Subject: [IronPython] IronPython and COM object useage Hi all Not sure if this is the right forum, but I ask my question anyway. I would like to use IronPython for creating a hardware testing environment, consisting of a "Device Under Test" and some measurement equipment like a lab power supply and voltage meter and things like that. These instruments come with a library which enables communication via USB or GPIB. I have been using them in VBA for Excel, C# and VB.Net. Now when I try to do the same in IronPython, I do not seem to get it to work. I have copied the Interop assembly dll's from my example C# program into a separate directory, and then try to do the same steps as I do in the example. Here's the C# example : using System; using Agilent.AgilentU2741A.Interop; namespace Example1 { /// /// Agilent IVI-COM Driver Example Program /// /// Creates a driver object, reads a few Identity interface /// properties, and checks the instrument error queue. /// May include additional instrument specific functionality. /// /// Runs in simulation mode without an instrument. /// /// Requires a COM reference to the driver's type library. /// /// public class App { [STAThread] public static void Main(string[] args) { Agilent.AgilentU2741A.Interop.AgilentU2741A driver = null; try { // Create driver instance driver = new Agilent.AgilentU2741A.Interop.AgilentU2741AClass(); // Setup VISA resource descriptor. Ignored if Simulate=true string resourceDesc = "USB0::2391::18712::SN-4567890::0::INSTR"; // Setup IVI-defined initialization options string standardInitOptions = "QueryInstrStatus=true, Simulate=true"; // Setup driver-specific initialization options string driverSetupOptions = "DriverSetup= Model=, Trace=false"; driver.Initialize(resourceDesc, false, true, standardInitOptions + "," + driverSetupOptions); Console.WriteLine(" Driver Initialized"); // IIviDriverIdentity properties - Initialize required string instModel = driver.Identity.InstrumentModel; Console.WriteLine("InstrumentModel: {0}", instModel); string instFirmwareRevision = driver.Identity.InstrumentFirmwareRevision; Console.WriteLine("InstrumentFirmwareRevision: {0}", instFirmwareRevision); string instManufacturer = driver.Identity.InstrumentManufacturer; Console.WriteLine("InstrumentManufacturer: {0}\n", instManufacturer); // TODO: Exercise driver methods and properties // Check instrument for errors int errorNum = -1; string errorMsg = null; Console.WriteLine(""); while (errorNum != 0) { driver.Utility.ErrorQuery(ref errorNum, ref errorMsg); Console.WriteLine("ErrorQuery: {0}, {1}", errorNum, errorMsg); } } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { if (driver != null && driver.Initialized) { // Close driver driver.Close(); Console.WriteLine(" Driver Closed"); } } Console.WriteLine("\nDone - Press Enter to Exit"); Console.ReadLine(); } } } Here is what I try to do in Ironpython : >>> import sys >>> import clr >>> clr.AddReferenceToFile("Agilent.AgilentU2741A.Interop.dll") >>> from Agilent.AgilentU2741A.Interop import * >>> a = AgilentU2741AClass() >>> a >>> dir(a) ['AC', 'ACCurrent', 'ACVoltage', 'Abort', 'ActualRange', 'Advanced', 'Alpha', 'A pertureTime', 'ApertureTimeUnits', 'AutoRange', 'AutoZero', 'Cache', 'Calibratio n', 'Clear', 'ClearInterchangeWarnings', 'Close', 'Code', 'Configure', 'Configur eBandwidth', 'ConfigureServiceRequest', 'ConfigureSynchronization', 'Continuity' , 'Count', 'CreateObjRef', 'DCCurrent', 'DCVoltage', 'Delay', 'Description', 'Di ode', 'DirectIO', 'Disable', 'DriverOperation', 'DriverSetup', 'Equals', 'ErrorQ uery', 'FResistance', 'Fetch', 'FetchMultiPoint', 'FixedRefJunction', 'Frequency ', 'FrequencyMax', 'FrequencyMin', 'Function', 'GeographicalAddress', 'GetHashCo de', 'GetLifetimeService', 'GetNextCoercionRecord', 'GetNextInterchangeWarning', 'GetType', 'GroupCapabilities', 'IAgilentU2741AACVoltage_AutoRange', 'IAgilentU 2741AACVoltage_Configure', 'IAgilentU2741AACVoltage_Measure', 'IAgilentU2741AACV oltage_Range', 'IAgilentU2741AContinuity_Configure', 'IAgilentU2741AContinuity_M easure', 'IAgilentU2741ADCCurrent_AutoRange', 'IAgilentU2741ADCCurrent_AutoZero' , 'IAgilentU2741ADCCurrent_Range', 'IAgilentU2741ADCVoltage_AutoRange', 'IAgilen tU2741ADCVoltage_AutoZero', 'IAgilentU2741ADCVoltage_Configure', 'IAgilentU2741A DCVoltage_Measure', 'IAgilentU2741ADCVoltage_NPLC', 'IAgilentU2741ADCVoltage_Ran ge', 'IAgilentU2741ADCVoltage_Resolution', 'IAgilentU2741ADiode_Configure', 'IAg ilentU2741ADiode_Measure', 'IAgilentU2741AFResistance_AutoRange', 'IAgilentU2741 AFResistance_AutoZero', 'IAgilentU2741AFResistance_Configure', 'IAgilentU2741AFR esistance_Measure', 'IAgilentU2741AFResistance_NPLC', 'IAgilentU2741AFResistance _Range', 'IAgilentU2741AFResistance_Resolution', 'IAgilentU2741AFrequency_Config ure', 'IAgilentU2741AFrequency_Measure', 'IAgilentU2741AResistance_AutoRange', ' IAgilentU2741AResistance_AutoZero', 'IAgilentU2741AResistance_Configure', 'IAgil entU2741AResistance_Measure', 'IAgilentU2741AResistance_NPLC', 'IAgilentU2741ARe sistance_Range', 'IAgilentU2741AResistance_Resolution', 'IIviComponentIdentity_D escription', 'IIviComponentIdentity_Revision', 'IIviComponentIdentity_Vendor', ' IIviDmmAdvanced_ActualRange', 'IIviDmmAdvanced_ApertureTime', 'IIviDmmAdvanced_A pertureTimeUnits', 'IIviDmmAdvanced_AutoZero', 'IIviDmmAdvanced_PowerlineFrequen cy', 'IIviDmmMeasurement_Abort', 'IIviDmmMeasurement_Fetch', 'IIviDmmMeasurement _Initiate', 'IIviDmmMeasurement_IsOverRange', 'IIviDmmMeasurement_Read', 'IIviDm mMeasurement_SendSoftwareTrigger', 'IIviDmmMultiPoint_Count', 'IIviDmmRTD_Config ure', 'IIviDmmRTD_Resistance', 'IIviDmmThermistor_Resistance', 'IIviDmmTrigger_S lope', 'IIviDmmTrigger_Source', 'IIviDmm_Advanced', 'IIviDmm_Close', 'IIviDmm_Dr iverOperation', 'IIviDmm_Frequency', 'IIviDmm_Function', 'IIviDmm_Identity', 'II viDmm_Initialize', 'IIviDmm_Initialized', 'IIviDmm_Measurement', 'IIviDmm_Range' , 'IIviDmm_Resolution', 'IIviDmm_Temperature', 'IIviDmm_Trigger', 'IIviDmm_Utili ty', 'IIviDriver_Close', 'IIviDriver_DriverOperation', 'IIviDriver_Identity', 'I IviDriver_Initialize', 'IIviDriver_Initialized', 'IIviDriver_Utility', 'Identifi er', 'Identity', 'Initialize', 'InitializeLifetimeService', 'Initialized', 'Init iate', 'InstrumentFirmwareRevision', 'InstrumentManufacturer', 'InstrumentModel' , 'InterchangeCheck', 'InvalidateAllAttributes', 'IoResourceDescriptor', 'IsOver Range', 'LockObject', 'LogicalName', 'Measure', 'Measurement', 'MeasurementCompl ete', 'MemberwiseClone', 'Message', 'MultiPoint', 'NPLC', 'PerformADCCalibration ', 'PerformCalibration', 'PowerlineFrequency', 'Preset', 'QueryInstrumentStatus' , 'RTD', 'Range', 'RangeCheck', 'Read', 'ReadMultiPoint', 'ReadingUnits', 'Recor dCoercions', 'RefJunctionType', 'ReferenceEquals', 'Register', 'Reset', 'ResetCa librationCode', 'ResetInterchangeCheck', 'ResetWithDefaults', 'Resistance', 'Res olution', 'Revision', 'SampleCount', 'SampleInterval', 'SampleTrigger', 'Securit yEnable', 'SecurityState', 'SelfTest', 'SendSoftwareTrigger', 'SerialNumber', 'S erialPoll', 'Simulate', 'Slope', 'Source', 'SpecificationMajorVersion', 'Specifi cationMinorVersion', 'Status', 'StoreCalibrationConstants', 'SupportedInstrument Models', 'SynchronizationBusLine', 'SynchronizationState', 'System', 'Temperatur e', 'Thermistor', 'Thermocouple', 'TimeoutMilliseconds', 'ToString', 'Transducer Type', 'Trigger', 'Type', 'UnitTemperature', 'UnlockObject', 'Utility', 'Value', 'Vendor', 'VoltageRange', 'WaitForOperationComplete', '__class__', '__delattr__ ', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__ ', '__reduce_ex__', '__repr__', '__setattr__', '__str__'] ' object has no attribute 'Load' >>> a.Initialized() Traceback (most recent call last): File "", line 1, in AttributeError: 'GenericComObject' object has no attribute 'Initialized' >>> At this point I was expected to just get : FALSE. Also when I try to call the Initialize method (which seems to be imported correctly), I get the same error : unknown attribute. When I try to step through the available methods, I do not get any of the interesting ones, only the 'generic' ones. Also I have checked the Interop assembly using IL DASM, and there also I get the full list, so I think the interop assembly is ok. What do I do wrong? Is this because it is a COM object ? The IronPython tutorial is not very elaborate on what is actually happening during the exercice, so I am running a bit out of ideas here... Thanks wim -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdhardy at gmail.com Tue Mar 17 00:23:21 2009 From: jdhardy at gmail.com (Jeff Hardy) Date: Mon, 16 Mar 2009 17:23:21 -0600 Subject: [IronPython] [2.6] Byte literals and with statements in nightlies? In-Reply-To: References: Message-ID: That did the trick. Thanks! - Jeff On Sun, Mar 15, 2009 at 3:15 PM, Curt Hagenlocher wrote: > You probably need to run with -X:Python26 (for now). > > On Sun, Mar 15, 2009 at 1:34 PM, Jeff Hardy wrote: >> >> Hi, >> Both byte literals (#19544) and the with statement (#19534) are marked >> as fixed, but I get syntax errors for both using the 48140 nightly >> build. Have those fixed not made it to the public code yet? >> >> - Jeff >> _______________________________________________ >> 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 jdhardy at gmail.com Tue Mar 17 01:44:39 2009 From: jdhardy at gmail.com (Jeff Hardy) Date: Mon, 16 Mar 2009 18:44:39 -0600 Subject: [IronPython] CP Issue #21659: Subclassing unicode Message-ID: Hi, Is there any quick workaround for #21569? It's causing about a third of the Genshi errors I'm hitting. Trying to override __init__ in the subclass gives the same error. class Foo(unicode): def __init__(self, val): pass f = Foo(1) Traceback (most recent call last): File "foo.py", line 5, in __main__ TypeError: expected str, got int Thanks, Jeff From fuzzyman at voidspace.org.uk Tue Mar 17 02:01:55 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 17 Mar 2009 01:01:55 +0000 Subject: [IronPython] CP Issue #21659: Subclassing unicode In-Reply-To: References: Message-ID: <49BEF683.7050206@voidspace.org.uk> Jeff Hardy wrote: > Hi, > Is there any quick workaround for #21569? It's causing about a third > of the Genshi errors I'm hitting. Trying to override __init__ in the > subclass gives the same error. > > class Foo(unicode): > def __init__(self, val): > pass > > f = Foo(1) > > Traceback (most recent call last): > File "foo.py", line 5, in __main__ > TypeError: expected str, got int > Wouldn't that particular example bomb out on CPython as well - you need to override __new__ on the immutable builtins surely? Michael > Thanks, > Jeff > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From dinov at microsoft.com Tue Mar 17 02:03:26 2009 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 16 Mar 2009 18:03:26 -0700 Subject: [IronPython] CP Issue #21659: Subclassing unicode In-Reply-To: References: Message-ID: <350E7D38B6D819428718949920EC2355571C2023A5@NA-EXMSG-C102.redmond.corp.microsoft.com> Does this make it work? class x(unicode): def __init__(self, val): pass def __new__(cls, val): return unicode.__new__(cls, unicode(val)) x(1) I've voted for the bug and raised the priority to medium. I've left it proposed until we triage it as a team (we triage bugs every Monday morning so it'll be a week) but I might be able to fix it before then :) > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Jeff Hardy > Sent: Monday, March 16, 2009 5:45 PM > To: Discussion of IronPython > Subject: [IronPython] CP Issue #21659: Subclassing unicode > > Hi, > Is there any quick workaround for #21569? It's causing about a third > of the Genshi errors I'm hitting. Trying to override __init__ in the > subclass gives the same error. > > class Foo(unicode): > def __init__(self, val): > pass > > f = Foo(1) > > Traceback (most recent call last): > File "foo.py", line 5, in __main__ > TypeError: expected str, got int > > Thanks, > Jeff > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at microsoft.com Tue Mar 17 02:07:41 2009 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 16 Mar 2009 18:07:41 -0700 Subject: [IronPython] CP Issue #21659: Subclassing unicode In-Reply-To: <49BEF683.7050206@voidspace.org.uk> References: <49BEF683.7050206@voidspace.org.uk> Message-ID: <350E7D38B6D819428718949920EC2355571C2023A8@NA-EXMSG-C102.redmond.corp.microsoft.com> It works on CPython 2.6 at least. You should only have to override __new__ if you wanted to support different arguments than str/unicode.__new__ supports. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Monday, March 16, 2009 6:02 PM > To: Discussion of IronPython > Subject: Re: [IronPython] CP Issue #21659: Subclassing unicode > > Jeff Hardy wrote: > > Hi, > > Is there any quick workaround for #21569? It's causing about a third > > of the Genshi errors I'm hitting. Trying to override __init__ in the > > subclass gives the same error. > > > > class Foo(unicode): > > def __init__(self, val): > > pass > > > > f = Foo(1) > > > > Traceback (most recent call last): > > File "foo.py", line 5, in __main__ > > TypeError: expected str, got int > > > > Wouldn't that particular example bomb out on CPython as well - you need > to override __new__ on the immutable builtins surely? > > Michael > > Thanks, > > Jeff > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Tue Mar 17 03:04:47 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 17 Mar 2009 02:04:47 +0000 Subject: [IronPython] CP Issue #21659: Subclassing unicode In-Reply-To: <350E7D38B6D819428718949920EC2355571C2023A8@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <49BEF683.7050206@voidspace.org.uk> <350E7D38B6D819428718949920EC2355571C2023A8@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <49BF053F.8000001@voidspace.org.uk> Dino Viehland wrote: > It works on CPython 2.6 at least. You should only have to override __new__ if you wanted to support different arguments than str/unicode.__new__ supports. > > Of course. D'oh - it was late, and is now even later. :-) Michael >> -----Original Message----- >> From: users-bounces at lists.ironpython.com [mailto:users- >> bounces at lists.ironpython.com] On Behalf Of Michael Foord >> Sent: Monday, March 16, 2009 6:02 PM >> To: Discussion of IronPython >> Subject: Re: [IronPython] CP Issue #21659: Subclassing unicode >> >> Jeff Hardy wrote: >> >>> Hi, >>> Is there any quick workaround for #21569? It's causing about a third >>> of the Genshi errors I'm hitting. Trying to override __init__ in the >>> subclass gives the same error. >>> >>> class Foo(unicode): >>> def __init__(self, val): >>> pass >>> >>> f = Foo(1) >>> >>> Traceback (most recent call last): >>> File "foo.py", line 5, in __main__ >>> TypeError: expected str, got int >>> >>> >> Wouldn't that particular example bomb out on CPython as well - you need >> to override __new__ on the immutable builtins surely? >> >> Michael >> >>> Thanks, >>> Jeff >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >> -- >> http://www.ironpythoninaction.com/ >> http://www.voidspace.org.uk/blog >> >> >> _______________________________________________ >> 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 > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From wim at 3win.be Tue Mar 17 08:22:29 2009 From: wim at 3win.be (Wim De Kimpe) Date: Tue, 17 Mar 2009 08:22:29 +0100 Subject: [IronPython] IronPython and COM object useage In-Reply-To: <350E7D38B6D819428718949920EC2355571C202019@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <004401c9a617$fdb361a0$f91a24e0$@be> <350E7D38B6D819428718949920EC2355571C202019@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <001a01c9a6d1$2190c040$64b240c0$@be> No, get_Initialized does not work. In fact, when I go through all the available methods or properties by using the tab key, I recognize none of the available methods, it seems as if it only exposes things from the 'GenericComObject', rather than all the ones I really need. And the -X:PreferComInteropAssembly doesn't make any change either. Any thoughts? From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: maandag 16 maart 2009 17:25 To: Discussion of IronPython Subject: Re: [IronPython] IronPython and COM object useage Does get_Initialized work? On 2.0 you might want to run w/ the -X:PreferComInteropAssembly option which will cause us to prefer the interop assembly over using normal COM dispatch. It'd still probably be interesting to track down the real issue here because that option is gone in 2.6. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Wim De Kimpe Sent: Monday, March 16, 2009 2:17 AM To: 'Discussion of IronPython' Subject: [IronPython] IronPython and COM object useage Hi all Not sure if this is the right forum, but I ask my question anyway. I would like to use IronPython for creating a hardware testing environment, consisting of a "Device Under Test" and some measurement equipment like a lab power supply and voltage meter and things like that. These instruments come with a library which enables communication via USB or GPIB. I have been using them in VBA for Excel, C# and VB.Net. Now when I try to do the same in IronPython, I do not seem to get it to work. I have copied the Interop assembly dll's from my example C# program into a separate directory, and then try to do the same steps as I do in the example. Here's the C# example : using System; using Agilent.AgilentU2741A.Interop; namespace Example1 { /// /// Agilent IVI-COM Driver Example Program /// /// Creates a driver object, reads a few Identity interface /// properties, and checks the instrument error queue. /// May include additional instrument specific functionality. /// /// Runs in simulation mode without an instrument. /// /// Requires a COM reference to the driver's type library. /// /// public class App { [STAThread] public static void Main(string[] args) { Agilent.AgilentU2741A.Interop.AgilentU2741A driver = null; try { // Create driver instance driver = new Agilent.AgilentU2741A.Interop.AgilentU2741AClass(); // Setup VISA resource descriptor. Ignored if Simulate=true string resourceDesc = "USB0::2391::18712::SN-4567890::0::INSTR"; // Setup IVI-defined initialization options string standardInitOptions = "QueryInstrStatus=true, Simulate=true"; // Setup driver-specific initialization options string driverSetupOptions = "DriverSetup= Model=, Trace=false"; driver.Initialize(resourceDesc, false, true, standardInitOptions + "," + driverSetupOptions); Console.WriteLine(" Driver Initialized"); // IIviDriverIdentity properties - Initialize required string instModel = driver.Identity.InstrumentModel; Console.WriteLine("InstrumentModel: {0}", instModel); string instFirmwareRevision = driver.Identity.InstrumentFirmwareRevision; Console.WriteLine("InstrumentFirmwareRevision: {0}", instFirmwareRevision); string instManufacturer = driver.Identity.InstrumentManufacturer; Console.WriteLine("InstrumentManufacturer: {0}\n", instManufacturer); // TODO: Exercise driver methods and properties // Check instrument for errors int errorNum = -1; string errorMsg = null; Console.WriteLine(""); while (errorNum != 0) { driver.Utility.ErrorQuery(ref errorNum, ref errorMsg); Console.WriteLine("ErrorQuery: {0}, {1}", errorNum, errorMsg); } } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { if (driver != null && driver.Initialized) { // Close driver driver.Close(); Console.WriteLine(" Driver Closed"); } } Console.WriteLine("\nDone - Press Enter to Exit"); Console.ReadLine(); } } } Here is what I try to do in Ironpython : >>> import sys >>> import clr >>> clr.AddReferenceToFile("Agilent.AgilentU2741A.Interop.dll") >>> from Agilent.AgilentU2741A.Interop import * >>> a = AgilentU2741AClass() >>> a >>> dir(a) ['AC', 'ACCurrent', 'ACVoltage', 'Abort', 'ActualRange', 'Advanced', 'Alpha', 'A pertureTime', 'ApertureTimeUnits', 'AutoRange', 'AutoZero', 'Cache', 'Calibratio n', 'Clear', 'ClearInterchangeWarnings', 'Close', 'Code', 'Configure', 'Configur eBandwidth', 'ConfigureServiceRequest', 'ConfigureSynchronization', 'Continuity' , 'Count', 'CreateObjRef', 'DCCurrent', 'DCVoltage', 'Delay', 'Description', 'Di ode', 'DirectIO', 'Disable', 'DriverOperation', 'DriverSetup', 'Equals', 'ErrorQ uery', 'FResistance', 'Fetch', 'FetchMultiPoint', 'FixedRefJunction', 'Frequency ', 'FrequencyMax', 'FrequencyMin', 'Function', 'GeographicalAddress', 'GetHashCo de', 'GetLifetimeService', 'GetNextCoercionRecord', 'GetNextInterchangeWarning', 'GetType', 'GroupCapabilities', 'IAgilentU2741AACVoltage_AutoRange', 'IAgilentU 2741AACVoltage_Configure', 'IAgilentU2741AACVoltage_Measure', 'IAgilentU2741AACV oltage_Range', 'IAgilentU2741AContinuity_Configure', 'IAgilentU2741AContinuity_M easure', 'IAgilentU2741ADCCurrent_AutoRange', 'IAgilentU2741ADCCurrent_AutoZero' , 'IAgilentU2741ADCCurrent_Range', 'IAgilentU2741ADCVoltage_AutoRange', 'IAgilen tU2741ADCVoltage_AutoZero', 'IAgilentU2741ADCVoltage_Configure', 'IAgilentU2741A DCVoltage_Measure', 'IAgilentU2741ADCVoltage_NPLC', 'IAgilentU2741ADCVoltage_Ran ge', 'IAgilentU2741ADCVoltage_Resolution', 'IAgilentU2741ADiode_Configure', 'IAg ilentU2741ADiode_Measure', 'IAgilentU2741AFResistance_AutoRange', 'IAgilentU2741 AFResistance_AutoZero', 'IAgilentU2741AFResistance_Configure', 'IAgilentU2741AFR esistance_Measure', 'IAgilentU2741AFResistance_NPLC', 'IAgilentU2741AFResistance _Range', 'IAgilentU2741AFResistance_Resolution', 'IAgilentU2741AFrequency_Config ure', 'IAgilentU2741AFrequency_Measure', 'IAgilentU2741AResistance_AutoRange', ' IAgilentU2741AResistance_AutoZero', 'IAgilentU2741AResistance_Configure', 'IAgil entU2741AResistance_Measure', 'IAgilentU2741AResistance_NPLC', 'IAgilentU2741ARe sistance_Range', 'IAgilentU2741AResistance_Resolution', 'IIviComponentIdentity_D escription', 'IIviComponentIdentity_Revision', 'IIviComponentIdentity_Vendor', ' IIviDmmAdvanced_ActualRange', 'IIviDmmAdvanced_ApertureTime', 'IIviDmmAdvanced_A pertureTimeUnits', 'IIviDmmAdvanced_AutoZero', 'IIviDmmAdvanced_PowerlineFrequen cy', 'IIviDmmMeasurement_Abort', 'IIviDmmMeasurement_Fetch', 'IIviDmmMeasurement _Initiate', 'IIviDmmMeasurement_IsOverRange', 'IIviDmmMeasurement_Read', 'IIviDm mMeasurement_SendSoftwareTrigger', 'IIviDmmMultiPoint_Count', 'IIviDmmRTD_Config ure', 'IIviDmmRTD_Resistance', 'IIviDmmThermistor_Resistance', 'IIviDmmTrigger_S lope', 'IIviDmmTrigger_Source', 'IIviDmm_Advanced', 'IIviDmm_Close', 'IIviDmm_Dr iverOperation', 'IIviDmm_Frequency', 'IIviDmm_Function', 'IIviDmm_Identity', 'II viDmm_Initialize', 'IIviDmm_Initialized', 'IIviDmm_Measurement', 'IIviDmm_Range' , 'IIviDmm_Resolution', 'IIviDmm_Temperature', 'IIviDmm_Trigger', 'IIviDmm_Utili ty', 'IIviDriver_Close', 'IIviDriver_DriverOperation', 'IIviDriver_Identity', 'I IviDriver_Initialize', 'IIviDriver_Initialized', 'IIviDriver_Utility', 'Identifi er', 'Identity', 'Initialize', 'InitializeLifetimeService', 'Initialized', 'Init iate', 'InstrumentFirmwareRevision', 'InstrumentManufacturer', 'InstrumentModel' , 'InterchangeCheck', 'InvalidateAllAttributes', 'IoResourceDescriptor', 'IsOver Range', 'LockObject', 'LogicalName', 'Measure', 'Measurement', 'MeasurementCompl ete', 'MemberwiseClone', 'Message', 'MultiPoint', 'NPLC', 'PerformADCCalibration ', 'PerformCalibration', 'PowerlineFrequency', 'Preset', 'QueryInstrumentStatus' , 'RTD', 'Range', 'RangeCheck', 'Read', 'ReadMultiPoint', 'ReadingUnits', 'Recor dCoercions', 'RefJunctionType', 'ReferenceEquals', 'Register', 'Reset', 'ResetCa librationCode', 'ResetInterchangeCheck', 'ResetWithDefaults', 'Resistance', 'Res olution', 'Revision', 'SampleCount', 'SampleInterval', 'SampleTrigger', 'Securit yEnable', 'SecurityState', 'SelfTest', 'SendSoftwareTrigger', 'SerialNumber', 'S erialPoll', 'Simulate', 'Slope', 'Source', 'SpecificationMajorVersion', 'Specifi cationMinorVersion', 'Status', 'StoreCalibrationConstants', 'SupportedInstrument Models', 'SynchronizationBusLine', 'SynchronizationState', 'System', 'Temperatur e', 'Thermistor', 'Thermocouple', 'TimeoutMilliseconds', 'ToString', 'Transducer Type', 'Trigger', 'Type', 'UnitTemperature', 'UnlockObject', 'Utility', 'Value', 'Vendor', 'VoltageRange', 'WaitForOperationComplete', '__class__', '__delattr__ ', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__ ', '__reduce_ex__', '__repr__', '__setattr__', '__str__'] ' object has no attribute 'Load' >>> a.Initialized() Traceback (most recent call last): File "", line 1, in AttributeError: 'GenericComObject' object has no attribute 'Initialized' >>> At this point I was expected to just get : FALSE. Also when I try to call the Initialize method (which seems to be imported correctly), I get the same error : unknown attribute. When I try to step through the available methods, I do not get any of the interesting ones, only the 'generic' ones. Also I have checked the Interop assembly using IL DASM, and there also I get the full list, so I think the interop assembly is ok. What do I do wrong? Is this because it is a COM object ? The IronPython tutorial is not very elaborate on what is actually happening during the exercice, so I am running a bit out of ideas here. Thanks wim -------------- next part -------------- An HTML attachment was scrubbed... URL: From wim at 3win.be Tue Mar 17 13:41:02 2009 From: wim at 3win.be (Wim De Kimpe) Date: Tue, 17 Mar 2009 13:41:02 +0100 Subject: [IronPython] IronPython and COM object useage In-Reply-To: <350E7D38B6D819428718949920EC2355571C202019@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <004401c9a617$fdb361a0$f91a24e0$@be> <350E7D38B6D819428718949920EC2355571C202019@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <005601c9a6fd$a1e90730$e5bb1590$@be> Hi all I have uninstalled the 2.0.1 version and used the version 1.1.2 instead. And there it works like a breeze. Can I enter a bugreport somewhere? wim From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: maandag 16 maart 2009 17:25 To: Discussion of IronPython Subject: Re: [IronPython] IronPython and COM object useage Does get_Initialized work? On 2.0 you might want to run w/ the -X:PreferComInteropAssembly option which will cause us to prefer the interop assembly over using normal COM dispatch. It'd still probably be interesting to track down the real issue here because that option is gone in 2.6. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Wim De Kimpe Sent: Monday, March 16, 2009 2:17 AM To: 'Discussion of IronPython' Subject: [IronPython] IronPython and COM object useage Hi all Not sure if this is the right forum, but I ask my question anyway. I would like to use IronPython for creating a hardware testing environment, consisting of a "Device Under Test" and some measurement equipment like a lab power supply and voltage meter and things like that. These instruments come with a library which enables communication via USB or GPIB. I have been using them in VBA for Excel, C# and VB.Net. Now when I try to do the same in IronPython, I do not seem to get it to work. I have copied the Interop assembly dll's from my example C# program into a separate directory, and then try to do the same steps as I do in the example. Here's the C# example : using System; using Agilent.AgilentU2741A.Interop; namespace Example1 { /// /// Agilent IVI-COM Driver Example Program /// /// Creates a driver object, reads a few Identity interface /// properties, and checks the instrument error queue. /// May include additional instrument specific functionality. /// /// Runs in simulation mode without an instrument. /// /// Requires a COM reference to the driver's type library. /// /// public class App { [STAThread] public static void Main(string[] args) { Agilent.AgilentU2741A.Interop.AgilentU2741A driver = null; try { // Create driver instance driver = new Agilent.AgilentU2741A.Interop.AgilentU2741AClass(); // Setup VISA resource descriptor. Ignored if Simulate=true string resourceDesc = "USB0::2391::18712::SN-4567890::0::INSTR"; // Setup IVI-defined initialization options string standardInitOptions = "QueryInstrStatus=true, Simulate=true"; // Setup driver-specific initialization options string driverSetupOptions = "DriverSetup= Model=, Trace=false"; driver.Initialize(resourceDesc, false, true, standardInitOptions + "," + driverSetupOptions); Console.WriteLine(" Driver Initialized"); // IIviDriverIdentity properties - Initialize required string instModel = driver.Identity.InstrumentModel; Console.WriteLine("InstrumentModel: {0}", instModel); string instFirmwareRevision = driver.Identity.InstrumentFirmwareRevision; Console.WriteLine("InstrumentFirmwareRevision: {0}", instFirmwareRevision); string instManufacturer = driver.Identity.InstrumentManufacturer; Console.WriteLine("InstrumentManufacturer: {0}\n", instManufacturer); // TODO: Exercise driver methods and properties // Check instrument for errors int errorNum = -1; string errorMsg = null; Console.WriteLine(""); while (errorNum != 0) { driver.Utility.ErrorQuery(ref errorNum, ref errorMsg); Console.WriteLine("ErrorQuery: {0}, {1}", errorNum, errorMsg); } } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { if (driver != null && driver.Initialized) { // Close driver driver.Close(); Console.WriteLine(" Driver Closed"); } } Console.WriteLine("\nDone - Press Enter to Exit"); Console.ReadLine(); } } } Here is what I try to do in Ironpython : >>> import sys >>> import clr >>> clr.AddReferenceToFile("Agilent.AgilentU2741A.Interop.dll") >>> from Agilent.AgilentU2741A.Interop import * >>> a = AgilentU2741AClass() >>> a >>> dir(a) ['AC', 'ACCurrent', 'ACVoltage', 'Abort', 'ActualRange', 'Advanced', 'Alpha', 'A pertureTime', 'ApertureTimeUnits', 'AutoRange', 'AutoZero', 'Cache', 'Calibratio n', 'Clear', 'ClearInterchangeWarnings', 'Close', 'Code', 'Configure', 'Configur eBandwidth', 'ConfigureServiceRequest', 'ConfigureSynchronization', 'Continuity' , 'Count', 'CreateObjRef', 'DCCurrent', 'DCVoltage', 'Delay', 'Description', 'Di ode', 'DirectIO', 'Disable', 'DriverOperation', 'DriverSetup', 'Equals', 'ErrorQ uery', 'FResistance', 'Fetch', 'FetchMultiPoint', 'FixedRefJunction', 'Frequency ', 'FrequencyMax', 'FrequencyMin', 'Function', 'GeographicalAddress', 'GetHashCo de', 'GetLifetimeService', 'GetNextCoercionRecord', 'GetNextInterchangeWarning', 'GetType', 'GroupCapabilities', 'IAgilentU2741AACVoltage_AutoRange', 'IAgilentU 2741AACVoltage_Configure', 'IAgilentU2741AACVoltage_Measure', 'IAgilentU2741AACV oltage_Range', 'IAgilentU2741AContinuity_Configure', 'IAgilentU2741AContinuity_M easure', 'IAgilentU2741ADCCurrent_AutoRange', 'IAgilentU2741ADCCurrent_AutoZero' , 'IAgilentU2741ADCCurrent_Range', 'IAgilentU2741ADCVoltage_AutoRange', 'IAgilen tU2741ADCVoltage_AutoZero', 'IAgilentU2741ADCVoltage_Configure', 'IAgilentU2741A DCVoltage_Measure', 'IAgilentU2741ADCVoltage_NPLC', 'IAgilentU2741ADCVoltage_Ran ge', 'IAgilentU2741ADCVoltage_Resolution', 'IAgilentU2741ADiode_Configure', 'IAg ilentU2741ADiode_Measure', 'IAgilentU2741AFResistance_AutoRange', 'IAgilentU2741 AFResistance_AutoZero', 'IAgilentU2741AFResistance_Configure', 'IAgilentU2741AFR esistance_Measure', 'IAgilentU2741AFResistance_NPLC', 'IAgilentU2741AFResistance _Range', 'IAgilentU2741AFResistance_Resolution', 'IAgilentU2741AFrequency_Config ure', 'IAgilentU2741AFrequency_Measure', 'IAgilentU2741AResistance_AutoRange', ' IAgilentU2741AResistance_AutoZero', 'IAgilentU2741AResistance_Configure', 'IAgil entU2741AResistance_Measure', 'IAgilentU2741AResistance_NPLC', 'IAgilentU2741ARe sistance_Range', 'IAgilentU2741AResistance_Resolution', 'IIviComponentIdentity_D escription', 'IIviComponentIdentity_Revision', 'IIviComponentIdentity_Vendor', ' IIviDmmAdvanced_ActualRange', 'IIviDmmAdvanced_ApertureTime', 'IIviDmmAdvanced_A pertureTimeUnits', 'IIviDmmAdvanced_AutoZero', 'IIviDmmAdvanced_PowerlineFrequen cy', 'IIviDmmMeasurement_Abort', 'IIviDmmMeasurement_Fetch', 'IIviDmmMeasurement _Initiate', 'IIviDmmMeasurement_IsOverRange', 'IIviDmmMeasurement_Read', 'IIviDm mMeasurement_SendSoftwareTrigger', 'IIviDmmMultiPoint_Count', 'IIviDmmRTD_Config ure', 'IIviDmmRTD_Resistance', 'IIviDmmThermistor_Resistance', 'IIviDmmTrigger_S lope', 'IIviDmmTrigger_Source', 'IIviDmm_Advanced', 'IIviDmm_Close', 'IIviDmm_Dr iverOperation', 'IIviDmm_Frequency', 'IIviDmm_Function', 'IIviDmm_Identity', 'II viDmm_Initialize', 'IIviDmm_Initialized', 'IIviDmm_Measurement', 'IIviDmm_Range' , 'IIviDmm_Resolution', 'IIviDmm_Temperature', 'IIviDmm_Trigger', 'IIviDmm_Utili ty', 'IIviDriver_Close', 'IIviDriver_DriverOperation', 'IIviDriver_Identity', 'I IviDriver_Initialize', 'IIviDriver_Initialized', 'IIviDriver_Utility', 'Identifi er', 'Identity', 'Initialize', 'InitializeLifetimeService', 'Initialized', 'Init iate', 'InstrumentFirmwareRevision', 'InstrumentManufacturer', 'InstrumentModel' , 'InterchangeCheck', 'InvalidateAllAttributes', 'IoResourceDescriptor', 'IsOver Range', 'LockObject', 'LogicalName', 'Measure', 'Measurement', 'MeasurementCompl ete', 'MemberwiseClone', 'Message', 'MultiPoint', 'NPLC', 'PerformADCCalibration ', 'PerformCalibration', 'PowerlineFrequency', 'Preset', 'QueryInstrumentStatus' , 'RTD', 'Range', 'RangeCheck', 'Read', 'ReadMultiPoint', 'ReadingUnits', 'Recor dCoercions', 'RefJunctionType', 'ReferenceEquals', 'Register', 'Reset', 'ResetCa librationCode', 'ResetInterchangeCheck', 'ResetWithDefaults', 'Resistance', 'Res olution', 'Revision', 'SampleCount', 'SampleInterval', 'SampleTrigger', 'Securit yEnable', 'SecurityState', 'SelfTest', 'SendSoftwareTrigger', 'SerialNumber', 'S erialPoll', 'Simulate', 'Slope', 'Source', 'SpecificationMajorVersion', 'Specifi cationMinorVersion', 'Status', 'StoreCalibrationConstants', 'SupportedInstrument Models', 'SynchronizationBusLine', 'SynchronizationState', 'System', 'Temperatur e', 'Thermistor', 'Thermocouple', 'TimeoutMilliseconds', 'ToString', 'Transducer Type', 'Trigger', 'Type', 'UnitTemperature', 'UnlockObject', 'Utility', 'Value', 'Vendor', 'VoltageRange', 'WaitForOperationComplete', '__class__', '__delattr__ ', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__ ', '__reduce_ex__', '__repr__', '__setattr__', '__str__'] ' object has no attribute 'Load' >>> a.Initialized() Traceback (most recent call last): File "", line 1, in AttributeError: 'GenericComObject' object has no attribute 'Initialized' >>> At this point I was expected to just get : FALSE. Also when I try to call the Initialize method (which seems to be imported correctly), I get the same error : unknown attribute. When I try to step through the available methods, I do not get any of the interesting ones, only the 'generic' ones. Also I have checked the Interop assembly using IL DASM, and there also I get the full list, so I think the interop assembly is ok. What do I do wrong? Is this because it is a COM object ? The IronPython tutorial is not very elaborate on what is actually happening during the exercice, so I am running a bit out of ideas here. Thanks wim -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex at moreati.org.uk Tue Mar 17 15:44:36 2009 From: alex at moreati.org.uk (Alex Willmer) Date: Tue, 17 Mar 2009 14:44:36 +0000 Subject: [IronPython] Revisiting interfaces and COM In-Reply-To: <350E7D38B6D819428718949920EC2355571C20200F@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <425e93af0903150440l349b52a4y6761324e081f682c@mail.gmail.com> <350E7D38B6D819428718949920EC2355571C20200F@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <425e93af0903170744x77f42e9dvf81d78136fdf86b4@mail.gmail.com> 2009/3/16 Dino Viehland : > The resolution of that bug was that we now expose explicitly > implemented interfaces automatically if there are no naming > conflicts. ?But with COM it's usually a different story - the > members should always just be there. > Do the interop libraries use explicit interface implementation > (if they did the method names would show up as something > like Namespace.IFoo.Bar in ildasm)? I'm afraid I can't answer that, my understanding of .NET interfaces is shaky, to say the least. Here, thanks to your ildasm tip, is what I know. 1. The interop library shows LayerFileClass to be defined as: .class public auto ansi import ESRI.ArcGIS.Carto.LayerFileClass extends [mscorlib]System.Object implements ESRI.ArcGIS.Carto.LayerFile, ESRI.ArcGIS.Carto.ILayerFile, [ESRI.ArcGIS.System]ESRI.ArcGIS.esriSystem.IDocumentVersion { .custom instance void [mscorlib]System.Runtime.InteropServices.ClassInterfaceAttribute::.ctor(int16) = ( 01 00 00 00 00 00 ) .custom instance void [mscorlib]System.Runtime.InteropServices.GuidAttribute::.ctor(string) = ( 01 00 24 44 44 43 32 33 34 36 44 2D 36 32 44 30 // ..$DDC2346D-62D0 2D 34 45 41 33 2D 41 42 34 32 2D 36 34 41 39 35 // -4EA3-AB42-64A95 35 37 31 35 37 43 36 00 00 ) // 57157C6.. .custom instance void [mscorlib]System.Runtime.InteropServices.TypeLibTypeAttribute::.ctor(int16) = ( 01 00 02 00 00 00 ) .method public specialname rtspecialname instance void .ctor() runtime managed internalcall { } // end of method LayerFileClass::.ctor ... .method public hidebysig newslot virtual instance void Open([in] string marshal( bstr) sFile) runtime managed internalcall { .override ESRI.ArcGIS.Carto.ILayerFile::Open } // end of method LayerFileClass::Open 2. Introspecting the instance of LayerFileClass suggests all is well, only once I try to access an attribute directly does an exception occur: IronPython 2.0 (2.0.0.0) on .NET 2.0.50727.3053 Type "help", "copyright", "credits" or "license" for more information. >>> import clr >>> clr.AddReference('ESRI.ArcGIS.System') >>> clr.AddReference('ESRI.ArcGIS.Carto') >>> clr.AddReference('ESRI.ArcGIS.Geodatabase') >>> >>> from ESRI.ArcGIS import esriSystem >>> from ESRI.ArcGIS import Carto >>> from ESRI.ArcGIS import Geodatabase >>> lf = Carto.LayerFileClass() >>> lf >>> dir(lf) ['Close', 'CreateObjRef', 'DocumentVersion', 'Equals', 'Filename', 'GetHashCode' , 'GetLifetimeService', 'GetType', 'InitializeLifetimeService', 'IsLayerFile', ' IsPresent', 'IsReadOnly', 'Layer', 'MemberwiseClone', 'New', 'Open', 'ReferenceE quals', 'ReplaceContents', 'Save', 'SaveAs', 'Thumbnail', 'ToString', '__class__ ', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__', '__new_ _', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__'] >>> lf.Open('h:\\test.lyr') Traceback (most recent call last): File "", line 1, in AttributeError: 'GenericComObject' object has no attribute 'Open' >>> Carto.ILayerFile.Open(lf, 'h:\\test.lyr') >>> From mchanner at gmail.com Tue Mar 17 15:49:03 2009 From: mchanner at gmail.com (Matt Channer) Date: Tue, 17 Mar 2009 14:49:03 +0000 Subject: [IronPython] Problem loading IronPython on Vista 64 Message-ID: <2cf17aed0903170749h3f2d7d6dq2178f822bcb45af1@mail.gmail.com> Hi! I am using IronPython 2.0.1 in a hosted environment (c# application running on 64 bit Vista). This works well when the application is compiled as a 32bit process, but I am getting the following error when running as an x64 process: *Could not load file or assembly 'Microsoft.Scripting, Version=0.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The specified module could not be found.* Fuslogvw is not helping at the moment (nothing is reported there). All ipy \ DLR assemblies are in a sub directory which is included in the assemblyBinding section of the apps config file (the error remains if they are in the exe directory as well). I tried a workaround (read: hack) by handling the AssemblyResolve event on the app domain and loading the files from a known directory. The problem I then encountered is an exception in the IronPython.Runtime.SysModule constructor (line 46) as it sets the prefix variable to the directory containing the assembly, which fails as the Location is empty. Below is the full exception: *Microsoft.Scripting.InvalidImplementationException: Type 'IronPython.Runtime.PythonContext' doesn't provide a suitable public constructor or its implementation is faulty: The type initializer for 'IronPython.Runtime.SysModule' threw an exception. ---> System.TypeInitializationException: The type initializer for 'IronPython.Runtime.SysModule' threw an exception. ---> System.ArgumentException: The path is not of a legal form. at System.IO.Path.NormalizePathFast(String path, Boolean fullCheck) at System.IO.Path.GetDirectoryName(String path) at IronPython.Runtime.SysModule..cctor() --- End of inner exception stack trace --- at IronPython.Runtime.SysModule.PerformModuleReload(PythonContext context, IAttributesCollection dict) at IronPython.Runtime.PythonContext..ctor(ScriptDomainManager manager, IDictionary`2 options) --- End of inner exception stack trace --- at Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type actualType, Object[] args) at Microsoft.Scripting.Runtime.LanguageConfiguration.LoadLanguageContext(ScriptDomainManager domainManager, Boolean& alreadyLoaded) at Microsoft.Scripting.Runtime.DlrConfiguration.LoadLanguageContext(ScriptDomainManager manager, LanguageConfiguration config) at Microsoft.Scripting.Runtime.DlrConfiguration.TryLoadLanguage(ScriptDomainManager manager, AssemblyQualifiedTypeName providerName, LanguageContext& language) at Microsoft.Scripting.Runtime.ScriptDomainManager.GetLanguageByTypeName(String providerAssemblyQualifiedTypeName) at Microsoft.Scripting.Hosting.ScriptRuntime.GetEngineByTypeName(String assemblyQualifiedTypeName) at IronPython.Hosting.Python.GetEngine(ScriptRuntime runtime) at Idbs.ActivityBase.DataImport.Scripting.ScriptingHosts.PythonScriptingHost.CreateEngine(String configurationFile) in C:\svn\xe\branches\anaconda\Shared\ImportProviders\PythonScriptingProvider\ScriptingHosts\PythonScriptingHost.cs:line 148 at Idbs.ActivityBase.DataImport.Scripting.ScriptingHosts.PythonScriptingHost.ScriptCanMapByIdentifiers(String configurationFile) in C:\svn\xe\branches\anaconda\Shared\ImportProviders\PythonScriptingProvider\ScriptingHosts\PythonScriptingHost.cs:line 52* So my first question: how come the assemblies are not being found? Secondly, is the exception in SysModule something that I should log? Kind Regards, Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Tue Mar 17 16:15:17 2009 From: dinov at microsoft.com (Dino Viehland) Date: Tue, 17 Mar 2009 08:15:17 -0700 Subject: [IronPython] IronPython and COM object useage In-Reply-To: <005601c9a6fd$a1e90730$e5bb1590$@be> References: <004401c9a617$fdb361a0$f91a24e0$@be> <350E7D38B6D819428718949920EC2355571C202019@NA-EXMSG-C102.redmond.corp.microsoft.com> <005601c9a6fd$a1e90730$e5bb1590$@be> Message-ID: <350E7D38B6D819428718949920EC2355571C2024B7@NA-EXMSG-C102.redmond.corp.microsoft.com> Yep, www.codeplex.com/IronPython is the right place to open a bug. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Wim De Kimpe Sent: Tuesday, March 17, 2009 5:41 AM To: 'Discussion of IronPython' Subject: Re: [IronPython] IronPython and COM object useage Hi all I have uninstalled the 2.0.1 version and used the version 1.1.2 instead. And there it works like a breeze... Can I enter a bugreport somewhere? wim From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: maandag 16 maart 2009 17:25 To: Discussion of IronPython Subject: Re: [IronPython] IronPython and COM object useage Does get_Initialized work? On 2.0 you might want to run w/ the -X:PreferComInteropAssembly option which will cause us to prefer the interop assembly over using normal COM dispatch. It'd still probably be interesting to track down the real issue here because that option is gone in 2.6. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Wim De Kimpe Sent: Monday, March 16, 2009 2:17 AM To: 'Discussion of IronPython' Subject: [IronPython] IronPython and COM object useage Hi all Not sure if this is the right forum, but I ask my question anyway. I would like to use IronPython for creating a hardware testing environment, consisting of a "Device Under Test" and some measurement equipment like a lab power supply and voltage meter and things like that. These instruments come with a library which enables communication via USB or GPIB. I have been using them in VBA for Excel, C# and VB.Net. Now when I try to do the same in IronPython, I do not seem to get it to work. I have copied the Interop assembly dll's from my example C# program into a separate directory, and then try to do the same steps as I do in the example. Here's the C# example : using System; using Agilent.AgilentU2741A.Interop; namespace Example1 { /// /// Agilent IVI-COM Driver Example Program /// /// Creates a driver object, reads a few Identity interface /// properties, and checks the instrument error queue. /// May include additional instrument specific functionality. /// /// Runs in simulation mode without an instrument. /// /// Requires a COM reference to the driver's type library. /// /// public class App { [STAThread] public static void Main(string[] args) { Agilent.AgilentU2741A.Interop.AgilentU2741A driver = null; try { // Create driver instance driver = new Agilent.AgilentU2741A.Interop.AgilentU2741AClass(); // Setup VISA resource descriptor. Ignored if Simulate=true string resourceDesc = "USB0::2391::18712::SN-4567890::0::INSTR"; // Setup IVI-defined initialization options string standardInitOptions = "QueryInstrStatus=true, Simulate=true"; // Setup driver-specific initialization options string driverSetupOptions = "DriverSetup= Model=, Trace=false"; driver.Initialize(resourceDesc, false, true, standardInitOptions + "," + driverSetupOptions); Console.WriteLine(" Driver Initialized"); // IIviDriverIdentity properties - Initialize required string instModel = driver.Identity.InstrumentModel; Console.WriteLine("InstrumentModel: {0}", instModel); string instFirmwareRevision = driver.Identity.InstrumentFirmwareRevision; Console.WriteLine("InstrumentFirmwareRevision: {0}", instFirmwareRevision); string instManufacturer = driver.Identity.InstrumentManufacturer; Console.WriteLine("InstrumentManufacturer: {0}\n", instManufacturer); // TODO: Exercise driver methods and properties // Check instrument for errors int errorNum = -1; string errorMsg = null; Console.WriteLine(""); while (errorNum != 0) { driver.Utility.ErrorQuery(ref errorNum, ref errorMsg); Console.WriteLine("ErrorQuery: {0}, {1}", errorNum, errorMsg); } } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { if (driver != null && driver.Initialized) { // Close driver driver.Close(); Console.WriteLine(" Driver Closed"); } } Console.WriteLine("\nDone - Press Enter to Exit"); Console.ReadLine(); } } } Here is what I try to do in Ironpython : >>> import sys >>> import clr >>> clr.AddReferenceToFile("Agilent.AgilentU2741A.Interop.dll") >>> from Agilent.AgilentU2741A.Interop import * >>> a = AgilentU2741AClass() >>> a >>> dir(a) ['AC', 'ACCurrent', 'ACVoltage', 'Abort', 'ActualRange', 'Advanced', 'Alpha', 'A pertureTime', 'ApertureTimeUnits', 'AutoRange', 'AutoZero', 'Cache', 'Calibratio n', 'Clear', 'ClearInterchangeWarnings', 'Close', 'Code', 'Configure', 'Configur eBandwidth', 'ConfigureServiceRequest', 'ConfigureSynchronization', 'Continuity' , 'Count', 'CreateObjRef', 'DCCurrent', 'DCVoltage', 'Delay', 'Description', 'Di ode', 'DirectIO', 'Disable', 'DriverOperation', 'DriverSetup', 'Equals', 'ErrorQ uery', 'FResistance', 'Fetch', 'FetchMultiPoint', 'FixedRefJunction', 'Frequency ', 'FrequencyMax', 'FrequencyMin', 'Function', 'GeographicalAddress', 'GetHashCo de', 'GetLifetimeService', 'GetNextCoercionRecord', 'GetNextInterchangeWarning', 'GetType', 'GroupCapabilities', 'IAgilentU2741AACVoltage_AutoRange', 'IAgilentU 2741AACVoltage_Configure', 'IAgilentU2741AACVoltage_Measure', 'IAgilentU2741AACV oltage_Range', 'IAgilentU2741AContinuity_Configure', 'IAgilentU2741AContinuity_M easure', 'IAgilentU2741ADCCurrent_AutoRange', 'IAgilentU2741ADCCurrent_AutoZero' , 'IAgilentU2741ADCCurrent_Range', 'IAgilentU2741ADCVoltage_AutoRange', 'IAgilen tU2741ADCVoltage_AutoZero', 'IAgilentU2741ADCVoltage_Configure', 'IAgilentU2741A DCVoltage_Measure', 'IAgilentU2741ADCVoltage_NPLC', 'IAgilentU2741ADCVoltage_Ran ge', 'IAgilentU2741ADCVoltage_Resolution', 'IAgilentU2741ADiode_Configure', 'IAg ilentU2741ADiode_Measure', 'IAgilentU2741AFResistance_AutoRange', 'IAgilentU2741 AFResistance_AutoZero', 'IAgilentU2741AFResistance_Configure', 'IAgilentU2741AFR esistance_Measure', 'IAgilentU2741AFResistance_NPLC', 'IAgilentU2741AFResistance _Range', 'IAgilentU2741AFResistance_Resolution', 'IAgilentU2741AFrequency_Config ure', 'IAgilentU2741AFrequency_Measure', 'IAgilentU2741AResistance_AutoRange', ' IAgilentU2741AResistance_AutoZero', 'IAgilentU2741AResistance_Configure', 'IAgil entU2741AResistance_Measure', 'IAgilentU2741AResistance_NPLC', 'IAgilentU2741ARe sistance_Range', 'IAgilentU2741AResistance_Resolution', 'IIviComponentIdentity_D escription', 'IIviComponentIdentity_Revision', 'IIviComponentIdentity_Vendor', ' IIviDmmAdvanced_ActualRange', 'IIviDmmAdvanced_ApertureTime', 'IIviDmmAdvanced_A pertureTimeUnits', 'IIviDmmAdvanced_AutoZero', 'IIviDmmAdvanced_PowerlineFrequen cy', 'IIviDmmMeasurement_Abort', 'IIviDmmMeasurement_Fetch', 'IIviDmmMeasurement _Initiate', 'IIviDmmMeasurement_IsOverRange', 'IIviDmmMeasurement_Read', 'IIviDm mMeasurement_SendSoftwareTrigger', 'IIviDmmMultiPoint_Count', 'IIviDmmRTD_Config ure', 'IIviDmmRTD_Resistance', 'IIviDmmThermistor_Resistance', 'IIviDmmTrigger_S lope', 'IIviDmmTrigger_Source', 'IIviDmm_Advanced', 'IIviDmm_Close', 'IIviDmm_Dr iverOperation', 'IIviDmm_Frequency', 'IIviDmm_Function', 'IIviDmm_Identity', 'II viDmm_Initialize', 'IIviDmm_Initialized', 'IIviDmm_Measurement', 'IIviDmm_Range' , 'IIviDmm_Resolution', 'IIviDmm_Temperature', 'IIviDmm_Trigger', 'IIviDmm_Utili ty', 'IIviDriver_Close', 'IIviDriver_DriverOperation', 'IIviDriver_Identity', 'I IviDriver_Initialize', 'IIviDriver_Initialized', 'IIviDriver_Utility', 'Identifi er', 'Identity', 'Initialize', 'InitializeLifetimeService', 'Initialized', 'Init iate', 'InstrumentFirmwareRevision', 'InstrumentManufacturer', 'InstrumentModel' , 'InterchangeCheck', 'InvalidateAllAttributes', 'IoResourceDescriptor', 'IsOver Range', 'LockObject', 'LogicalName', 'Measure', 'Measurement', 'MeasurementCompl ete', 'MemberwiseClone', 'Message', 'MultiPoint', 'NPLC', 'PerformADCCalibration ', 'PerformCalibration', 'PowerlineFrequency', 'Preset', 'QueryInstrumentStatus' , 'RTD', 'Range', 'RangeCheck', 'Read', 'ReadMultiPoint', 'ReadingUnits', 'Recor dCoercions', 'RefJunctionType', 'ReferenceEquals', 'Register', 'Reset', 'ResetCa librationCode', 'ResetInterchangeCheck', 'ResetWithDefaults', 'Resistance', 'Res olution', 'Revision', 'SampleCount', 'SampleInterval', 'SampleTrigger', 'Securit yEnable', 'SecurityState', 'SelfTest', 'SendSoftwareTrigger', 'SerialNumber', 'S erialPoll', 'Simulate', 'Slope', 'Source', 'SpecificationMajorVersion', 'Specifi cationMinorVersion', 'Status', 'StoreCalibrationConstants', 'SupportedInstrument Models', 'SynchronizationBusLine', 'SynchronizationState', 'System', 'Temperatur e', 'Thermistor', 'Thermocouple', 'TimeoutMilliseconds', 'ToString', 'Transducer Type', 'Trigger', 'Type', 'UnitTemperature', 'UnlockObject', 'Utility', 'Value', 'Vendor', 'VoltageRange', 'WaitForOperationComplete', '__class__', '__delattr__ ', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__ ', '__reduce_ex__', '__repr__', '__setattr__', '__str__'] ' object has no attribute 'Load' >>> a.Initialized() Traceback (most recent call last): File "", line 1, in AttributeError: 'GenericComObject' object has no attribute 'Initialized' >>> At this point I was expected to just get : FALSE. Also when I try to call the Initialize method (which seems to be imported correctly), I get the same error : unknown attribute. When I try to step through the available methods, I do not get any of the interesting ones, only the 'generic' ones. Also I have checked the Interop assembly using IL DASM, and there also I get the full list, so I think the interop assembly is ok. What do I do wrong? Is this because it is a COM object ? The IronPython tutorial is not very elaborate on what is actually happening during the exercice, so I am running a bit out of ideas here... Thanks wim -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Tue Mar 17 16:16:49 2009 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Tue, 17 Mar 2009 08:16:49 -0700 Subject: [IronPython] Problem loading IronPython on Vista 64 In-Reply-To: <2cf17aed0903170749h3f2d7d6dq2178f822bcb45af1@mail.gmail.com> References: <2cf17aed0903170749h3f2d7d6dq2178f822bcb45af1@mail.gmail.com> Message-ID: I don't know why there would be a difference between 32-bit and 64-bit, but do you possibly have a copy of any of the IronPython bits in your GAC? As to the "invalid path" error, you're probably getting it from the line prefix = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); which is consistent with some kind of assembly-loading weirdness. Odd that nothing shows in fuslogvw. 2009/3/17 Matt Channer > Hi! > > I am using IronPython 2.0.1 in a hosted environment (c# application running > on 64 bit Vista). This works well when the application is compiled as a > 32bit process, but I am getting the following error when running as an x64 > process: > > *Could not load file or assembly 'Microsoft.Scripting, Version=0.9.0.0, > Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its > dependencies. The specified module could not be found.* > > Fuslogvw is not helping at the moment (nothing is reported there). All ipy > \ DLR assemblies are in a sub directory which is included in the > assemblyBinding section of the apps config file (the error remains if they > are in the exe directory as well). > > I tried a workaround (read: hack) by handling the AssemblyResolve event on > the app domain and loading the files from a known directory. The problem I > then encountered is an exception in the IronPython.Runtime.SysModule > constructor (line 46) as it sets the prefix variable to the directory > containing the assembly, which fails as the Location is empty. > > Below is the full exception: > > *Microsoft.Scripting.InvalidImplementationException: Type > 'IronPython.Runtime.PythonContext' doesn't provide a suitable public > constructor or its implementation is faulty: The type initializer for > 'IronPython.Runtime.SysModule' threw an exception. ---> > System.TypeInitializationException: The type initializer for > 'IronPython.Runtime.SysModule' threw an exception. ---> > System.ArgumentException: The path is not of a legal form. > at System.IO.Path.NormalizePathFast(String path, Boolean fullCheck) > at System.IO.Path.GetDirectoryName(String path) > at IronPython.Runtime.SysModule..cctor() > --- End of inner exception stack trace --- > at IronPython.Runtime.SysModule.PerformModuleReload(PythonContext > context, IAttributesCollection dict) > at IronPython.Runtime.PythonContext..ctor(ScriptDomainManager manager, > IDictionary`2 options) > --- End of inner exception stack trace --- > at Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type > actualType, Object[] args) > at > Microsoft.Scripting.Runtime.LanguageConfiguration.LoadLanguageContext(ScriptDomainManager > domainManager, Boolean& alreadyLoaded) > at > Microsoft.Scripting.Runtime.DlrConfiguration.LoadLanguageContext(ScriptDomainManager > manager, LanguageConfiguration config) > at > Microsoft.Scripting.Runtime.DlrConfiguration.TryLoadLanguage(ScriptDomainManager > manager, AssemblyQualifiedTypeName providerName, LanguageContext& language) > at > Microsoft.Scripting.Runtime.ScriptDomainManager.GetLanguageByTypeName(String > providerAssemblyQualifiedTypeName) > at Microsoft.Scripting.Hosting.ScriptRuntime.GetEngineByTypeName(String > assemblyQualifiedTypeName) > at IronPython.Hosting.Python.GetEngine(ScriptRuntime runtime) > at > Idbs.ActivityBase.DataImport.Scripting.ScriptingHosts.PythonScriptingHost.CreateEngine(String > configurationFile) in > C:\svn\xe\branches\anaconda\Shared\ImportProviders\PythonScriptingProvider\ScriptingHosts\PythonScriptingHost.cs:line > 148 > at > Idbs.ActivityBase.DataImport.Scripting.ScriptingHosts.PythonScriptingHost.ScriptCanMapByIdentifiers(String > configurationFile) in > C:\svn\xe\branches\anaconda\Shared\ImportProviders\PythonScriptingProvider\ScriptingHosts\PythonScriptingHost.cs:line > 52* > > So my first question: how come the assemblies are not being found? > Secondly, is the exception in SysModule something that I should log? > > Kind Regards, > > Matt > > _______________________________________________ > 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 mchanner at gmail.com Tue Mar 17 16:51:17 2009 From: mchanner at gmail.com (Matt Channer) Date: Tue, 17 Mar 2009 15:51:17 +0000 Subject: [IronPython] Problem loading IronPython on Vista 64 In-Reply-To: References: <2cf17aed0903170749h3f2d7d6dq2178f822bcb45af1@mail.gmail.com> Message-ID: <2cf17aed0903170851n34910a25w772f04a0db41925@mail.gmail.com> Hi, The machine is pretty clean and has no dlr / ipy assemblies in the gac. fuslogvw is not showing anything for me at the moment so I need to investigate that a bit more. I think the error in the SysModule constructor is because I used AppDomain.CurrentDomain.Load(byte[]) to try and work around the original issue (this was done in an AssemblyResolve event handler). Thanks, Matt 2009/3/17 Curt Hagenlocher > I don't know why there would be a difference between 32-bit and 64-bit, but > do you possibly have a copy of any of the IronPython bits in your GAC? As > to the "invalid path" error, you're probably getting it from the line > > prefix = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); > > which is consistent with some kind of assembly-loading weirdness. Odd that > nothing shows in fuslogvw. > > 2009/3/17 Matt Channer > >> Hi! >> >> I am using IronPython 2.0.1 in a hosted environment (c# application >> running on 64 bit Vista). This works well when the application is compiled >> as a 32bit process, but I am getting the following error when running as an >> x64 process: >> >> *Could not load file or assembly 'Microsoft.Scripting, Version=0.9.0.0, >> Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its >> dependencies. The specified module could not be found.* >> >> Fuslogvw is not helping at the moment (nothing is reported there). All >> ipy \ DLR assemblies are in a sub directory which is included in the >> assemblyBinding section of the apps config file (the error remains if they >> are in the exe directory as well). >> >> I tried a workaround (read: hack) by handling the AssemblyResolve event on >> the app domain and loading the files from a known directory. The problem I >> then encountered is an exception in the IronPython.Runtime.SysModule >> constructor (line 46) as it sets the prefix variable to the directory >> containing the assembly, which fails as the Location is empty. >> >> Below is the full exception: >> >> *Microsoft.Scripting.InvalidImplementationException: Type >> 'IronPython.Runtime.PythonContext' doesn't provide a suitable public >> constructor or its implementation is faulty: The type initializer for >> 'IronPython.Runtime.SysModule' threw an exception. ---> >> System.TypeInitializationException: The type initializer for >> 'IronPython.Runtime.SysModule' threw an exception. ---> >> System.ArgumentException: The path is not of a legal form. >> at System.IO.Path.NormalizePathFast(String path, Boolean fullCheck) >> at System.IO.Path.GetDirectoryName(String path) >> at IronPython.Runtime.SysModule..cctor() >> --- End of inner exception stack trace --- >> at IronPython.Runtime.SysModule.PerformModuleReload(PythonContext >> context, IAttributesCollection dict) >> at IronPython.Runtime.PythonContext..ctor(ScriptDomainManager manager, >> IDictionary`2 options) >> --- End of inner exception stack trace --- >> at Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type >> actualType, Object[] args) >> at >> Microsoft.Scripting.Runtime.LanguageConfiguration.LoadLanguageContext(ScriptDomainManager >> domainManager, Boolean& alreadyLoaded) >> at >> Microsoft.Scripting.Runtime.DlrConfiguration.LoadLanguageContext(ScriptDomainManager >> manager, LanguageConfiguration config) >> at >> Microsoft.Scripting.Runtime.DlrConfiguration.TryLoadLanguage(ScriptDomainManager >> manager, AssemblyQualifiedTypeName providerName, LanguageContext& language) >> at >> Microsoft.Scripting.Runtime.ScriptDomainManager.GetLanguageByTypeName(String >> providerAssemblyQualifiedTypeName) >> at Microsoft.Scripting.Hosting.ScriptRuntime.GetEngineByTypeName(String >> assemblyQualifiedTypeName) >> at IronPython.Hosting.Python.GetEngine(ScriptRuntime runtime) >> at >> Idbs.ActivityBase.DataImport.Scripting.ScriptingHosts.PythonScriptingHost.CreateEngine(String >> configurationFile) in >> C:\svn\xe\branches\anaconda\Shared\ImportProviders\PythonScriptingProvider\ScriptingHosts\PythonScriptingHost.cs:line >> 148 >> at >> Idbs.ActivityBase.DataImport.Scripting.ScriptingHosts.PythonScriptingHost.ScriptCanMapByIdentifiers(String >> configurationFile) in >> C:\svn\xe\branches\anaconda\Shared\ImportProviders\PythonScriptingProvider\ScriptingHosts\PythonScriptingHost.cs:line >> 52* >> >> So my first question: how come the assemblies are not being found? >> Secondly, is the exception in SysModule something that I should log? >> >> Kind Regards, >> >> Matt >> >> _______________________________________________ >> 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 curt at hagenlocher.org Tue Mar 17 17:05:07 2009 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Tue, 17 Mar 2009 09:05:07 -0700 Subject: [IronPython] Problem loading IronPython on Vista 64 In-Reply-To: <2cf17aed0903170851n34910a25w772f04a0db41925@mail.gmail.com> References: <2cf17aed0903170749h3f2d7d6dq2178f822bcb45af1@mail.gmail.com> <2cf17aed0903170851n34910a25w772f04a0db41925@mail.gmail.com> Message-ID: Your explanation for the SysModule error sounds right -- if you use Assembly.LoadFile instead, you'll probably avoid that exception. What settings are you using in fuslogvw? 2009/3/17 Matt Channer > Hi, > > The machine is pretty clean and has no dlr / ipy assemblies in the gac. > > fuslogvw is not showing anything for me at the moment so I need to > investigate that a bit more. > > I think the error in the SysModule constructor is because I used > AppDomain.CurrentDomain.Load(byte[]) to try and work around the original > issue (this was done in an AssemblyResolve event handler). > > Thanks, > > Matt > > > 2009/3/17 Curt Hagenlocher > > I don't know why there would be a difference between 32-bit and 64-bit, but >> do you possibly have a copy of any of the IronPython bits in your GAC? As >> to the "invalid path" error, you're probably getting it from the line >> >> prefix = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); >> >> which is consistent with some kind of assembly-loading weirdness. Odd >> that nothing shows in fuslogvw. >> >> 2009/3/17 Matt Channer >> >>> Hi! >>> >>> I am using IronPython 2.0.1 in a hosted environment (c# application >>> running on 64 bit Vista). This works well when the application is compiled >>> as a 32bit process, but I am getting the following error when running as an >>> x64 process: >>> >>> *Could not load file or assembly 'Microsoft.Scripting, Version=0.9.0.0, >>> Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its >>> dependencies. The specified module could not be found.* >>> >>> Fuslogvw is not helping at the moment (nothing is reported there). All >>> ipy \ DLR assemblies are in a sub directory which is included in the >>> assemblyBinding section of the apps config file (the error remains if they >>> are in the exe directory as well). >>> >>> I tried a workaround (read: hack) by handling the AssemblyResolve event >>> on the app domain and loading the files from a known directory. The problem >>> I then encountered is an exception in the IronPython.Runtime.SysModule >>> constructor (line 46) as it sets the prefix variable to the directory >>> containing the assembly, which fails as the Location is empty. >>> >>> Below is the full exception: >>> >>> *Microsoft.Scripting.InvalidImplementationException: Type >>> 'IronPython.Runtime.PythonContext' doesn't provide a suitable public >>> constructor or its implementation is faulty: The type initializer for >>> 'IronPython.Runtime.SysModule' threw an exception. ---> >>> System.TypeInitializationException: The type initializer for >>> 'IronPython.Runtime.SysModule' threw an exception. ---> >>> System.ArgumentException: The path is not of a legal form. >>> at System.IO.Path.NormalizePathFast(String path, Boolean fullCheck) >>> at System.IO.Path.GetDirectoryName(String path) >>> at IronPython.Runtime.SysModule..cctor() >>> --- End of inner exception stack trace --- >>> at IronPython.Runtime.SysModule.PerformModuleReload(PythonContext >>> context, IAttributesCollection dict) >>> at IronPython.Runtime.PythonContext..ctor(ScriptDomainManager manager, >>> IDictionary`2 options) >>> --- End of inner exception stack trace --- >>> at Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type >>> actualType, Object[] args) >>> at >>> Microsoft.Scripting.Runtime.LanguageConfiguration.LoadLanguageContext(ScriptDomainManager >>> domainManager, Boolean& alreadyLoaded) >>> at >>> Microsoft.Scripting.Runtime.DlrConfiguration.LoadLanguageContext(ScriptDomainManager >>> manager, LanguageConfiguration config) >>> at >>> Microsoft.Scripting.Runtime.DlrConfiguration.TryLoadLanguage(ScriptDomainManager >>> manager, AssemblyQualifiedTypeName providerName, LanguageContext& language) >>> at >>> Microsoft.Scripting.Runtime.ScriptDomainManager.GetLanguageByTypeName(String >>> providerAssemblyQualifiedTypeName) >>> at >>> Microsoft.Scripting.Hosting.ScriptRuntime.GetEngineByTypeName(String >>> assemblyQualifiedTypeName) >>> at IronPython.Hosting.Python.GetEngine(ScriptRuntime runtime) >>> at >>> Idbs.ActivityBase.DataImport.Scripting.ScriptingHosts.PythonScriptingHost.CreateEngine(String >>> configurationFile) in >>> C:\svn\xe\branches\anaconda\Shared\ImportProviders\PythonScriptingProvider\ScriptingHosts\PythonScriptingHost.cs:line >>> 148 >>> at >>> Idbs.ActivityBase.DataImport.Scripting.ScriptingHosts.PythonScriptingHost.ScriptCanMapByIdentifiers(String >>> configurationFile) in >>> C:\svn\xe\branches\anaconda\Shared\ImportProviders\PythonScriptingProvider\ScriptingHosts\PythonScriptingHost.cs:line >>> 52* >>> >>> So my first question: how come the assemblies are not being found? >>> Secondly, is the exception in SysModule something that I should log? >>> >>> Kind Regards, >>> >>> Matt >>> >>> _______________________________________________ >>> 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mchanner at gmail.com Tue Mar 17 17:16:40 2009 From: mchanner at gmail.com (Matt Channer) Date: Tue, 17 Mar 2009 16:16:40 +0000 Subject: [IronPython] Problem loading IronPython on Vista 64 In-Reply-To: References: <2cf17aed0903170749h3f2d7d6dq2178f822bcb45af1@mail.gmail.com> <2cf17aed0903170851n34910a25w772f04a0db41925@mail.gmail.com> Message-ID: <2cf17aed0903170916k480a3eadle9a090823fc96b7@mail.gmail.com> I did try Assembly.LoadFile but this returned null, maybe for the same reason that I was seeing initially - whatever that is :-) Fuslogvw now seems to be reporting binding failures (the setting I have is to Log bind failures to disk). Interestingly, none of the dlr / ipy assemblies are being logged here. I will write a simple test app to see if that exhibits the same problem. Thanks for the help! Matt 2009/3/17 Curt Hagenlocher > Your explanation for the SysModule error sounds right -- if you use > Assembly.LoadFile instead, you'll probably avoid that exception. What > settings are you using in fuslogvw? > > > 2009/3/17 Matt Channer > >> Hi, >> >> The machine is pretty clean and has no dlr / ipy assemblies in the gac. >> >> fuslogvw is not showing anything for me at the moment so I need to >> investigate that a bit more. >> >> I think the error in the SysModule constructor is because I used >> AppDomain.CurrentDomain.Load(byte[]) to try and work around the original >> issue (this was done in an AssemblyResolve event handler). >> >> Thanks, >> >> Matt >> >> >> 2009/3/17 Curt Hagenlocher >> >> I don't know why there would be a difference between 32-bit and 64-bit, >>> but do you possibly have a copy of any of the IronPython bits in your GAC? >>> As to the "invalid path" error, you're probably getting it from the line >>> >>> prefix = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); >>> >>> which is consistent with some kind of assembly-loading weirdness. Odd >>> that nothing shows in fuslogvw. >>> >>> 2009/3/17 Matt Channer >>> >>>> Hi! >>>> >>>> I am using IronPython 2.0.1 in a hosted environment (c# application >>>> running on 64 bit Vista). This works well when the application is compiled >>>> as a 32bit process, but I am getting the following error when running as an >>>> x64 process: >>>> >>>> *Could not load file or assembly 'Microsoft.Scripting, Version=0.9.0.0, >>>> Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its >>>> dependencies. The specified module could not be found.* >>>> >>>> Fuslogvw is not helping at the moment (nothing is reported there). All >>>> ipy \ DLR assemblies are in a sub directory which is included in the >>>> assemblyBinding section of the apps config file (the error remains if they >>>> are in the exe directory as well). >>>> >>>> I tried a workaround (read: hack) by handling the AssemblyResolve event >>>> on the app domain and loading the files from a known directory. The problem >>>> I then encountered is an exception in the IronPython.Runtime.SysModule >>>> constructor (line 46) as it sets the prefix variable to the directory >>>> containing the assembly, which fails as the Location is empty. >>>> >>>> Below is the full exception: >>>> >>>> *Microsoft.Scripting.InvalidImplementationException: Type >>>> 'IronPython.Runtime.PythonContext' doesn't provide a suitable public >>>> constructor or its implementation is faulty: The type initializer for >>>> 'IronPython.Runtime.SysModule' threw an exception. ---> >>>> System.TypeInitializationException: The type initializer for >>>> 'IronPython.Runtime.SysModule' threw an exception. ---> >>>> System.ArgumentException: The path is not of a legal form. >>>> at System.IO.Path.NormalizePathFast(String path, Boolean fullCheck) >>>> at System.IO.Path.GetDirectoryName(String path) >>>> at IronPython.Runtime.SysModule..cctor() >>>> --- End of inner exception stack trace --- >>>> at IronPython.Runtime.SysModule.PerformModuleReload(PythonContext >>>> context, IAttributesCollection dict) >>>> at IronPython.Runtime.PythonContext..ctor(ScriptDomainManager >>>> manager, IDictionary`2 options) >>>> --- End of inner exception stack trace --- >>>> at Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type >>>> actualType, Object[] args) >>>> at >>>> Microsoft.Scripting.Runtime.LanguageConfiguration.LoadLanguageContext(ScriptDomainManager >>>> domainManager, Boolean& alreadyLoaded) >>>> at >>>> Microsoft.Scripting.Runtime.DlrConfiguration.LoadLanguageContext(ScriptDomainManager >>>> manager, LanguageConfiguration config) >>>> at >>>> Microsoft.Scripting.Runtime.DlrConfiguration.TryLoadLanguage(ScriptDomainManager >>>> manager, AssemblyQualifiedTypeName providerName, LanguageContext& language) >>>> at >>>> Microsoft.Scripting.Runtime.ScriptDomainManager.GetLanguageByTypeName(String >>>> providerAssemblyQualifiedTypeName) >>>> at >>>> Microsoft.Scripting.Hosting.ScriptRuntime.GetEngineByTypeName(String >>>> assemblyQualifiedTypeName) >>>> at IronPython.Hosting.Python.GetEngine(ScriptRuntime runtime) >>>> at >>>> Idbs.ActivityBase.DataImport.Scripting.ScriptingHosts.PythonScriptingHost.CreateEngine(String >>>> configurationFile) in >>>> C:\svn\xe\branches\anaconda\Shared\ImportProviders\PythonScriptingProvider\ScriptingHosts\PythonScriptingHost.cs:line >>>> 148 >>>> at >>>> Idbs.ActivityBase.DataImport.Scripting.ScriptingHosts.PythonScriptingHost.ScriptCanMapByIdentifiers(String >>>> configurationFile) in >>>> C:\svn\xe\branches\anaconda\Shared\ImportProviders\PythonScriptingProvider\ScriptingHosts\PythonScriptingHost.cs:line >>>> 52* >>>> >>>> So my first question: how come the assemblies are not being found? >>>> Secondly, is the exception in SysModule something that I should log? >>>> >>>> Kind Regards, >>>> >>>> Matt >>>> >>>> _______________________________________________ >>>> 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Tue Mar 17 17:24:37 2009 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Tue, 17 Mar 2009 09:24:37 -0700 Subject: [IronPython] Problem loading IronPython on Vista 64 In-Reply-To: <2cf17aed0903170916k480a3eadle9a090823fc96b7@mail.gmail.com> References: <2cf17aed0903170749h3f2d7d6dq2178f822bcb45af1@mail.gmail.com> <2cf17aed0903170851n34910a25w772f04a0db41925@mail.gmail.com> <2cf17aed0903170916k480a3eadle9a090823fc96b7@mail.gmail.com> Message-ID: You might want to consider logging all binds and not just failures. 2009/3/17 Matt Channer > I did try Assembly.LoadFile but this returned null, maybe for the same > reason that I was seeing initially - whatever that is :-) > > Fuslogvw now seems to be reporting binding failures (the setting I have is > to Log bind failures to disk). Interestingly, none of the dlr / ipy > assemblies are being logged here. > > I will write a simple test app to see if that exhibits the same problem. > > Thanks for the help! > > > Matt > > > > 2009/3/17 Curt Hagenlocher > >> Your explanation for the SysModule error sounds right -- if you use >> Assembly.LoadFile instead, you'll probably avoid that exception. What >> settings are you using in fuslogvw? >> >> >> 2009/3/17 Matt Channer >> >>> Hi, >>> >>> The machine is pretty clean and has no dlr / ipy assemblies in the gac. >>> >>> fuslogvw is not showing anything for me at the moment so I need to >>> investigate that a bit more. >>> >>> I think the error in the SysModule constructor is because I used >>> AppDomain.CurrentDomain.Load(byte[]) to try and work around the original >>> issue (this was done in an AssemblyResolve event handler). >>> >>> Thanks, >>> >>> Matt >>> >>> >>> 2009/3/17 Curt Hagenlocher >>> >>> I don't know why there would be a difference between 32-bit and 64-bit, >>>> but do you possibly have a copy of any of the IronPython bits in your GAC? >>>> As to the "invalid path" error, you're probably getting it from the line >>>> >>>> prefix = >>>> Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); >>>> >>>> which is consistent with some kind of assembly-loading weirdness. Odd >>>> that nothing shows in fuslogvw. >>>> >>>> 2009/3/17 Matt Channer >>>> >>>>> Hi! >>>>> >>>>> I am using IronPython 2.0.1 in a hosted environment (c# application >>>>> running on 64 bit Vista). This works well when the application is compiled >>>>> as a 32bit process, but I am getting the following error when running as an >>>>> x64 process: >>>>> >>>>> *Could not load file or assembly 'Microsoft.Scripting, >>>>> Version=0.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of >>>>> its dependencies. The specified module could not be found.* >>>>> >>>>> Fuslogvw is not helping at the moment (nothing is reported there). All >>>>> ipy \ DLR assemblies are in a sub directory which is included in the >>>>> assemblyBinding section of the apps config file (the error remains if they >>>>> are in the exe directory as well). >>>>> >>>>> I tried a workaround (read: hack) by handling the AssemblyResolve event >>>>> on the app domain and loading the files from a known directory. The problem >>>>> I then encountered is an exception in the IronPython.Runtime.SysModule >>>>> constructor (line 46) as it sets the prefix variable to the directory >>>>> containing the assembly, which fails as the Location is empty. >>>>> >>>>> Below is the full exception: >>>>> >>>>> *Microsoft.Scripting.InvalidImplementationException: Type >>>>> 'IronPython.Runtime.PythonContext' doesn't provide a suitable public >>>>> constructor or its implementation is faulty: The type initializer for >>>>> 'IronPython.Runtime.SysModule' threw an exception. ---> >>>>> System.TypeInitializationException: The type initializer for >>>>> 'IronPython.Runtime.SysModule' threw an exception. ---> >>>>> System.ArgumentException: The path is not of a legal form. >>>>> at System.IO.Path.NormalizePathFast(String path, Boolean fullCheck) >>>>> at System.IO.Path.GetDirectoryName(String path) >>>>> at IronPython.Runtime.SysModule..cctor() >>>>> --- End of inner exception stack trace --- >>>>> at IronPython.Runtime.SysModule.PerformModuleReload(PythonContext >>>>> context, IAttributesCollection dict) >>>>> at IronPython.Runtime.PythonContext..ctor(ScriptDomainManager >>>>> manager, IDictionary`2 options) >>>>> --- End of inner exception stack trace --- >>>>> at Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type >>>>> actualType, Object[] args) >>>>> at >>>>> Microsoft.Scripting.Runtime.LanguageConfiguration.LoadLanguageContext(ScriptDomainManager >>>>> domainManager, Boolean& alreadyLoaded) >>>>> at >>>>> Microsoft.Scripting.Runtime.DlrConfiguration.LoadLanguageContext(ScriptDomainManager >>>>> manager, LanguageConfiguration config) >>>>> at >>>>> Microsoft.Scripting.Runtime.DlrConfiguration.TryLoadLanguage(ScriptDomainManager >>>>> manager, AssemblyQualifiedTypeName providerName, LanguageContext& language) >>>>> at >>>>> Microsoft.Scripting.Runtime.ScriptDomainManager.GetLanguageByTypeName(String >>>>> providerAssemblyQualifiedTypeName) >>>>> at >>>>> Microsoft.Scripting.Hosting.ScriptRuntime.GetEngineByTypeName(String >>>>> assemblyQualifiedTypeName) >>>>> at IronPython.Hosting.Python.GetEngine(ScriptRuntime runtime) >>>>> at >>>>> Idbs.ActivityBase.DataImport.Scripting.ScriptingHosts.PythonScriptingHost.CreateEngine(String >>>>> configurationFile) in >>>>> C:\svn\xe\branches\anaconda\Shared\ImportProviders\PythonScriptingProvider\ScriptingHosts\PythonScriptingHost.cs:line >>>>> 148 >>>>> at >>>>> Idbs.ActivityBase.DataImport.Scripting.ScriptingHosts.PythonScriptingHost.ScriptCanMapByIdentifiers(String >>>>> configurationFile) in >>>>> C:\svn\xe\branches\anaconda\Shared\ImportProviders\PythonScriptingProvider\ScriptingHosts\PythonScriptingHost.cs:line >>>>> 52* >>>>> >>>>> So my first question: how come the assemblies are not being found? >>>>> Secondly, is the exception in SysModule something that I should log? >>>>> >>>>> Kind Regards, >>>>> >>>>> Matt >>>>> >>>>> _______________________________________________ >>>>> 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From starisk11 at gmail.com Tue Mar 17 17:25:21 2009 From: starisk11 at gmail.com (starisk11 at gmail.com) Date: Wed, 18 Mar 2009 00:25:21 +0800 Subject: [IronPython] gdata calendarservice.Insert Message-ID: <2d57b6800903170925j517237d5k8bcac971faecd03b@mail.gmail.com> Hi, This is a kinda off-topic, since its a programming issue of Ironpython with GoogleData CalendarService. Specifically, the "Service.Insert" Method which is overloaded and can be on any of the following form; *Insert(TEntry)(Uri, TEntry) Insert(TEntry)(AtomFeed, TEntry) Insert(Uri,Stream,String,String) * Now on the given sample of GDATA which is on CS about Creating calendar events, specifically the last line; // Send the request and receive the response: AtomEntry insertedEntry = service.Insert(postUri, entry); How should I code this in python or IronPython? Here is my attempt that resulted to error. *>>> import clr >>> import System >>> >>> clr.AddReference("mscorlib.dll") >>> clr.AddReference("Google.GData.Client.dll") >>> clr.AddReference("Google.GData.Calendar.dll") >>> clr.AddReference("Google.GData.Extensions.dll") >>> >>> import Google.GData.Client as GDClient >>> import Google.GData.Calendar as GDCal >>> import Google.GData.Extensions as GDxtn >>> >>> mycalsvc = GDCal.CalendarService("myapp") >>> mycalsvc.setUserCredentials("******@gmail.com","*******") >>> >>> myentry = GDCal.EventEntry() >>> myentry.Title.Text = "Tennis with Beth" >>> myentry.Content.Content = "Meet for a quick lesson." >>> >>> >>> myposturi = System.Uri("http://www.google.com/calendar/feeds/default/private /full") >>> mycalsvc.Insert(myposturi,myentry) Traceback (most recent call last): File "", line 1, in TypeError: Insert() takes exactly 4 arguments (2 given) >>> * Again, sorry if its off-topic. But I appreciate any help here. Dennis -------------- next part -------------- An HTML attachment was scrubbed... URL: From wim at 3win.be Tue Mar 17 17:32:33 2009 From: wim at 3win.be (Wim De Kimpe) Date: Tue, 17 Mar 2009 17:32:33 +0100 Subject: [IronPython] IronPython and COM object useage In-Reply-To: <350E7D38B6D819428718949920EC2355571C2024B7@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <004401c9a617$fdb361a0$f91a24e0$@be> <350E7D38B6D819428718949920EC2355571C202019@NA-EXMSG-C102.redmond.corp.microsoft.com> <005601c9a6fd$a1e90730$e5bb1590$@be> <350E7D38B6D819428718949920EC2355571C2024B7@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <005d01c9a71d$f955cdd0$ec016970$@be> Hi not sure how this works, but opening a bug report is one thing. What is needed to find the root cause? And who will be looking for this? kind regards From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: dinsdag 17 maart 2009 16:15 To: Discussion of IronPython Subject: Re: [IronPython] IronPython and COM object useage Yep, www.codeplex.com/IronPython is the right place to open a bug. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Wim De Kimpe Sent: Tuesday, March 17, 2009 5:41 AM To: 'Discussion of IronPython' Subject: Re: [IronPython] IronPython and COM object useage Hi all I have uninstalled the 2.0.1 version and used the version 1.1.2 instead. And there it works like a breeze. Can I enter a bugreport somewhere? wim From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: maandag 16 maart 2009 17:25 To: Discussion of IronPython Subject: Re: [IronPython] IronPython and COM object useage Does get_Initialized work? On 2.0 you might want to run w/ the -X:PreferComInteropAssembly option which will cause us to prefer the interop assembly over using normal COM dispatch. It'd still probably be interesting to track down the real issue here because that option is gone in 2.6. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Wim De Kimpe Sent: Monday, March 16, 2009 2:17 AM To: 'Discussion of IronPython' Subject: [IronPython] IronPython and COM object useage Hi all Not sure if this is the right forum, but I ask my question anyway. I would like to use IronPython for creating a hardware testing environment, consisting of a "Device Under Test" and some measurement equipment like a lab power supply and voltage meter and things like that. These instruments come with a library which enables communication via USB or GPIB. I have been using them in VBA for Excel, C# and VB.Net. Now when I try to do the same in IronPython, I do not seem to get it to work. I have copied the Interop assembly dll's from my example C# program into a separate directory, and then try to do the same steps as I do in the example. Here's the C# example : using System; using Agilent.AgilentU2741A.Interop; namespace Example1 { /// /// Agilent IVI-COM Driver Example Program /// /// Creates a driver object, reads a few Identity interface /// properties, and checks the instrument error queue. /// May include additional instrument specific functionality. /// /// Runs in simulation mode without an instrument. /// /// Requires a COM reference to the driver's type library. /// /// public class App { [STAThread] public static void Main(string[] args) { Agilent.AgilentU2741A.Interop.AgilentU2741A driver = null; try { // Create driver instance driver = new Agilent.AgilentU2741A.Interop.AgilentU2741AClass(); // Setup VISA resource descriptor. Ignored if Simulate=true string resourceDesc = "USB0::2391::18712::SN-4567890::0::INSTR"; // Setup IVI-defined initialization options string standardInitOptions = "QueryInstrStatus=true, Simulate=true"; // Setup driver-specific initialization options string driverSetupOptions = "DriverSetup= Model=, Trace=false"; driver.Initialize(resourceDesc, false, true, standardInitOptions + "," + driverSetupOptions); Console.WriteLine(" Driver Initialized"); // IIviDriverIdentity properties - Initialize required string instModel = driver.Identity.InstrumentModel; Console.WriteLine("InstrumentModel: {0}", instModel); string instFirmwareRevision = driver.Identity.InstrumentFirmwareRevision; Console.WriteLine("InstrumentFirmwareRevision: {0}", instFirmwareRevision); string instManufacturer = driver.Identity.InstrumentManufacturer; Console.WriteLine("InstrumentManufacturer: {0}\n", instManufacturer); // TODO: Exercise driver methods and properties // Check instrument for errors int errorNum = -1; string errorMsg = null; Console.WriteLine(""); while (errorNum != 0) { driver.Utility.ErrorQuery(ref errorNum, ref errorMsg); Console.WriteLine("ErrorQuery: {0}, {1}", errorNum, errorMsg); } } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { if (driver != null && driver.Initialized) { // Close driver driver.Close(); Console.WriteLine(" Driver Closed"); } } Console.WriteLine("\nDone - Press Enter to Exit"); Console.ReadLine(); } } } Here is what I try to do in Ironpython : >>> import sys >>> import clr >>> clr.AddReferenceToFile("Agilent.AgilentU2741A.Interop.dll") >>> from Agilent.AgilentU2741A.Interop import * >>> a = AgilentU2741AClass() >>> a >>> dir(a) ['AC', 'ACCurrent', 'ACVoltage', 'Abort', 'ActualRange', 'Advanced', 'Alpha', 'A pertureTime', 'ApertureTimeUnits', 'AutoRange', 'AutoZero', 'Cache', 'Calibratio n', 'Clear', 'ClearInterchangeWarnings', 'Close', 'Code', 'Configure', 'Configur eBandwidth', 'ConfigureServiceRequest', 'ConfigureSynchronization', 'Continuity' , 'Count', 'CreateObjRef', 'DCCurrent', 'DCVoltage', 'Delay', 'Description', 'Di ode', 'DirectIO', 'Disable', 'DriverOperation', 'DriverSetup', 'Equals', 'ErrorQ uery', 'FResistance', 'Fetch', 'FetchMultiPoint', 'FixedRefJunction', 'Frequency ', 'FrequencyMax', 'FrequencyMin', 'Function', 'GeographicalAddress', 'GetHashCo de', 'GetLifetimeService', 'GetNextCoercionRecord', 'GetNextInterchangeWarning', 'GetType', 'GroupCapabilities', 'IAgilentU2741AACVoltage_AutoRange', 'IAgilentU 2741AACVoltage_Configure', 'IAgilentU2741AACVoltage_Measure', 'IAgilentU2741AACV oltage_Range', 'IAgilentU2741AContinuity_Configure', 'IAgilentU2741AContinuity_M easure', 'IAgilentU2741ADCCurrent_AutoRange', 'IAgilentU2741ADCCurrent_AutoZero' , 'IAgilentU2741ADCCurrent_Range', 'IAgilentU2741ADCVoltage_AutoRange', 'IAgilen tU2741ADCVoltage_AutoZero', 'IAgilentU2741ADCVoltage_Configure', 'IAgilentU2741A DCVoltage_Measure', 'IAgilentU2741ADCVoltage_NPLC', 'IAgilentU2741ADCVoltage_Ran ge', 'IAgilentU2741ADCVoltage_Resolution', 'IAgilentU2741ADiode_Configure', 'IAg ilentU2741ADiode_Measure', 'IAgilentU2741AFResistance_AutoRange', 'IAgilentU2741 AFResistance_AutoZero', 'IAgilentU2741AFResistance_Configure', 'IAgilentU2741AFR esistance_Measure', 'IAgilentU2741AFResistance_NPLC', 'IAgilentU2741AFResistance _Range', 'IAgilentU2741AFResistance_Resolution', 'IAgilentU2741AFrequency_Config ure', 'IAgilentU2741AFrequency_Measure', 'IAgilentU2741AResistance_AutoRange', ' IAgilentU2741AResistance_AutoZero', 'IAgilentU2741AResistance_Configure', 'IAgil entU2741AResistance_Measure', 'IAgilentU2741AResistance_NPLC', 'IAgilentU2741ARe sistance_Range', 'IAgilentU2741AResistance_Resolution', 'IIviComponentIdentity_D escription', 'IIviComponentIdentity_Revision', 'IIviComponentIdentity_Vendor', ' IIviDmmAdvanced_ActualRange', 'IIviDmmAdvanced_ApertureTime', 'IIviDmmAdvanced_A pertureTimeUnits', 'IIviDmmAdvanced_AutoZero', 'IIviDmmAdvanced_PowerlineFrequen cy', 'IIviDmmMeasurement_Abort', 'IIviDmmMeasurement_Fetch', 'IIviDmmMeasurement _Initiate', 'IIviDmmMeasurement_IsOverRange', 'IIviDmmMeasurement_Read', 'IIviDm mMeasurement_SendSoftwareTrigger', 'IIviDmmMultiPoint_Count', 'IIviDmmRTD_Config ure', 'IIviDmmRTD_Resistance', 'IIviDmmThermistor_Resistance', 'IIviDmmTrigger_S lope', 'IIviDmmTrigger_Source', 'IIviDmm_Advanced', 'IIviDmm_Close', 'IIviDmm_Dr iverOperation', 'IIviDmm_Frequency', 'IIviDmm_Function', 'IIviDmm_Identity', 'II viDmm_Initialize', 'IIviDmm_Initialized', 'IIviDmm_Measurement', 'IIviDmm_Range' , 'IIviDmm_Resolution', 'IIviDmm_Temperature', 'IIviDmm_Trigger', 'IIviDmm_Utili ty', 'IIviDriver_Close', 'IIviDriver_DriverOperation', 'IIviDriver_Identity', 'I IviDriver_Initialize', 'IIviDriver_Initialized', 'IIviDriver_Utility', 'Identifi er', 'Identity', 'Initialize', 'InitializeLifetimeService', 'Initialized', 'Init iate', 'InstrumentFirmwareRevision', 'InstrumentManufacturer', 'InstrumentModel' , 'InterchangeCheck', 'InvalidateAllAttributes', 'IoResourceDescriptor', 'IsOver Range', 'LockObject', 'LogicalName', 'Measure', 'Measurement', 'MeasurementCompl ete', 'MemberwiseClone', 'Message', 'MultiPoint', 'NPLC', 'PerformADCCalibration ', 'PerformCalibration', 'PowerlineFrequency', 'Preset', 'QueryInstrumentStatus' , 'RTD', 'Range', 'RangeCheck', 'Read', 'ReadMultiPoint', 'ReadingUnits', 'Recor dCoercions', 'RefJunctionType', 'ReferenceEquals', 'Register', 'Reset', 'ResetCa librationCode', 'ResetInterchangeCheck', 'ResetWithDefaults', 'Resistance', 'Res olution', 'Revision', 'SampleCount', 'SampleInterval', 'SampleTrigger', 'Securit yEnable', 'SecurityState', 'SelfTest', 'SendSoftwareTrigger', 'SerialNumber', 'S erialPoll', 'Simulate', 'Slope', 'Source', 'SpecificationMajorVersion', 'Specifi cationMinorVersion', 'Status', 'StoreCalibrationConstants', 'SupportedInstrument Models', 'SynchronizationBusLine', 'SynchronizationState', 'System', 'Temperatur e', 'Thermistor', 'Thermocouple', 'TimeoutMilliseconds', 'ToString', 'Transducer Type', 'Trigger', 'Type', 'UnitTemperature', 'UnlockObject', 'Utility', 'Value', 'Vendor', 'VoltageRange', 'WaitForOperationComplete', '__class__', '__delattr__ ', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__ ', '__reduce_ex__', '__repr__', '__setattr__', '__str__'] ' object has no attribute 'Load' >>> a.Initialized() Traceback (most recent call last): File "", line 1, in AttributeError: 'GenericComObject' object has no attribute 'Initialized' >>> At this point I was expected to just get : FALSE. Also when I try to call the Initialize method (which seems to be imported correctly), I get the same error : unknown attribute. When I try to step through the available methods, I do not get any of the interesting ones, only the 'generic' ones. Also I have checked the Interop assembly using IL DASM, and there also I get the full list, so I think the interop assembly is ok. What do I do wrong? Is this because it is a COM object ? The IronPython tutorial is not very elaborate on what is actually happening during the exercice, so I am running a bit out of ideas here. Thanks wim -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Tue Mar 17 18:01:23 2009 From: dinov at microsoft.com (Dino Viehland) Date: Tue, 17 Mar 2009 10:01:23 -0700 Subject: [IronPython] gdata calendarservice.Insert In-Reply-To: <2d57b6800903170925j517237d5k8bcac971faecd03b@mail.gmail.com> References: <2d57b6800903170925j517237d5k8bcac971faecd03b@mail.gmail.com> Message-ID: <350E7D38B6D819428718949920EC2355571C2025B5@NA-EXMSG-C102.redmond.corp.microsoft.com> The method you're trying to call is generic so you need to index into it to provide the generic type: mycalsvc.Insert[type(myentry)](myposturi, myentry) We're considering adding inference for these type parameters in the future. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of starisk11 at gmail.com Sent: Tuesday, March 17, 2009 9:25 AM To: users at lists.ironpython.com Subject: [IronPython] gdata calendarservice.Insert Hi, This is a kinda off-topic, since its a programming issue of Ironpython with GoogleData CalendarService. Specifically, the "Service.Insert" Method which is overloaded and can be on any of the following form; Insert(TEntry)(Uri, TEntry) Insert(TEntry)(AtomFeed, TEntry) Insert(Uri,Stream,String,String) Now on the given sample of GDATA which is on CS about Creating calendar events, specifically the last line; // Send the request and receive the response: AtomEntry insertedEntry = service.Insert(postUri, entry); How should I code this in python or IronPython? Here is my attempt that resulted to error. >>> import clr >>> import System >>> >>> clr.AddReference("mscorlib.dll") >>> clr.AddReference("Google.GData.Client.dll") >>> clr.AddReference("Google.GData.Calendar.dll") >>> clr.AddReference("Google.GData.Extensions.dll") >>> >>> import Google.GData.Client as GDClient >>> import Google.GData.Calendar as GDCal >>> import Google.GData.Extensions as GDxtn >>> >>> mycalsvc = GDCal.CalendarService("myapp") >>> mycalsvc.setUserCredentials("******@gmail.com","*******") >>> >>> myentry = GDCal.EventEntry() >>> myentry.Title.Text = "Tennis with Beth" >>> myentry.Content.Content = "Meet for a quick lesson." >>> >>> >>> myposturi = System.Uri("http://www.google.com/calendar/feeds/default/private /full") >>> mycalsvc.Insert(myposturi,myentry) Traceback (most recent call last): File "", line 1, in TypeError: Insert() takes exactly 4 arguments (2 given) >>> Again, sorry if its off-topic. But I appreciate any help here. Dennis -------------- next part -------------- An HTML attachment was scrubbed... URL: From mchanner at gmail.com Tue Mar 17 18:02:42 2009 From: mchanner at gmail.com (Matt Channer) Date: Tue, 17 Mar 2009 17:02:42 +0000 Subject: [IronPython] Problem loading IronPython on Vista 64 In-Reply-To: References: <2cf17aed0903170749h3f2d7d6dq2178f822bcb45af1@mail.gmail.com> <2cf17aed0903170851n34910a25w772f04a0db41925@mail.gmail.com> <2cf17aed0903170916k480a3eadle9a090823fc96b7@mail.gmail.com> Message-ID: <2cf17aed0903171002y52967de7o25fe0e6d94f26a50@mail.gmail.com> OK - did that. Microsoft.Scripting.dll is reported in fuslogvw as being loaded successfully! The error is still reported in the application though, and there are no other binding entries for IronPython.dll and friends. If I attach to the process in VS and look at the loaded modules, Microsoft.Scripting does not appear in the list - very confusing. I have created a simple console application to test out referencing IPy and this works fine. So I guess I will just have to spend some more time looking into why this particular application is problematic. Many thanks, Matt 2009/3/17 Curt Hagenlocher > You might want to consider logging all binds and not just failures. > > > 2009/3/17 Matt Channer > >> I did try Assembly.LoadFile but this returned null, maybe for the same >> reason that I was seeing initially - whatever that is :-) >> >> Fuslogvw now seems to be reporting binding failures (the setting I have is >> to Log bind failures to disk). Interestingly, none of the dlr / ipy >> assemblies are being logged here. >> >> I will write a simple test app to see if that exhibits the same problem. >> >> Thanks for the help! >> >> >> Matt >> >> >> >> 2009/3/17 Curt Hagenlocher >> >>> Your explanation for the SysModule error sounds right -- if you use >>> Assembly.LoadFile instead, you'll probably avoid that exception. What >>> settings are you using in fuslogvw? >>> >>> >>> 2009/3/17 Matt Channer >>> >>>> Hi, >>>> >>>> The machine is pretty clean and has no dlr / ipy assemblies in the gac. >>>> >>>> fuslogvw is not showing anything for me at the moment so I need to >>>> investigate that a bit more. >>>> >>>> I think the error in the SysModule constructor is because I used >>>> AppDomain.CurrentDomain.Load(byte[]) to try and work around the original >>>> issue (this was done in an AssemblyResolve event handler). >>>> >>>> Thanks, >>>> >>>> Matt >>>> >>>> >>>> 2009/3/17 Curt Hagenlocher >>>> >>>> I don't know why there would be a difference between 32-bit and 64-bit, >>>>> but do you possibly have a copy of any of the IronPython bits in your GAC? >>>>> As to the "invalid path" error, you're probably getting it from the line >>>>> >>>>> prefix = >>>>> Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); >>>>> >>>>> which is consistent with some kind of assembly-loading weirdness. Odd >>>>> that nothing shows in fuslogvw. >>>>> >>>>> 2009/3/17 Matt Channer >>>>> >>>>>> Hi! >>>>>> >>>>>> I am using IronPython 2.0.1 in a hosted environment (c# application >>>>>> running on 64 bit Vista). This works well when the application is compiled >>>>>> as a 32bit process, but I am getting the following error when running as an >>>>>> x64 process: >>>>>> >>>>>> *Could not load file or assembly 'Microsoft.Scripting, >>>>>> Version=0.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of >>>>>> its dependencies. The specified module could not be found.* >>>>>> >>>>>> Fuslogvw is not helping at the moment (nothing is reported there). >>>>>> All ipy \ DLR assemblies are in a sub directory which is included in the >>>>>> assemblyBinding section of the apps config file (the error remains if they >>>>>> are in the exe directory as well). >>>>>> >>>>>> I tried a workaround (read: hack) by handling the AssemblyResolve >>>>>> event on the app domain and loading the files from a known directory. The >>>>>> problem I then encountered is an exception in the >>>>>> IronPython.Runtime.SysModule constructor (line 46) as it sets the prefix >>>>>> variable to the directory containing the assembly, which fails as the >>>>>> Location is empty. >>>>>> >>>>>> Below is the full exception: >>>>>> >>>>>> *Microsoft.Scripting.InvalidImplementationException: Type >>>>>> 'IronPython.Runtime.PythonContext' doesn't provide a suitable public >>>>>> constructor or its implementation is faulty: The type initializer for >>>>>> 'IronPython.Runtime.SysModule' threw an exception. ---> >>>>>> System.TypeInitializationException: The type initializer for >>>>>> 'IronPython.Runtime.SysModule' threw an exception. ---> >>>>>> System.ArgumentException: The path is not of a legal form. >>>>>> at System.IO.Path.NormalizePathFast(String path, Boolean fullCheck) >>>>>> at System.IO.Path.GetDirectoryName(String path) >>>>>> at IronPython.Runtime.SysModule..cctor() >>>>>> --- End of inner exception stack trace --- >>>>>> at IronPython.Runtime.SysModule.PerformModuleReload(PythonContext >>>>>> context, IAttributesCollection dict) >>>>>> at IronPython.Runtime.PythonContext..ctor(ScriptDomainManager >>>>>> manager, IDictionary`2 options) >>>>>> --- End of inner exception stack trace --- >>>>>> at Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type >>>>>> actualType, Object[] args) >>>>>> at >>>>>> Microsoft.Scripting.Runtime.LanguageConfiguration.LoadLanguageContext(ScriptDomainManager >>>>>> domainManager, Boolean& alreadyLoaded) >>>>>> at >>>>>> Microsoft.Scripting.Runtime.DlrConfiguration.LoadLanguageContext(ScriptDomainManager >>>>>> manager, LanguageConfiguration config) >>>>>> at >>>>>> Microsoft.Scripting.Runtime.DlrConfiguration.TryLoadLanguage(ScriptDomainManager >>>>>> manager, AssemblyQualifiedTypeName providerName, LanguageContext& language) >>>>>> at >>>>>> Microsoft.Scripting.Runtime.ScriptDomainManager.GetLanguageByTypeName(String >>>>>> providerAssemblyQualifiedTypeName) >>>>>> at >>>>>> Microsoft.Scripting.Hosting.ScriptRuntime.GetEngineByTypeName(String >>>>>> assemblyQualifiedTypeName) >>>>>> at IronPython.Hosting.Python.GetEngine(ScriptRuntime runtime) >>>>>> at >>>>>> Idbs.ActivityBase.DataImport.Scripting.ScriptingHosts.PythonScriptingHost.CreateEngine(String >>>>>> configurationFile) in >>>>>> C:\svn\xe\branches\anaconda\Shared\ImportProviders\PythonScriptingProvider\ScriptingHosts\PythonScriptingHost.cs:line >>>>>> 148 >>>>>> at >>>>>> Idbs.ActivityBase.DataImport.Scripting.ScriptingHosts.PythonScriptingHost.ScriptCanMapByIdentifiers(String >>>>>> configurationFile) in >>>>>> C:\svn\xe\branches\anaconda\Shared\ImportProviders\PythonScriptingProvider\ScriptingHosts\PythonScriptingHost.cs:line >>>>>> 52* >>>>>> >>>>>> So my first question: how come the assemblies are not being found? >>>>>> Secondly, is the exception in SysModule something that I should log? >>>>>> >>>>>> Kind Regards, >>>>>> >>>>>> Matt >>>>>> >>>>>> _______________________________________________ >>>>>> 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Tue Mar 17 18:07:30 2009 From: dinov at microsoft.com (Dino Viehland) Date: Tue, 17 Mar 2009 10:07:30 -0700 Subject: [IronPython] IronPython and COM object useage In-Reply-To: <005d01c9a71d$f955cdd0$ec016970$@be> References: <004401c9a617$fdb361a0$f91a24e0$@be> <350E7D38B6D819428718949920EC2355571C202019@NA-EXMSG-C102.redmond.corp.microsoft.com> <005601c9a6fd$a1e90730$e5bb1590$@be> <350E7D38B6D819428718949920EC2355571C2024B7@NA-EXMSG-C102.redmond.corp.microsoft.com> <005d01c9a71d$f955cdd0$ec016970$@be> Message-ID: <350E7D38B6D819428718949920EC2355571C2025C7@NA-EXMSG-C102.redmond.corp.microsoft.com> If you provide the interop DLL we can debug it. You could also try downloading the latest IronPython sources and building and see if it works there - there have been some changes to COM interop since we've shipped 2.0. But I don't really have a guess of what's happening and will need to step through it to understand the issue more. We monitor all of the bugs on CodePlex and prioritize and assign them on a regular basis. A regression from 1.x is pretty serious so we'll probably look at it fairly quickly. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Wim De Kimpe Sent: Tuesday, March 17, 2009 9:33 AM To: 'Discussion of IronPython' Subject: Re: [IronPython] IronPython and COM object useage Hi not sure how this works, but opening a bug report is one thing. What is needed to find the root cause? And who will be looking for this? kind regards From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: dinsdag 17 maart 2009 16:15 To: Discussion of IronPython Subject: Re: [IronPython] IronPython and COM object useage Yep, www.codeplex.com/IronPython is the right place to open a bug. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Wim De Kimpe Sent: Tuesday, March 17, 2009 5:41 AM To: 'Discussion of IronPython' Subject: Re: [IronPython] IronPython and COM object useage Hi all I have uninstalled the 2.0.1 version and used the version 1.1.2 instead. And there it works like a breeze... Can I enter a bugreport somewhere? wim From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: maandag 16 maart 2009 17:25 To: Discussion of IronPython Subject: Re: [IronPython] IronPython and COM object useage Does get_Initialized work? On 2.0 you might want to run w/ the -X:PreferComInteropAssembly option which will cause us to prefer the interop assembly over using normal COM dispatch. It'd still probably be interesting to track down the real issue here because that option is gone in 2.6. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Wim De Kimpe Sent: Monday, March 16, 2009 2:17 AM To: 'Discussion of IronPython' Subject: [IronPython] IronPython and COM object useage Hi all Not sure if this is the right forum, but I ask my question anyway. I would like to use IronPython for creating a hardware testing environment, consisting of a "Device Under Test" and some measurement equipment like a lab power supply and voltage meter and things like that. These instruments come with a library which enables communication via USB or GPIB. I have been using them in VBA for Excel, C# and VB.Net. Now when I try to do the same in IronPython, I do not seem to get it to work. I have copied the Interop assembly dll's from my example C# program into a separate directory, and then try to do the same steps as I do in the example. Here's the C# example : using System; using Agilent.AgilentU2741A.Interop; namespace Example1 { /// /// Agilent IVI-COM Driver Example Program /// /// Creates a driver object, reads a few Identity interface /// properties, and checks the instrument error queue. /// May include additional instrument specific functionality. /// /// Runs in simulation mode without an instrument. /// /// Requires a COM reference to the driver's type library. /// /// public class App { [STAThread] public static void Main(string[] args) { Agilent.AgilentU2741A.Interop.AgilentU2741A driver = null; try { // Create driver instance driver = new Agilent.AgilentU2741A.Interop.AgilentU2741AClass(); // Setup VISA resource descriptor. Ignored if Simulate=true string resourceDesc = "USB0::2391::18712::SN-4567890::0::INSTR"; // Setup IVI-defined initialization options string standardInitOptions = "QueryInstrStatus=true, Simulate=true"; // Setup driver-specific initialization options string driverSetupOptions = "DriverSetup= Model=, Trace=false"; driver.Initialize(resourceDesc, false, true, standardInitOptions + "," + driverSetupOptions); Console.WriteLine(" Driver Initialized"); // IIviDriverIdentity properties - Initialize required string instModel = driver.Identity.InstrumentModel; Console.WriteLine("InstrumentModel: {0}", instModel); string instFirmwareRevision = driver.Identity.InstrumentFirmwareRevision; Console.WriteLine("InstrumentFirmwareRevision: {0}", instFirmwareRevision); string instManufacturer = driver.Identity.InstrumentManufacturer; Console.WriteLine("InstrumentManufacturer: {0}\n", instManufacturer); // TODO: Exercise driver methods and properties // Check instrument for errors int errorNum = -1; string errorMsg = null; Console.WriteLine(""); while (errorNum != 0) { driver.Utility.ErrorQuery(ref errorNum, ref errorMsg); Console.WriteLine("ErrorQuery: {0}, {1}", errorNum, errorMsg); } } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { if (driver != null && driver.Initialized) { // Close driver driver.Close(); Console.WriteLine(" Driver Closed"); } } Console.WriteLine("\nDone - Press Enter to Exit"); Console.ReadLine(); } } } Here is what I try to do in Ironpython : >>> import sys >>> import clr >>> clr.AddReferenceToFile("Agilent.AgilentU2741A.Interop.dll") >>> from Agilent.AgilentU2741A.Interop import * >>> a = AgilentU2741AClass() >>> a >>> dir(a) ['AC', 'ACCurrent', 'ACVoltage', 'Abort', 'ActualRange', 'Advanced', 'Alpha', 'A pertureTime', 'ApertureTimeUnits', 'AutoRange', 'AutoZero', 'Cache', 'Calibratio n', 'Clear', 'ClearInterchangeWarnings', 'Close', 'Code', 'Configure', 'Configur eBandwidth', 'ConfigureServiceRequest', 'ConfigureSynchronization', 'Continuity' , 'Count', 'CreateObjRef', 'DCCurrent', 'DCVoltage', 'Delay', 'Description', 'Di ode', 'DirectIO', 'Disable', 'DriverOperation', 'DriverSetup', 'Equals', 'ErrorQ uery', 'FResistance', 'Fetch', 'FetchMultiPoint', 'FixedRefJunction', 'Frequency ', 'FrequencyMax', 'FrequencyMin', 'Function', 'GeographicalAddress', 'GetHashCo de', 'GetLifetimeService', 'GetNextCoercionRecord', 'GetNextInterchangeWarning', 'GetType', 'GroupCapabilities', 'IAgilentU2741AACVoltage_AutoRange', 'IAgilentU 2741AACVoltage_Configure', 'IAgilentU2741AACVoltage_Measure', 'IAgilentU2741AACV oltage_Range', 'IAgilentU2741AContinuity_Configure', 'IAgilentU2741AContinuity_M easure', 'IAgilentU2741ADCCurrent_AutoRange', 'IAgilentU2741ADCCurrent_AutoZero' , 'IAgilentU2741ADCCurrent_Range', 'IAgilentU2741ADCVoltage_AutoRange', 'IAgilen tU2741ADCVoltage_AutoZero', 'IAgilentU2741ADCVoltage_Configure', 'IAgilentU2741A DCVoltage_Measure', 'IAgilentU2741ADCVoltage_NPLC', 'IAgilentU2741ADCVoltage_Ran ge', 'IAgilentU2741ADCVoltage_Resolution', 'IAgilentU2741ADiode_Configure', 'IAg ilentU2741ADiode_Measure', 'IAgilentU2741AFResistance_AutoRange', 'IAgilentU2741 AFResistance_AutoZero', 'IAgilentU2741AFResistance_Configure', 'IAgilentU2741AFR esistance_Measure', 'IAgilentU2741AFResistance_NPLC', 'IAgilentU2741AFResistance _Range', 'IAgilentU2741AFResistance_Resolution', 'IAgilentU2741AFrequency_Config ure', 'IAgilentU2741AFrequency_Measure', 'IAgilentU2741AResistance_AutoRange', ' IAgilentU2741AResistance_AutoZero', 'IAgilentU2741AResistance_Configure', 'IAgil entU2741AResistance_Measure', 'IAgilentU2741AResistance_NPLC', 'IAgilentU2741ARe sistance_Range', 'IAgilentU2741AResistance_Resolution', 'IIviComponentIdentity_D escription', 'IIviComponentIdentity_Revision', 'IIviComponentIdentity_Vendor', ' IIviDmmAdvanced_ActualRange', 'IIviDmmAdvanced_ApertureTime', 'IIviDmmAdvanced_A pertureTimeUnits', 'IIviDmmAdvanced_AutoZero', 'IIviDmmAdvanced_PowerlineFrequen cy', 'IIviDmmMeasurement_Abort', 'IIviDmmMeasurement_Fetch', 'IIviDmmMeasurement _Initiate', 'IIviDmmMeasurement_IsOverRange', 'IIviDmmMeasurement_Read', 'IIviDm mMeasurement_SendSoftwareTrigger', 'IIviDmmMultiPoint_Count', 'IIviDmmRTD_Config ure', 'IIviDmmRTD_Resistance', 'IIviDmmThermistor_Resistance', 'IIviDmmTrigger_S lope', 'IIviDmmTrigger_Source', 'IIviDmm_Advanced', 'IIviDmm_Close', 'IIviDmm_Dr iverOperation', 'IIviDmm_Frequency', 'IIviDmm_Function', 'IIviDmm_Identity', 'II viDmm_Initialize', 'IIviDmm_Initialized', 'IIviDmm_Measurement', 'IIviDmm_Range' , 'IIviDmm_Resolution', 'IIviDmm_Temperature', 'IIviDmm_Trigger', 'IIviDmm_Utili ty', 'IIviDriver_Close', 'IIviDriver_DriverOperation', 'IIviDriver_Identity', 'I IviDriver_Initialize', 'IIviDriver_Initialized', 'IIviDriver_Utility', 'Identifi er', 'Identity', 'Initialize', 'InitializeLifetimeService', 'Initialized', 'Init iate', 'InstrumentFirmwareRevision', 'InstrumentManufacturer', 'InstrumentModel' , 'InterchangeCheck', 'InvalidateAllAttributes', 'IoResourceDescriptor', 'IsOver Range', 'LockObject', 'LogicalName', 'Measure', 'Measurement', 'MeasurementCompl ete', 'MemberwiseClone', 'Message', 'MultiPoint', 'NPLC', 'PerformADCCalibration ', 'PerformCalibration', 'PowerlineFrequency', 'Preset', 'QueryInstrumentStatus' , 'RTD', 'Range', 'RangeCheck', 'Read', 'ReadMultiPoint', 'ReadingUnits', 'Recor dCoercions', 'RefJunctionType', 'ReferenceEquals', 'Register', 'Reset', 'ResetCa librationCode', 'ResetInterchangeCheck', 'ResetWithDefaults', 'Resistance', 'Res olution', 'Revision', 'SampleCount', 'SampleInterval', 'SampleTrigger', 'Securit yEnable', 'SecurityState', 'SelfTest', 'SendSoftwareTrigger', 'SerialNumber', 'S erialPoll', 'Simulate', 'Slope', 'Source', 'SpecificationMajorVersion', 'Specifi cationMinorVersion', 'Status', 'StoreCalibrationConstants', 'SupportedInstrument Models', 'SynchronizationBusLine', 'SynchronizationState', 'System', 'Temperatur e', 'Thermistor', 'Thermocouple', 'TimeoutMilliseconds', 'ToString', 'Transducer Type', 'Trigger', 'Type', 'UnitTemperature', 'UnlockObject', 'Utility', 'Value', 'Vendor', 'VoltageRange', 'WaitForOperationComplete', '__class__', '__delattr__ ', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__ ', '__reduce_ex__', '__repr__', '__setattr__', '__str__'] ' object has no attribute 'Load' >>> a.Initialized() Traceback (most recent call last): File "", line 1, in AttributeError: 'GenericComObject' object has no attribute 'Initialized' >>> At this point I was expected to just get : FALSE. Also when I try to call the Initialize method (which seems to be imported correctly), I get the same error : unknown attribute. When I try to step through the available methods, I do not get any of the interesting ones, only the 'generic' ones. Also I have checked the Interop assembly using IL DASM, and there also I get the full list, so I think the interop assembly is ok. What do I do wrong? Is this because it is a COM object ? The IronPython tutorial is not very elaborate on what is actually happening during the exercice, so I am running a bit out of ideas here... Thanks wim -------------- next part -------------- An HTML attachment was scrubbed... URL: From sebastiantiedtke at gmail.com Tue Mar 17 21:30:50 2009 From: sebastiantiedtke at gmail.com (sourishkrout) Date: Tue, 17 Mar 2009 13:30:50 -0700 (PDT) Subject: [IronPython] How to do the typeof( ) call on an IronPython implemented class in C#? Message-ID: <22532007.post@talk.nabble.com> Hi Jan, I don't know whether you figured it out yourself in the meantime, but I have had the same problem today and made it work. So I just wanted to share my brilliance with you... :-) Here you go: clr.GetClrType(CalculatorService) The clr object offers the "GetClrType" method which returns the type. I used it in a different context though: XML (De-)Serialization. Worked very well. Let me know whether you had success... - Sebastian Jan R-2 wrote: > > Hello IronPython Experts. > > > How to do the typeof( ) call on an IronPython implemented class in C#? > > The need to do a typeof(..) comes from implementing services in Windows > Communication Foundation (WCF) in IronPython. The WCF get-statrted sample > uses the overloaded constructor of the ServiceHost class that takes a > System.Type: > > ServiceHost selfHost = new ServiceHost(typeof(CalculatorService), > baseAddress); > > > I want to replace the CalculatorService with a IronPython class > PyCalculator. Note the typeof(...). > > I have tried the following without success, in order to give an instance > of > the IronPython class to the ServiceHost constructor : > > ICalculator pyCalc = (ICalculator)pyr.getInstance("PyCalculator"); > ServiceHost selfHost = new ServiceHost( (object) pyCalc, baseAddress); > > The IronPython class is attached below. The code results in an exception, > because the attribute InstanceContextMode have to be set to > InstanceContextMode.Single. > > The WCF get-started sample is here: > http://msdn.microsoft.com/da-dk/library/ms734712(en-us).aspx > > Can anyone help me out? > > > Regards > Jan Rouvillain > > IronPython code: > > import clr > clr.AddReference('CalculatorServer') > from Microsoft.ServiceModel.Samples import ICalculator > > class PyCalculator(ICalculator): > "Implements calculator services" > > def Add(self, a, b): > print 'a ' + a + ' + b ' + b > return a+b > > def Subtract(self, a, b): > print 'a ' + a + ' - b ' + b > return a-b > > def Multiply(self, a, b): > print 'a ' + a + ' * b ' + b > return a*b > > def Divide(self, a, b): > print 'a ' + a + ' // b ' + b > return a/b > > C# interface declaration: > > namespace Microsoft.ServiceModel.Samples > { > [ServiceContract(Namespace = "http://Microsoft.ServiceModel.Samples")] > public interface ICalculator > { > // Step7: Create the method declaration for the contract. > [OperationContract] > double Add(double n1, double n2); > [OperationContract] > double Subtract(double n1, double n2); > [OperationContract] > double Multiply(double n1, double n2); > [OperationContract] > double Divide(double n1, double n2); > } > } > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -- View this message in context: http://www.nabble.com/How-to-do-the-typeof%28-%29-call-on-an-IronPython-implemented-class-in-C---tp22055752p22532007.html Sent from the IronPython mailing list archive at Nabble.com. From jdhardy at gmail.com Wed Mar 18 01:03:03 2009 From: jdhardy at gmail.com (Jeff Hardy) Date: Tue, 17 Mar 2009 18:03:03 -0600 Subject: [IronPython] CP Issue #21659: Subclassing unicode In-Reply-To: <350E7D38B6D819428718949920EC2355571C2023A5@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <350E7D38B6D819428718949920EC2355571C2023A5@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: On Mon, Mar 16, 2009 at 7:03 PM, Dino Viehland wrote: > Does this make it work? > > class x(unicode): > ? ?def __init__(self, val): pass > ? ?def __new__(cls, val): > ? ? ? ? ? ?return unicode.__new__(cls, unicode(val)) > > > x(1) > > I've voted for the bug and raised the priority to medium. ?I've left it proposed until we triage it as a team (we triage bugs every Monday morning so it'll be a week) but I might be able to fix it before then :) > Thanks, that did it. I had to extend it to handle all of the parameters to unicode: def __new__(cls, object = '', *args, **kwargs): return unicode.__new__(cls, unicode(object), *args, **kwargs) Only 227 more failures to go (out of 701, so not too bad). - Jeff From blackman at simnet.is Wed Mar 18 08:47:30 2009 From: blackman at simnet.is (BlackMan890) Date: Wed, 18 Mar 2009 00:47:30 -0700 (PDT) Subject: [IronPython] How do I run python functions and make the python code remember variables between calls from C#? Message-ID: <22570584.post@talk.nabble.com> Hi there. When I run the following .py from C#: --- test.py ---------------- global crap crap = None def set_crap(): crap = "yay" def return_crap(): return crap --------------------------- And run the functions set_crap and return_crap from C# using the following code: --- program.cs ---------------- --- Code is not being displayed right here, view the uploaded file I sent --- ------------------------------- static void Main(string[] args) { ScriptEngine engine = Python.CreateEngine(); ScriptSource source = engine.CreateScriptSourceFromFile("test.py"); ScriptScope scope = engine.CreateScope(); try { source.Execute(scope); } catch (Exception ex) { ExceptionOperations eo = engine.GetService(); Console.WriteLine(eo.FormatException(ex)); } SetData = scope.GetVariable("set_crap"); GetData = scope.GetVariable("return_crap"); SetData(); object temp = GetData(); Console.ReadLine(); } static Func SetData; static Func GetData; ------------------------------- The code compiles and runs but "temp" is always null. How would one go of running IronPython while maintaining all variables inside python? Cause the way I see it, whenever I run a function, all variables are resettet. Sincerely: Jonatan Nilsson Iceland P.S. I am using IronPython 2.0.1 P.P.S. Your documentation for C# using IronPython 2.0.1 are nonexistant :S Where are the documentation on using IronPython 2.0.1 in C#? http://www.nabble.com/file/p22570584/program.cs program.cs -- View this message in context: http://www.nabble.com/How-do-I-run-python-functions-and-make-the-python-code-remember-variables-between-calls-from-C---tp22570584p22570584.html Sent from the IronPython mailing list archive at Nabble.com. From wim at 3win.be Wed Mar 18 09:53:02 2009 From: wim at 3win.be (Wim De Kimpe) Date: Wed, 18 Mar 2009 09:53:02 +0100 Subject: [IronPython] IronPython and COM object useage In-Reply-To: <350E7D38B6D819428718949920EC2355571C2025C7@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <004401c9a617$fdb361a0$f91a24e0$@be> <350E7D38B6D819428718949920EC2355571C202019@NA-EXMSG-C102.redmond.corp.microsoft.com> <005601c9a6fd$a1e90730$e5bb1590$@be> <350E7D38B6D819428718949920EC2355571C2024B7@NA-EXMSG-C102.redmond.corp.microsoft.com> <005d01c9a71d$f955cdd0$ec016970$@be> <350E7D38B6D819428718949920EC2355571C2025C7@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <00ee01c9a7a6$f27148d0$d753da70$@be> I have added the report (Time number # 21682) and also included the dll's From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: dinsdag 17 maart 2009 18:08 To: Discussion of IronPython Subject: Re: [IronPython] IronPython and COM object useage If you provide the interop DLL we can debug it. You could also try downloading the latest IronPython sources and building and see if it works there - there have been some changes to COM interop since we've shipped 2.0. But I don't really have a guess of what's happening and will need to step through it to understand the issue more. We monitor all of the bugs on CodePlex and prioritize and assign them on a regular basis. A regression from 1.x is pretty serious so we'll probably look at it fairly quickly. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Wim De Kimpe Sent: Tuesday, March 17, 2009 9:33 AM To: 'Discussion of IronPython' Subject: Re: [IronPython] IronPython and COM object useage Hi not sure how this works, but opening a bug report is one thing. What is needed to find the root cause? And who will be looking for this? kind regards From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: dinsdag 17 maart 2009 16:15 To: Discussion of IronPython Subject: Re: [IronPython] IronPython and COM object useage Yep, www.codeplex.com/IronPython is the right place to open a bug. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Wim De Kimpe Sent: Tuesday, March 17, 2009 5:41 AM To: 'Discussion of IronPython' Subject: Re: [IronPython] IronPython and COM object useage Hi all I have uninstalled the 2.0.1 version and used the version 1.1.2 instead. And there it works like a breeze. Can I enter a bugreport somewhere? wim From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: maandag 16 maart 2009 17:25 To: Discussion of IronPython Subject: Re: [IronPython] IronPython and COM object useage Does get_Initialized work? On 2.0 you might want to run w/ the -X:PreferComInteropAssembly option which will cause us to prefer the interop assembly over using normal COM dispatch. It'd still probably be interesting to track down the real issue here because that option is gone in 2.6. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Wim De Kimpe Sent: Monday, March 16, 2009 2:17 AM To: 'Discussion of IronPython' Subject: [IronPython] IronPython and COM object useage Hi all Not sure if this is the right forum, but I ask my question anyway. I would like to use IronPython for creating a hardware testing environment, consisting of a "Device Under Test" and some measurement equipment like a lab power supply and voltage meter and things like that. These instruments come with a library which enables communication via USB or GPIB. I have been using them in VBA for Excel, C# and VB.Net. Now when I try to do the same in IronPython, I do not seem to get it to work. I have copied the Interop assembly dll's from my example C# program into a separate directory, and then try to do the same steps as I do in the example. Here's the C# example : using System; using Agilent.AgilentU2741A.Interop; namespace Example1 { /// /// Agilent IVI-COM Driver Example Program /// /// Creates a driver object, reads a few Identity interface /// properties, and checks the instrument error queue. /// May include additional instrument specific functionality. /// /// Runs in simulation mode without an instrument. /// /// Requires a COM reference to the driver's type library. /// /// public class App { [STAThread] public static void Main(string[] args) { Agilent.AgilentU2741A.Interop.AgilentU2741A driver = null; try { // Create driver instance driver = new Agilent.AgilentU2741A.Interop.AgilentU2741AClass(); // Setup VISA resource descriptor. Ignored if Simulate=true string resourceDesc = "USB0::2391::18712::SN-4567890::0::INSTR"; // Setup IVI-defined initialization options string standardInitOptions = "QueryInstrStatus=true, Simulate=true"; // Setup driver-specific initialization options string driverSetupOptions = "DriverSetup= Model=, Trace=false"; driver.Initialize(resourceDesc, false, true, standardInitOptions + "," + driverSetupOptions); Console.WriteLine(" Driver Initialized"); // IIviDriverIdentity properties - Initialize required string instModel = driver.Identity.InstrumentModel; Console.WriteLine("InstrumentModel: {0}", instModel); string instFirmwareRevision = driver.Identity.InstrumentFirmwareRevision; Console.WriteLine("InstrumentFirmwareRevision: {0}", instFirmwareRevision); string instManufacturer = driver.Identity.InstrumentManufacturer; Console.WriteLine("InstrumentManufacturer: {0}\n", instManufacturer); // TODO: Exercise driver methods and properties // Check instrument for errors int errorNum = -1; string errorMsg = null; Console.WriteLine(""); while (errorNum != 0) { driver.Utility.ErrorQuery(ref errorNum, ref errorMsg); Console.WriteLine("ErrorQuery: {0}, {1}", errorNum, errorMsg); } } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { if (driver != null && driver.Initialized) { // Close driver driver.Close(); Console.WriteLine(" Driver Closed"); } } Console.WriteLine("\nDone - Press Enter to Exit"); Console.ReadLine(); } } } Here is what I try to do in Ironpython : >>> import sys >>> import clr >>> clr.AddReferenceToFile("Agilent.AgilentU2741A.Interop.dll") >>> from Agilent.AgilentU2741A.Interop import * >>> a = AgilentU2741AClass() >>> a >>> dir(a) ['AC', 'ACCurrent', 'ACVoltage', 'Abort', 'ActualRange', 'Advanced', 'Alpha', 'A pertureTime', 'ApertureTimeUnits', 'AutoRange', 'AutoZero', 'Cache', 'Calibratio n', 'Clear', 'ClearInterchangeWarnings', 'Close', 'Code', 'Configure', 'Configur eBandwidth', 'ConfigureServiceRequest', 'ConfigureSynchronization', 'Continuity' , 'Count', 'CreateObjRef', 'DCCurrent', 'DCVoltage', 'Delay', 'Description', 'Di ode', 'DirectIO', 'Disable', 'DriverOperation', 'DriverSetup', 'Equals', 'ErrorQ uery', 'FResistance', 'Fetch', 'FetchMultiPoint', 'FixedRefJunction', 'Frequency ', 'FrequencyMax', 'FrequencyMin', 'Function', 'GeographicalAddress', 'GetHashCo de', 'GetLifetimeService', 'GetNextCoercionRecord', 'GetNextInterchangeWarning', 'GetType', 'GroupCapabilities', 'IAgilentU2741AACVoltage_AutoRange', 'IAgilentU 2741AACVoltage_Configure', 'IAgilentU2741AACVoltage_Measure', 'IAgilentU2741AACV oltage_Range', 'IAgilentU2741AContinuity_Configure', 'IAgilentU2741AContinuity_M easure', 'IAgilentU2741ADCCurrent_AutoRange', 'IAgilentU2741ADCCurrent_AutoZero' , 'IAgilentU2741ADCCurrent_Range', 'IAgilentU2741ADCVoltage_AutoRange', 'IAgilen tU2741ADCVoltage_AutoZero', 'IAgilentU2741ADCVoltage_Configure', 'IAgilentU2741A DCVoltage_Measure', 'IAgilentU2741ADCVoltage_NPLC', 'IAgilentU2741ADCVoltage_Ran ge', 'IAgilentU2741ADCVoltage_Resolution', 'IAgilentU2741ADiode_Configure', 'IAg ilentU2741ADiode_Measure', 'IAgilentU2741AFResistance_AutoRange', 'IAgilentU2741 AFResistance_AutoZero', 'IAgilentU2741AFResistance_Configure', 'IAgilentU2741AFR esistance_Measure', 'IAgilentU2741AFResistance_NPLC', 'IAgilentU2741AFResistance _Range', 'IAgilentU2741AFResistance_Resolution', 'IAgilentU2741AFrequency_Config ure', 'IAgilentU2741AFrequency_Measure', 'IAgilentU2741AResistance_AutoRange', ' IAgilentU2741AResistance_AutoZero', 'IAgilentU2741AResistance_Configure', 'IAgil entU2741AResistance_Measure', 'IAgilentU2741AResistance_NPLC', 'IAgilentU2741ARe sistance_Range', 'IAgilentU2741AResistance_Resolution', 'IIviComponentIdentity_D escription', 'IIviComponentIdentity_Revision', 'IIviComponentIdentity_Vendor', ' IIviDmmAdvanced_ActualRange', 'IIviDmmAdvanced_ApertureTime', 'IIviDmmAdvanced_A pertureTimeUnits', 'IIviDmmAdvanced_AutoZero', 'IIviDmmAdvanced_PowerlineFrequen cy', 'IIviDmmMeasurement_Abort', 'IIviDmmMeasurement_Fetch', 'IIviDmmMeasurement _Initiate', 'IIviDmmMeasurement_IsOverRange', 'IIviDmmMeasurement_Read', 'IIviDm mMeasurement_SendSoftwareTrigger', 'IIviDmmMultiPoint_Count', 'IIviDmmRTD_Config ure', 'IIviDmmRTD_Resistance', 'IIviDmmThermistor_Resistance', 'IIviDmmTrigger_S lope', 'IIviDmmTrigger_Source', 'IIviDmm_Advanced', 'IIviDmm_Close', 'IIviDmm_Dr iverOperation', 'IIviDmm_Frequency', 'IIviDmm_Function', 'IIviDmm_Identity', 'II viDmm_Initialize', 'IIviDmm_Initialized', 'IIviDmm_Measurement', 'IIviDmm_Range' , 'IIviDmm_Resolution', 'IIviDmm_Temperature', 'IIviDmm_Trigger', 'IIviDmm_Utili ty', 'IIviDriver_Close', 'IIviDriver_DriverOperation', 'IIviDriver_Identity', 'I IviDriver_Initialize', 'IIviDriver_Initialized', 'IIviDriver_Utility', 'Identifi er', 'Identity', 'Initialize', 'InitializeLifetimeService', 'Initialized', 'Init iate', 'InstrumentFirmwareRevision', 'InstrumentManufacturer', 'InstrumentModel' , 'InterchangeCheck', 'InvalidateAllAttributes', 'IoResourceDescriptor', 'IsOver Range', 'LockObject', 'LogicalName', 'Measure', 'Measurement', 'MeasurementCompl ete', 'MemberwiseClone', 'Message', 'MultiPoint', 'NPLC', 'PerformADCCalibration ', 'PerformCalibration', 'PowerlineFrequency', 'Preset', 'QueryInstrumentStatus' , 'RTD', 'Range', 'RangeCheck', 'Read', 'ReadMultiPoint', 'ReadingUnits', 'Recor dCoercions', 'RefJunctionType', 'ReferenceEquals', 'Register', 'Reset', 'ResetCa librationCode', 'ResetInterchangeCheck', 'ResetWithDefaults', 'Resistance', 'Res olution', 'Revision', 'SampleCount', 'SampleInterval', 'SampleTrigger', 'Securit yEnable', 'SecurityState', 'SelfTest', 'SendSoftwareTrigger', 'SerialNumber', 'S erialPoll', 'Simulate', 'Slope', 'Source', 'SpecificationMajorVersion', 'Specifi cationMinorVersion', 'Status', 'StoreCalibrationConstants', 'SupportedInstrument Models', 'SynchronizationBusLine', 'SynchronizationState', 'System', 'Temperatur e', 'Thermistor', 'Thermocouple', 'TimeoutMilliseconds', 'ToString', 'Transducer Type', 'Trigger', 'Type', 'UnitTemperature', 'UnlockObject', 'Utility', 'Value', 'Vendor', 'VoltageRange', 'WaitForOperationComplete', '__class__', '__delattr__ ', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__ ', '__reduce_ex__', '__repr__', '__setattr__', '__str__'] ' object has no attribute 'Load' >>> a.Initialized() Traceback (most recent call last): File "", line 1, in AttributeError: 'GenericComObject' object has no attribute 'Initialized' >>> At this point I was expected to just get : FALSE. Also when I try to call the Initialize method (which seems to be imported correctly), I get the same error : unknown attribute. When I try to step through the available methods, I do not get any of the interesting ones, only the 'generic' ones. Also I have checked the Interop assembly using IL DASM, and there also I get the full list, so I think the interop assembly is ok. What do I do wrong? Is this because it is a COM object ? The IronPython tutorial is not very elaborate on what is actually happening during the exercice, so I am running a bit out of ideas here. Thanks wim -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Wed Mar 18 13:05:51 2009 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Wed, 18 Mar 2009 05:05:51 -0700 Subject: [IronPython] How do I run python functions and make the python code remember variables between calls from C#? In-Reply-To: <22570584.post@talk.nabble.com> References: <22570584.post@talk.nabble.com> Message-ID: Your "global" statement needs to be inside your "set_crap" function. On Wed, Mar 18, 2009 at 12:47 AM, BlackMan890 wrote: > > Hi there. > > When I run the following .py from C#: > > --- test.py ---------------- > > global crap > crap = None > > def set_crap(): > crap = "yay" > > def return_crap(): > return crap > --------------------------- > > And run the functions set_crap and return_crap from C# using the following > code: > > --- program.cs ---------------- > --- Code is not being displayed right here, view the uploaded file I sent > --- > ------------------------------- > > static void Main(string[] args) > { > ScriptEngine engine = Python.CreateEngine(); > ScriptSource source = engine.CreateScriptSourceFromFile("test.py"); > ScriptScope scope = engine.CreateScope(); > > try > { > > source.Execute(scope); > > } > catch (Exception ex) > { > ExceptionOperations eo = > engine.GetService(); > Console.WriteLine(eo.FormatException(ex)); > } > > SetData = scope.GetVariable("set_crap"); > GetData = scope.GetVariable("return_crap"); > > SetData(); > object temp = GetData(); > > Console.ReadLine(); > } > > static Func SetData; > static Func GetData; > ------------------------------- > > The code compiles and runs but "temp" is always null. > How would one go of running IronPython while maintaining all variables > inside python? > Cause the way I see it, whenever I run a function, all variables are > resettet. > > > Sincerely: > Jonatan Nilsson > Iceland > > > P.S. > I am using IronPython 2.0.1 > > P.P.S. > Your documentation for C# using IronPython 2.0.1 are nonexistant :S Where > are the documentation on using IronPython 2.0.1 in C#? > http://www.nabble.com/file/p22570584/program.cs program.cs > -- > View this message in context: > http://www.nabble.com/How-do-I-run-python-functions-and-make-the-python-code-remember-variables-between-calls-from-C---tp22570584p22570584.html > Sent from the IronPython mailing list archive at Nabble.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 blackman at simnet.is Wed Mar 18 13:20:48 2009 From: blackman at simnet.is (BlackMan890) Date: Wed, 18 Mar 2009 05:20:48 -0700 (PDT) Subject: [IronPython] How do I run python functions and make the python code remember variables between calls from C#? In-Reply-To: References: <22570584.post@talk.nabble.com> Message-ID: <22577957.post@talk.nabble.com> Thank you so much :D It is working now :) Curt Hagenlocher wrote: > > Your "global" statement needs to be inside your "set_crap" function. > -- View this message in context: http://www.nabble.com/How-do-I-run-python-functions-and-make-the-python-code-remember-variables-between-calls-from-C---tp22570584p22577957.html Sent from the IronPython mailing list archive at Nabble.com. From blackman at simnet.is Wed Mar 18 13:48:12 2009 From: blackman at simnet.is (BlackMan890) Date: Wed, 18 Mar 2009 05:48:12 -0700 (PDT) Subject: [IronPython] How do I register functions that Python can run from C#? Message-ID: <22578426.post@talk.nabble.com> Hi there. I was wondering how one would achieve registering a C# function that python code would be able to call, something like this: --- test.py --------------- def return_crap(): # do something crap = GetDataFromCSharp() # do some more return crap -------------------------- This is my current C# code: --- program.cs ----------- static void Main(string[] args) { ScriptEngine engine = Python.CreateEngine(); CompiledCode compile = engine.CreateScriptSourceFromFile("test.py", new UTF8Encoding(), SourceCodeKind.Statements).Compile(); ScriptScope scope = engine.CreateScope(); ObjectOperations operations = engine.Operations; try { compile.Execute(scope); } catch (Exception ex) { ExceptionOperations eo = engine.GetService(); Console.WriteLine(eo.FormatException(ex)); } GetData = scope.GetVariable("return_crap"); object data = GetData(); } public static object GetDataFromCSharp() { return "test"; } -------------------------- Of course an error will occur because GetDataFromCSharp has not yet been defined. I was wondering how one would go to register the function :) -- View this message in context: http://www.nabble.com/How-do-I-register-functions-that-Python-can-run-from-C---tp22578426p22578426.html Sent from the IronPython mailing list archive at Nabble.com. From fuzzyman at voidspace.org.uk Wed Mar 18 15:27:21 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Wed, 18 Mar 2009 14:27:21 +0000 Subject: [IronPython] How do I register functions that Python can run from C#? In-Reply-To: <22578426.post@talk.nabble.com> References: <22578426.post@talk.nabble.com> Message-ID: <49C104C9.7040302@voidspace.org.uk> Create a delegate and set it in the scope prior to executing. Michael BlackMan890 wrote: > Hi there. > > I was wondering how one would achieve registering a C# function that python > code would be able to call, something like this: > > --- test.py --------------- > > def return_crap(): > # do something > crap = GetDataFromCSharp() > # do some more > return crap > > -------------------------- > > This is my current C# code: > > --- program.cs ----------- > > static void Main(string[] args) > { > ScriptEngine engine = Python.CreateEngine(); > CompiledCode compile = engine.CreateScriptSourceFromFile("test.py", new > UTF8Encoding(), SourceCodeKind.Statements).Compile(); > ScriptScope scope = engine.CreateScope(); > ObjectOperations operations = engine.Operations; > > try > { > compile.Execute(scope); > } > catch (Exception ex) > { > ExceptionOperations eo = engine.GetService(); > Console.WriteLine(eo.FormatException(ex)); > } > > GetData = scope.GetVariable("return_crap"); > > object data = GetData(); > } > > public static object GetDataFromCSharp() > { > return "test"; > } > > -------------------------- > > Of course an error will occur because GetDataFromCSharp has not yet been > defined. I was wondering how one would go to register the function :) > -- http://www.ironpythoninaction.com/ From blackman at simnet.is Wed Mar 18 15:44:40 2009 From: blackman at simnet.is (Jonatan Nilsson) Date: Wed, 18 Mar 2009 14:44:40 +0000 Subject: [IronPython] How do I register functions that Python can run from C#? In-Reply-To: <49C104C9.7040302@voidspace.org.uk> References: <22578426.post@talk.nabble.com> <49C104C9.7040302@voidspace.org.uk> Message-ID: <49C108D8.5080809@simnet.is> Hi there Michael Foord. How do I set the delegate inside the scope? Sincerely: Jonatan Nilsson Iceland Michael Foord wrote: > Create a delegate and set it in the scope prior to executing. > > Michael > > BlackMan890 wrote: >> Hi there. >> >> I was wondering how one would achieve registering a C# function that >> python >> code would be able to call, something like this: >> >> --- test.py --------------- >> >> def return_crap(): >> # do something >> crap = GetDataFromCSharp() >> # do some more >> return crap >> >> -------------------------- >> >> This is my current C# code: >> >> --- program.cs ----------- >> >> static void Main(string[] args) >> { >> ScriptEngine engine = Python.CreateEngine(); >> CompiledCode compile = >> engine.CreateScriptSourceFromFile("test.py", new >> UTF8Encoding(), SourceCodeKind.Statements).Compile(); >> ScriptScope scope = engine.CreateScope(); >> ObjectOperations operations = engine.Operations; >> >> try >> { >> compile.Execute(scope); >> } >> catch (Exception ex) >> { >> ExceptionOperations eo = >> engine.GetService(); >> Console.WriteLine(eo.FormatException(ex)); >> } >> >> GetData = scope.GetVariable("return_crap"); >> >> object data = GetData(); >> } >> >> public static object GetDataFromCSharp() >> { >> return "test"; >> } >> >> -------------------------- >> >> Of course an error will occur because GetDataFromCSharp has not yet been >> defined. I was wondering how one would go to register the function :) >> > > From blackman at simnet.is Wed Mar 18 16:30:13 2009 From: blackman at simnet.is (BlackMan890) Date: Wed, 18 Mar 2009 08:30:13 -0700 (PDT) Subject: [IronPython] How come I cant import time or threading in IronPython Message-ID: <22581456.post@talk.nabble.com> Hi there. this has probably been answered before but I cant seem to find the answer. When I run "import time" in python through IronPython using C#, an exception occurs with the message: "no module named time". The same thing happens when I run "import threading" except with a different exception: "No module named thread" Why am I encountering there problems? Sincerely: Jonatan Nilsson Iceland -- View this message in context: http://www.nabble.com/How-come-I-cant-import-time-or-threading-in-IronPython-tp22581456p22581456.html Sent from the IronPython mailing list archive at Nabble.com. From fuzzyman at voidspace.org.uk Wed Mar 18 16:42:05 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Wed, 18 Mar 2009 15:42:05 +0000 Subject: [IronPython] How come I cant import time or threading in IronPython In-Reply-To: <22581456.post@talk.nabble.com> References: <22581456.post@talk.nabble.com> Message-ID: <49C1164D.8010406@voidspace.org.uk> These libraries you are attempting to import are Python standard library modules. To import them you must have the Python standard library available - and on sys.path for the engine being used to do the imports. You set sys.path programattically using engine.SetSearchPaths (?) passing in an array of strings. All the best, Michael Foord BlackMan890 wrote: > Hi there. > > this has probably been answered before but I cant seem to find the answer. > When I run "import time" in python through IronPython using C#, an exception > occurs with the message: "no module named time". > The same thing happens when I run "import threading" except with a different > exception: "No module named thread" > > Why am I encountering there problems? > > > Sincerely: > Jonatan Nilsson > Iceland > > > -- http://www.ironpythoninaction.com/ From fuzzyman at voidspace.org.uk Wed Mar 18 16:45:01 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Wed, 18 Mar 2009 15:45:01 +0000 Subject: [IronPython] How do I register functions that Python can run from C#? In-Reply-To: <49C108D8.5080809@simnet.is> References: <22578426.post@talk.nabble.com> <49C104C9.7040302@voidspace.org.uk> <49C108D8.5080809@simnet.is> Message-ID: <49C116FD.4000107@voidspace.org.uk> Jonatan Nilsson wrote: > Hi there Michael Foord. > > How do I set the delegate inside the scope? > Something like: var something = delegate(string arg) { Console.WriteLine(arg); }; scope.SetVariable("something", something); HTH Michael Foord > > Sincerely: > Jonatan Nilsson > Iceland > > Michael Foord wrote: >> Create a delegate and set it in the scope prior to executing. >> >> Michael >> >> BlackMan890 wrote: >>> Hi there. >>> >>> I was wondering how one would achieve registering a C# function that >>> python >>> code would be able to call, something like this: >>> >>> --- test.py --------------- >>> >>> def return_crap(): >>> # do something >>> crap = GetDataFromCSharp() >>> # do some more >>> return crap >>> >>> -------------------------- >>> >>> This is my current C# code: >>> >>> --- program.cs ----------- >>> >>> static void Main(string[] args) >>> { >>> ScriptEngine engine = Python.CreateEngine(); >>> CompiledCode compile = >>> engine.CreateScriptSourceFromFile("test.py", new >>> UTF8Encoding(), SourceCodeKind.Statements).Compile(); >>> ScriptScope scope = engine.CreateScope(); >>> ObjectOperations operations = engine.Operations; >>> >>> try >>> { >>> compile.Execute(scope); >>> } >>> catch (Exception ex) >>> { >>> ExceptionOperations eo = >>> engine.GetService(); >>> Console.WriteLine(eo.FormatException(ex)); >>> } >>> >>> GetData = scope.GetVariable("return_crap"); >>> >>> object data = GetData(); >>> } >>> >>> public static object GetDataFromCSharp() >>> { >>> return "test"; >>> } >>> >>> -------------------------- >>> >>> Of course an error will occur because GetDataFromCSharp has not yet >>> been >>> defined. I was wondering how one would go to register the function :) >>> >> >> > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- http://www.ironpythoninaction.com/ From dinov at microsoft.com Wed Mar 18 16:50:00 2009 From: dinov at microsoft.com (Dino Viehland) Date: Wed, 18 Mar 2009 08:50:00 -0700 Subject: [IronPython] How do I run python functions and make the python code remember variables between calls from C#? In-Reply-To: <22570584.post@talk.nabble.com> References: <22570584.post@talk.nabble.com> Message-ID: <350E7D38B6D819428718949920EC2355571C2D4585@NA-EXMSG-C102.redmond.corp.microsoft.com> The documentation for using the hosting APIs is available here: http://dlr.codeplex.com/Wiki/View.aspx?title=Docs%20and%20specs&referringTitle=Home as "dlr-hosting-spec.doc" > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of BlackMan890 > Sent: Wednesday, March 18, 2009 12:48 AM > To: users at lists.ironpython.com > Subject: [IronPython] How do I run python functions and make the python > code remember variables between calls from C#? > > > Hi there. > > When I run the following .py from C#: > > --- test.py ---------------- > > global crap > crap = None > > def set_crap(): > crap = "yay" > > def return_crap(): > return crap > --------------------------- > > And run the functions set_crap and return_crap from C# using the > following > code: > > --- program.cs ---------------- > --- Code is not being displayed right here, view the uploaded file I > sent > --- > ------------------------------- > > static void Main(string[] args) > { > ScriptEngine engine = Python.CreateEngine(); > ScriptSource source = > engine.CreateScriptSourceFromFile("test.py"); > ScriptScope scope = engine.CreateScope(); > > try > { > > source.Execute(scope); > > } > catch (Exception ex) > { > ExceptionOperations eo = > engine.GetService(); > Console.WriteLine(eo.FormatException(ex)); > } > > SetData = scope.GetVariable("set_crap"); > GetData = scope.GetVariable("return_crap"); > > SetData(); > object temp = GetData(); > > Console.ReadLine(); > } > > static Func SetData; > static Func GetData; > ------------------------------- > > The code compiles and runs but "temp" is always null. > How would one go of running IronPython while maintaining all variables > inside python? > Cause the way I see it, whenever I run a function, all variables are > resettet. > > > Sincerely: > Jonatan Nilsson > Iceland > > > P.S. > I am using IronPython 2.0.1 > > P.P.S. > Your documentation for C# using IronPython 2.0.1 are nonexistant :S > Where > are the documentation on using IronPython 2.0.1 in C#? > http://www.nabble.com/file/p22570584/program.cs program.cs > -- > View this message in context: http://www.nabble.com/How-do-I-run- > python-functions-and-make-the-python-code-remember-variables-between- > calls-from-C---tp22570584p22570584.html > Sent from the IronPython mailing list archive at Nabble.com. > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From blackman at simnet.is Wed Mar 18 17:07:41 2009 From: blackman at simnet.is (Jonatan Nilsson) Date: Wed, 18 Mar 2009 16:07:41 +0000 Subject: [IronPython] How come I cant import time or threading in IronPython In-Reply-To: <49C1164D.8010406@voidspace.org.uk> References: <22581456.post@talk.nabble.com> <49C1164D.8010406@voidspace.org.uk> Message-ID: <49C11C4D.2040609@simnet.is> Thank you for your quick response. I tried doing what you asked me. I added the following to the engine code: --------------------------- ScriptEngine engine = Python.CreateEngine(); engine.SetSearchPaths(new string[] { "C:\\Program Files\\IronPython-2.0.1\\Lib\\", "C:\\Python25\\Lib\\" }); --------------------------- When I run the following python code: --------------------------- import sys print(sys.path) import threading --------------------------- It prints out: ['C:\\Program Files\\IronPython-2.0.1\\Lib\\', 'C:\\Python25\\Lib\\'] Still it crashes with the same message: "No module named thread" When I go into the "C:\Program Files\IronPython-2.0.1\Lib\threading.py" I find the following: --------------------------- try: import thread except ImportError: del _sys.modules[__name__] raise --------------------------- I am wondering that maybe it is not finding "thread" because I am using C# and the "thread" is a C library... Also when I try to run "import time" it also complains that module time doesn't exist. This is true cause there is no time.py in the Lib folder. Maybe I have a faulty install or not the complete Python installed in my computer? Sincerely: Jonatan Nilsson Iceland Michael Foord wrote: > These libraries you are attempting to import are Python standard > library modules. To import them you must have the Python standard > library available - and on sys.path for the engine being used to do > the imports. > > You set sys.path programattically using engine.SetSearchPaths (?) > passing in an array of strings. > > All the best, > > Michael Foord > > BlackMan890 wrote: >> Hi there. >> >> this has probably been answered before but I cant seem to find the >> answer. >> When I run "import time" in python through IronPython using C#, an >> exception >> occurs with the message: "no module named time". >> The same thing happens when I run "import threading" except with a >> different >> exception: "No module named thread" >> >> Why am I encountering there problems? >> >> >> Sincerely: >> Jonatan Nilsson >> Iceland >> >> >> > > From dinov at microsoft.com Wed Mar 18 17:12:14 2009 From: dinov at microsoft.com (Dino Viehland) Date: Wed, 18 Mar 2009 09:12:14 -0700 Subject: [IronPython] How come I cant import time or threading in IronPython In-Reply-To: <49C11C4D.2040609@simnet.is> References: <22581456.post@talk.nabble.com> <49C1164D.8010406@voidspace.org.uk> <49C11C4D.2040609@simnet.is> Message-ID: <350E7D38B6D819428718949920EC2355571C2D45AF@NA-EXMSG-C102.redmond.corp.microsoft.com> Do you have IronPython.Modules.dll next to IronPython.dll? IronPython.Modules.dll contains the implementation of thread. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Jonatan Nilsson > Sent: Wednesday, March 18, 2009 9:08 AM > To: Discussion of IronPython > Subject: Re: [IronPython] How come I cant import time or threading in > IronPython > > Thank you for your quick response. > > I tried doing what you asked me. > I added the following to the engine code: > > --------------------------- > ScriptEngine engine = Python.CreateEngine(); > engine.SetSearchPaths(new string[] { "C:\\Program > Files\\IronPython-2.0.1\\Lib\\", "C:\\Python25\\Lib\\" }); > --------------------------- > > When I run the following python code: > > --------------------------- > import sys > print(sys.path) > import threading > --------------------------- > > It prints out: > ['C:\\Program Files\\IronPython-2.0.1\\Lib\\', 'C:\\Python25\\Lib\\'] > > Still it crashes with the same message: > "No module named thread" > > When I go into the "C:\Program Files\IronPython-2.0.1\Lib\threading.py" > I find the following: > --------------------------- > try: > import thread > except ImportError: > del _sys.modules[__name__] > raise > --------------------------- > > I am wondering that maybe it is not finding "thread" because I am using > C# and the "thread" is a C library... > > Also when I try to run "import time" it also complains that module time > doesn't exist. This is true cause there is no time.py in the Lib > folder. > Maybe I have a faulty install or not the complete Python installed in > my > computer? > > > Sincerely: > Jonatan Nilsson > Iceland > > > Michael Foord wrote: > > These libraries you are attempting to import are Python standard > > library modules. To import them you must have the Python standard > > library available - and on sys.path for the engine being used to do > > the imports. > > > > You set sys.path programattically using engine.SetSearchPaths (?) > > passing in an array of strings. > > > > All the best, > > > > Michael Foord > > > > BlackMan890 wrote: > >> Hi there. > >> > >> this has probably been answered before but I cant seem to find the > >> answer. > >> When I run "import time" in python through IronPython using C#, an > >> exception > >> occurs with the message: "no module named time". > >> The same thing happens when I run "import threading" except with a > >> different > >> exception: "No module named thread" > >> > >> Why am I encountering there problems? > >> > >> > >> Sincerely: > >> Jonatan Nilsson > >> Iceland > >> > >> > >> > > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From blackman at simnet.is Wed Mar 18 17:18:16 2009 From: blackman at simnet.is (Jonatan Nilsson) Date: Wed, 18 Mar 2009 16:18:16 +0000 Subject: [IronPython] How come I cant import time or threading in IronPython In-Reply-To: <49C11C4D.2040609@simnet.is> References: <22581456.post@talk.nabble.com> <49C1164D.8010406@voidspace.org.uk> <49C11C4D.2040609@simnet.is> Message-ID: <49C11EC8.10400@simnet.is> Ok, I figured it out. I forgot to add "C:\\Program Files\\IronPython-2.0.1" and "C:\\Python25" Thanks for all the help :D Jonatan Nilsson wrote: > Thank you for your quick response. > > I tried doing what you asked me. > I added the following to the engine code: > > --------------------------- > ScriptEngine engine = Python.CreateEngine(); > engine.SetSearchPaths(new string[] { "C:\\Program > Files\\IronPython-2.0.1\\Lib\\", "C:\\Python25\\Lib\\" }); > --------------------------- > > When I run the following python code: > > --------------------------- > import sys > print(sys.path) > import threading > --------------------------- > > It prints out: > ['C:\\Program Files\\IronPython-2.0.1\\Lib\\', 'C:\\Python25\\Lib\\'] > > Still it crashes with the same message: > "No module named thread" > > When I go into the "C:\Program > Files\IronPython-2.0.1\Lib\threading.py" I find the following: > --------------------------- > try: > import thread > except ImportError: > del _sys.modules[__name__] > raise > --------------------------- > > I am wondering that maybe it is not finding "thread" because I am > using C# and the "thread" is a C library... > > Also when I try to run "import time" it also complains that module > time doesn't exist. This is true cause there is no time.py in the Lib > folder. Maybe I have a faulty install or not the complete Python > installed in my computer? > > > Sincerely: > Jonatan Nilsson > Iceland > > > Michael Foord wrote: >> These libraries you are attempting to import are Python standard >> library modules. To import them you must have the Python standard >> library available - and on sys.path for the engine being used to do >> the imports. >> >> You set sys.path programattically using engine.SetSearchPaths (?) >> passing in an array of strings. >> >> All the best, >> >> Michael Foord >> >> BlackMan890 wrote: >>> Hi there. >>> >>> this has probably been answered before but I cant seem to find the >>> answer. >>> When I run "import time" in python through IronPython using C#, an >>> exception >>> occurs with the message: "no module named time". >>> The same thing happens when I run "import threading" except with a >>> different >>> exception: "No module named thread" >>> >>> Why am I encountering there problems? >>> >>> >>> Sincerely: >>> Jonatan Nilsson >>> Iceland >>> >>> >>> >> >> > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From timr at probo.com Wed Mar 18 18:18:38 2009 From: timr at probo.com (Tim Roberts) Date: Wed, 18 Mar 2009 10:18:38 -0700 Subject: [IronPython] How do I run python functions and make the python code remember variables between calls from C#? In-Reply-To: References: Message-ID: <49C12CEE.6020605@probo.com> On Wed, 18 Mar 2009 00:47:30 -0700 (PDT), BlackMan890 > Hi there. > > When I run the following .py from C#: > > --- test.py ---------------- > > global crap > crap = None > > def set_crap(): > crap = "yay" > > def return_crap(): > return crap > --------------------------- If you are going to modify a global variable within a function, you must use the "global" statement WITHIN THAT FUNCTION. Viz: # test.py crap = None def set_crap(): global crap crap = "yay" def return_crap(): return crap In your code, "crap" within "set_crap" is just a local variable, which goes away when the function exists. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From antonio.piteira at wtvision.com Wed Mar 18 19:18:42 2009 From: antonio.piteira at wtvision.com (=?iso-8859-1?Q?Ant=F3nio_Piteira?=) Date: Wed, 18 Mar 2009 18:18:42 -0000 Subject: [IronPython] Problem importing OS... Message-ID: <49c13b07.19e7300a.7868.ffffd731@mx.google.com> Hello guys, I?m trying to import os lib and I get the following error message: ?No module named errno? Any ideas? Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Wed Mar 18 21:11:14 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Wed, 18 Mar 2009 20:11:14 +0000 Subject: [IronPython] Problem importing OS... In-Reply-To: <49c13b07.19e7300a.7868.ffffd731@mx.google.com> References: <49c13b07.19e7300a.7868.ffffd731@mx.google.com> Message-ID: <49C15562.4@voidspace.org.uk> Hello Antonio, Can you post the full traceback please? Michael Ant?nio Piteira wrote: > > * * > > * * > > * * > > > > Hello guys, > > I?m trying to import os lib and I get the following error message: > > ?No module named errno? > > Any ideas? > > Thank you > > * * > > * * > > > > > ** > > > * * > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ From dinov at microsoft.com Wed Mar 18 21:15:47 2009 From: dinov at microsoft.com (Dino Viehland) Date: Wed, 18 Mar 2009 13:15:47 -0700 Subject: [IronPython] Problem importing OS... In-Reply-To: <49C15562.4@voidspace.org.uk> References: <49c13b07.19e7300a.7868.ffffd731@mx.google.com> <49C15562.4@voidspace.org.uk> Message-ID: <350E7D38B6D819428718949920EC2355571C2D47C6@NA-EXMSG-C102.redmond.corp.microsoft.com> Also make sure you have IronPython.Modules.dll next to IronPython.dll (if you're hosting IronPython instead of just running from the command line). > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Wednesday, March 18, 2009 1:11 PM > To: Discussion of IronPython > Subject: Re: [IronPython] Problem importing OS... > > Hello Antonio, > > Can you post the full traceback please? > > Michael > > > Ant?nio Piteira wrote: > > > > * * > > > > * * > > > > * * > > > > > > > > Hello guys, > > > > I'm trying to import os lib and I get the following error message: > > > > "No module named errno" > > > > Any ideas? > > > > Thank you > > > > * * > > > > * * > > > > > > > > > > ** > > > > > > * * > > > > > > > > > > --------------------------------------------------------------------- > --- > > > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > -- > http://www.ironpythoninaction.com/ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From antonio.piteira at wtvision.com Wed Mar 18 21:17:58 2009 From: antonio.piteira at wtvision.com (=?iso-8859-1?Q?Ant=F3nio_Piteira?=) Date: Wed, 18 Mar 2009 20:17:58 -0000 Subject: [IronPython] Problem importing OS... In-Reply-To: <49C15562.4@voidspace.org.uk> References: <49c13b07.19e7300a.7868.ffffd731@mx.google.com> <49C15562.4@voidspace.org.uk> Message-ID: <49c156f8.0116300a.6c0c.ffffef63@mx.google.com> Hello Michael, Thank you for your reply. I've solved the problem importing "nt" instead of "os". Thank you! ------------------------------------------------------------------- Hello Antonio, Can you post the full traceback please? Michael Ant?nio Piteira wrote: > > * * > > * * > > * * > > > > Hello guys, > > I?m trying to import os lib and I get the following error message: > > ?No module named errno? > > Any ideas? > > Thank you > > * * > > * * > > > > > ** > > > * * > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Thu Mar 19 15:24:45 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Thu, 19 Mar 2009 14:24:45 +0000 Subject: [IronPython] Numerical Computing in IronPython and IronPython Podcast Message-ID: <49C255AD.2090202@voidspace.org.uk> Hello all, A couple of interesting links: http://www.johndcook.com/blog/2009/03/19/ironclad-ironpytho/# Article on "Numerical computing in IronPython with Ironclad" by William Reade (lead developer of Ironclad). http://www.dotnetrocks.com/default.aspx?showNum=429 Michael Foord Talks IronPython! A 53minute podcast on dynamic languages on the .NET framework (I'm even nice about Ruby!), Python, IronPython and of course Resolver One and IronPython in Action. Towards the end of the podcast there is a discount code for ordering IronPython in Action, so well worth listening to all the way to the end. ;-) All the best, Michael Foord -- http://www.ironpythoninaction.com/ From kristian.jaksch at gmail.com Thu Mar 19 21:35:49 2009 From: kristian.jaksch at gmail.com (Kristian) Date: Thu, 19 Mar 2009 13:35:49 -0700 (PDT) Subject: [IronPython] Best way to stop script execution? Message-ID: We let users execute scripts in our app using the exec command. We want to provide a stop button to stop script execution but how is the best way to do that? Can a background worker be used for that? Thanks for help! From fuzzyman at voidspace.org.uk Thu Mar 19 21:38:42 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Thu, 19 Mar 2009 20:38:42 +0000 Subject: [IronPython] Best way to stop script execution? In-Reply-To: References: Message-ID: <49C2AD52.2060806@voidspace.org.uk> Kristian wrote: > We let users execute scripts in our app using the exec command. We > want to provide a stop button to stop script execution but how is the > best way to do that? Can a background worker be used for that? > > Are the user scripts already running in a thread of their own? If they are you can abort the thread (with all the consequences that brings) using Thread.Abort. Michael > Thanks for help! > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From kristian.jaksch at gmail.com Thu Mar 19 21:56:09 2009 From: kristian.jaksch at gmail.com (Kristian Jaksch) Date: Thu, 19 Mar 2009 21:56:09 +0100 Subject: [IronPython] Best way to stop script execution? In-Reply-To: <49C2AD52.2060806@voidspace.org.uk> References: <49C2AD52.2060806@voidspace.org.uk> Message-ID: <1dab55500903191356g635b4808if509a21f8875c708@mail.gmail.com> Thanks for the reply. No, we haven't placed the script execution in their own thread. I guess the best way must be just to place the exec command in that thread. I'll check out Thread.Abort. 2009/3/19 Michael Foord > Kristian wrote: > >> We let users execute scripts in our app using the exec command. We >> want to provide a stop button to stop script execution but how is the >> best way to do that? Can a background worker be used for that? >> >> >> > > Are the user scripts already running in a thread of their own? If they are > you can abort the thread (with all the consequences that brings) using > Thread.Abort. > > Michael > > Thanks for help! >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > > > _______________________________________________ > 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 kristian.jaksch at gmail.com Fri Mar 20 13:59:45 2009 From: kristian.jaksch at gmail.com (Kristian Jaksch) Date: Fri, 20 Mar 2009 13:59:45 +0100 Subject: [IronPython] Best way to stop script execution? In-Reply-To: <1dab55500903191356g635b4808if509a21f8875c708@mail.gmail.com> References: <49C2AD52.2060806@voidspace.org.uk> <1dab55500903191356g635b4808if509a21f8875c708@mail.gmail.com> Message-ID: <1dab55500903200559l16bc0447tc0c645c155150750@mail.gmail.com> What about if we need access to the HTML DOM (It's a silverlight application) from that thread? During execution of scripts there might be printouts to the DOM. But how can we do that without illegal cross-threading? 2009/3/19 Kristian Jaksch > Thanks for the reply. > > No, we haven't placed the script execution in their own thread. I guess the > best way must be just to place the exec command in that thread. I'll check > out Thread.Abort. > > > 2009/3/19 Michael Foord > > Kristian wrote: >> >>> We let users execute scripts in our app using the exec command. We >>> want to provide a stop button to stop script execution but how is the >>> best way to do that? Can a background worker be used for that? >>> >>> >>> >> >> Are the user scripts already running in a thread of their own? If they are >> you can abort the thread (with all the consequences that brings) using >> Thread.Abort. >> >> Michael >> >> Thanks for help! >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >> >> >> -- >> http://www.ironpythoninaction.com/ >> http://www.voidspace.org.uk/blog >> >> >> >> _______________________________________________ >> 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 Jimmy.Schementi at microsoft.com Fri Mar 20 14:04:46 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Fri, 20 Mar 2009 13:04:46 +0000 Subject: [IronPython] Best way to stop script execution? In-Reply-To: <1dab55500903200559l16bc0447tc0c645c155150750@mail.gmail.com> References: <49C2AD52.2060806@voidspace.org.uk> <1dab55500903191356g635b4808if509a21f8875c708@mail.gmail.com> <1dab55500903200559l16bc0447tc0c645c155150750@mail.gmail.com> Message-ID: When running in a non-UI thread in Silverlight, you can dispatch back to the UI thread for UI interaction. Every UIElement has a "Dispatcher" property, so you just need to grab that and call BeginInvoke, passing a delegate. // In some background thread Application.Current.RootVisual.Dispatcher.BeginInvoke(delegate() { HtmlPage.Document.GetElementById("foo").SetProperty("innerHTML", "hi!") }); From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kristian Jaksch Sent: Friday, March 20, 2009 6:00 AM To: Discussion of IronPython Subject: Re: [IronPython] Best way to stop script execution? What about if we need access to the HTML DOM (It's a silverlight application) from that thread? During execution of scripts there might be printouts to the DOM. But how can we do that without illegal cross-threading? 2009/3/19 Kristian Jaksch > Thanks for the reply. No, we haven't placed the script execution in their own thread. I guess the best way must be just to place the exec command in that thread. I'll check out Thread.Abort. 2009/3/19 Michael Foord > Kristian wrote: We let users execute scripts in our app using the exec command. We want to provide a stop button to stop script execution but how is the best way to do that? Can a background worker be used for that? Are the user scripts already running in a thread of their own? If they are you can abort the thread (with all the consequences that brings) using Thread.Abort. Michael Thanks for help! _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog _______________________________________________ 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 kristian.jaksch at gmail.com Fri Mar 20 16:13:13 2009 From: kristian.jaksch at gmail.com (Kristian Jaksch) Date: Fri, 20 Mar 2009 16:13:13 +0100 Subject: [IronPython] Best way to stop script execution? In-Reply-To: References: <49C2AD52.2060806@voidspace.org.uk> <1dab55500903191356g635b4808if509a21f8875c708@mail.gmail.com> <1dab55500903200559l16bc0447tc0c645c155150750@mail.gmail.com> Message-ID: <1dab55500903200813l1d5b0f97m67b2bfc90ab00153@mail.gmail.com> Thanks for the reply Jimmy. We'll check it out. 2009/3/20 Jimmy Schementi > When running in a non-UI thread in Silverlight, you can dispatch back to > the UI thread for UI interaction. Every UIElement has a ?Dispatcher? > property, so you just need to grab that and call BeginInvoke, passing a > delegate. > > > > // In some background thread > > Application.Current.RootVisual.Dispatcher.BeginInvoke(delegate() { > > HtmlPage.Document.GetElementById(?foo?).SetProperty(?innerHTML?, ?hi!?) > > }); > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Kristian Jaksch > *Sent:* Friday, March 20, 2009 6:00 AM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] Best way to stop script execution? > > > > What about if we need access to the HTML DOM (It's a silverlight > application) from that thread? During execution of scripts there might be > printouts to the DOM. But how can we do that without illegal > cross-threading? > > 2009/3/19 Kristian Jaksch > > Thanks for the reply. > > No, we haven't placed the script execution in their own thread. I guess the > best way must be just to place the exec command in that thread. I'll check > out Thread.Abort. > > 2009/3/19 Michael Foord > > > > Kristian wrote: > > We let users execute scripts in our app using the exec command. We > want to provide a stop button to stop script execution but how is the > best way to do that? Can a background worker be used for that? > > > > > > Are the user scripts already running in a thread of their own? If they are > you can abort the thread (with all the consequences that brings) using > Thread.Abort. > > Michael > > > > Thanks for help! > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > > > > _______________________________________________ > 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 microsoft.com Fri Mar 20 18:24:21 2009 From: dinov at microsoft.com (Dino Viehland) Date: Fri, 20 Mar 2009 10:24:21 -0700 Subject: [IronPython] CP Issue #21659: Subclassing unicode In-Reply-To: References: <350E7D38B6D819428718949920EC2355571C2023A5@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <350E7D38B6D819428718949920EC2355571C2D50B8@NA-EXMSG-C102.redmond.corp.microsoft.com> FYI this is fixed in the 2.6 branch now. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Jeff Hardy > Sent: Tuesday, March 17, 2009 5:03 PM > To: Discussion of IronPython > Subject: Re: [IronPython] CP Issue #21659: Subclassing unicode > > On Mon, Mar 16, 2009 at 7:03 PM, Dino Viehland > wrote: > > Does this make it work? > > > > class x(unicode): > > ? ?def __init__(self, val): pass > > ? ?def __new__(cls, val): > > ? ? ? ? ? ?return unicode.__new__(cls, unicode(val)) > > > > > > x(1) > > > > I've voted for the bug and raised the priority to medium. ?I've left > it proposed until we triage it as a team (we triage bugs every Monday > morning so it'll be a week) but I might be able to fix it before then > :) > > > > Thanks, that did it. I had to extend it to handle all of the > parameters to unicode: > > def __new__(cls, object = '', *args, **kwargs): > return unicode.__new__(cls, unicode(object), *args, **kwargs) > > Only 227 more failures to go (out of 701, so not too bad). > > - Jeff > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From jdhardy at gmail.com Sat Mar 21 01:09:22 2009 From: jdhardy at gmail.com (Jeff Hardy) Date: Fri, 20 Mar 2009 18:09:22 -0600 Subject: [IronPython] Creating Dynamic Assemblies from IronPython 2.6 Message-ID: Hi all, I'm unable to create a Dynamic assembly from IronPython using AppDomain.DefineDynamicAssembly. The Python file attached results in the following error: Traceback (most recent call last): File "pinvoke.py", line 5, in pinvoke.py File "mscorlib", line unknown, in DefineDynamicAssembly File "mscorlib", line unknown, in InternalDefineDynamicAssembly File "mscorlib", line unknown, in nCreateDynamicAssembly File "mscorlib", line unknown, in CheckGrantSetHelper SystemError: Object reference not set to an instance of an object. The equivalent C# program (also attached) works fine. I'm guessing there's something special about IronPython's AppDomain, but I'm not sure what it is. This is using revision 48140. Any ideas? - Jeff -------------- next part -------------- A non-text attachment was scrubbed... Name: pinvoke.py Type: application/octet-stream Size: 292 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Program.cs Type: application/octet-stream Size: 457 bytes Desc: not available URL: From curt at hagenlocher.org Sat Mar 21 01:29:00 2009 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Fri, 20 Mar 2009 17:29:00 -0700 Subject: [IronPython] Creating Dynamic Assemblies from IronPython 2.6 In-Reply-To: References: Message-ID: I think this is something that broke well before the 2.0 release. To work around it in pyc.py, we added DefineDynamicAssembly to the PythonOps class in IronPython: import clr clr.AddReference('IronPython') from IronPython.Runtime.Operations import PythonOps assemblyBuilder = PythonOps.DefineDynamicAssembly(...) 2009/3/20 Jeff Hardy > Hi all, > I'm unable to create a Dynamic assembly from IronPython using > AppDomain.DefineDynamicAssembly. The Python file attached results in > the following error: > > Traceback (most recent call last): > File "pinvoke.py", line 5, in pinvoke.py > File "mscorlib", line unknown, in DefineDynamicAssembly > File "mscorlib", line unknown, in InternalDefineDynamicAssembly > File "mscorlib", line unknown, in nCreateDynamicAssembly > File "mscorlib", line unknown, in CheckGrantSetHelper > SystemError: Object reference not set to an instance of an object. > > The equivalent C# program (also attached) works fine. I'm guessing > there's something special about IronPython's AppDomain, but I'm not > sure what it is. This is using revision 48140. Any ideas? > > - Jeff > > _______________________________________________ > 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 microsoft.com Sat Mar 21 01:50:44 2009 From: dinov at microsoft.com (Dino Viehland) Date: Fri, 20 Mar 2009 17:50:44 -0700 Subject: [IronPython] Creating Dynamic Assemblies from IronPython 2.6 In-Reply-To: References: Message-ID: <350E7D38B6D819428718949920EC2355571C3A798F@NA-EXMSG-C102.redmond.corp.microsoft.com> It's actually a CLR bug - we can't call this method from a dynamic method. We could probably add a workaround and force it to always be called via reflection. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher Sent: Friday, March 20, 2009 5:29 PM To: Discussion of IronPython Subject: Re: [IronPython] Creating Dynamic Assemblies from IronPython 2.6 I think this is something that broke well before the 2.0 release. To work around it in pyc.py, we added DefineDynamicAssembly to the PythonOps class in IronPython: import clr clr.AddReference('IronPython') from IronPython.Runtime.Operations import PythonOps assemblyBuilder = PythonOps.DefineDynamicAssembly(...) 2009/3/20 Jeff Hardy > Hi all, I'm unable to create a Dynamic assembly from IronPython using AppDomain.DefineDynamicAssembly. The Python file attached results in the following error: Traceback (most recent call last): File "pinvoke.py", line 5, in pinvoke.py File "mscorlib", line unknown, in DefineDynamicAssembly File "mscorlib", line unknown, in InternalDefineDynamicAssembly File "mscorlib", line unknown, in nCreateDynamicAssembly File "mscorlib", line unknown, in CheckGrantSetHelper SystemError: Object reference not set to an instance of an object. The equivalent C# program (also attached) works fine. I'm guessing there's something special about IronPython's AppDomain, but I'm not sure what it is. This is using revision 48140. Any ideas? - Jeff _______________________________________________ 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 jdhardy at gmail.com Sat Mar 21 17:44:22 2009 From: jdhardy at gmail.com (Jeff Hardy) Date: Sat, 21 Mar 2009 10:44:22 -0600 Subject: [IronPython] Creating Dynamic Assemblies from IronPython 2.6 In-Reply-To: References: Message-ID: Thanks Curt, that worked. Now I have a new problem - I can get a MethodInfo, but I need to be able to convert it to something I can call. Seo's old code used BuiltinFunction.MakeOrAdd, but that is now internal. Can this be made public, or is there a better way to handle it? - Jeff 2009/3/20 Curt Hagenlocher : > I think this is something that broke well before the 2.0 release. ?To work > around it in pyc.py, we?added DefineDynamicAssembly to the PythonOps class > in IronPython: > > import clr > clr.AddReference('IronPython') > from IronPython.Runtime.Operations import PythonOps > assemblyBuilder = PythonOps.DefineDynamicAssembly(...) > From sanxiyn at gmail.com Sat Mar 21 18:23:49 2009 From: sanxiyn at gmail.com (Seo Sanghyeon) Date: Sun, 22 Mar 2009 02:23:49 +0900 Subject: [IronPython] Latest IronPython on Mono Message-ID: <5b0248170903211023g154c278dk3bd59b8a2b60ba64@mail.gmail.com> Today I took some time trying to compile latest IronPython (48392) on latest Mono (129950). NAnt build file I used is here: https://fepy.svn.sourceforge.net/svnroot/fepy/trunk/patches/latest/IronPython.build Note that problem I discussed last time (IronPython 2.0 RC 2, December 2008) is now fixed in Mono, as dinov suggested. Namely, recognizing ExtensionAttribute from arbitrary assembly. http://lists.ironpython.com/pipermail/users-ironpython.com/2008-December/009179.html 1. Compile Mono SVN trunk (129950). 2. Get IronPython 48392. 3. Delete DynamicEventInfo.cs and IPythonCallable.cs. They are unused. 4. Run NAnt with IronPython.build. This results in: IronPython/Runtime/Types/BuiltinFunction.Generated.cs(158,21): error CS0019: Operator `==' cannot be applied to operands of type `TFuncType' and `IronPython.Runtime.Types.BuiltinFunction' This is clearly a Mono bug, and tracked as #415375. https://bugzilla.novell.com/show_bug.cgi?id=415375 If anyone has something to update, please, please post. -- Seo Sanghyeon From dinov at microsoft.com Sat Mar 21 18:45:45 2009 From: dinov at microsoft.com (Dino Viehland) Date: Sat, 21 Mar 2009 10:45:45 -0700 Subject: [IronPython] Creating Dynamic Assemblies from IronPython 2.6 In-Reply-To: References: Message-ID: <350E7D38B6D819428718949920EC2355571C3A79BD@NA-EXMSG-C102.redmond.corp.microsoft.com> If you only have 1 method and don't need overload resolution I'd suggest making a delegate using System.Delegate.CreateDelegate. Otherwise this could be made public. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Jeff Hardy > Sent: Saturday, March 21, 2009 9:44 AM > To: Discussion of IronPython > Subject: Re: [IronPython] Creating Dynamic Assemblies from IronPython > 2.6 > > Thanks Curt, that worked. Now I have a new problem - I can get a > MethodInfo, but I need to be able to convert it to something I can > call. Seo's old code used BuiltinFunction.MakeOrAdd, but that is now > internal. Can this be made public, or is there a better way to handle > it? > > - Jeff > > 2009/3/20 Curt Hagenlocher : > > I think this is something that broke well before the 2.0 release. ?To > work > > around it in pyc.py, we?added DefineDynamicAssembly to the PythonOps > class > > in IronPython: > > > > import clr > > clr.AddReference('IronPython') > > from IronPython.Runtime.Operations import PythonOps > > assemblyBuilder = PythonOps.DefineDynamicAssembly(...) > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at microsoft.com Sat Mar 21 18:51:04 2009 From: dinov at microsoft.com (Dino Viehland) Date: Sat, 21 Mar 2009 10:51:04 -0700 Subject: [IronPython] Latest IronPython on Mono In-Reply-To: <5b0248170903211023g154c278dk3bd59b8a2b60ba64@mail.gmail.com> References: <5b0248170903211023g154c278dk3bd59b8a2b60ba64@mail.gmail.com> Message-ID: <350E7D38B6D819428718949920EC2355571C3A79BE@NA-EXMSG-C102.redmond.corp.microsoft.com> Thanks for trying this! If this is the only issue you might try going back a week or two in the IronPython history. BuiltinFunction.Generated.cs is new code that was just added. Alternately you could probably delete BuiltinFunction.Generated.cs and just update BuiltinFunction.cs to remove it's IFastInvokable implementation. I'll get rid of the 2 extra files. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Seo Sanghyeon > Sent: Saturday, March 21, 2009 10:24 AM > To: Discussion of IronPython > Subject: [IronPython] Latest IronPython on Mono > > Today I took some time trying to compile latest IronPython (48392) on > latest Mono (129950). NAnt build file I used is here: > https://fepy.svn.sourceforge.net/svnroot/fepy/trunk/patches/latest/Iron > Python.build > > Note that problem I discussed last time (IronPython 2.0 RC 2, December > 2008) is now fixed in Mono, as dinov suggested. Namely, recognizing > ExtensionAttribute from arbitrary assembly. > http://lists.ironpython.com/pipermail/users-ironpython.com/2008- > December/009179.html > > 1. Compile Mono SVN trunk (129950). > 2. Get IronPython 48392. > 3. Delete DynamicEventInfo.cs and IPythonCallable.cs. They are unused. > 4. Run NAnt with IronPython.build. > > This results in: > IronPython/Runtime/Types/BuiltinFunction.Generated.cs(158,21): error > CS0019: Operator `==' cannot be applied to operands of type > `TFuncType' and `IronPython.Runtime.Types.BuiltinFunction' > > This is clearly a Mono bug, and tracked as #415375. > https://bugzilla.novell.com/show_bug.cgi?id=415375 > > If anyone has something to update, please, please post. > > -- > Seo Sanghyeon > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From curt at hagenlocher.org Sat Mar 21 18:51:36 2009 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sat, 21 Mar 2009 10:51:36 -0700 Subject: [IronPython] Creating Dynamic Assemblies from IronPython 2.6 In-Reply-To: <350E7D38B6D819428718949920EC2355571C3A79BD@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <350E7D38B6D819428718949920EC2355571C3A79BD@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: In case it's interesting or useful, I've attached some p/Invoke stuff I was playing with before I got derailed by the DefineDynamicAssembly problem and then joined Microsoft :). On Sat, Mar 21, 2009 at 10:45 AM, Dino Viehland wrote: > If you only have 1 method and don't need overload resolution I'd suggest > making a delegate using System.Delegate.CreateDelegate. Otherwise this > could be made public. > > > -----Original Message----- > > From: users-bounces at lists.ironpython.com [mailto:users- > > bounces at lists.ironpython.com] On Behalf Of Jeff Hardy > > Sent: Saturday, March 21, 2009 9:44 AM > > To: Discussion of IronPython > > Subject: Re: [IronPython] Creating Dynamic Assemblies from IronPython > > 2.6 > > > > Thanks Curt, that worked. Now I have a new problem - I can get a > > MethodInfo, but I need to be able to convert it to something I can > > call. Seo's old code used BuiltinFunction.MakeOrAdd, but that is now > > internal. Can this be made public, or is there a better way to handle > > it? > > > > - Jeff > > > > 2009/3/20 Curt Hagenlocher : > > > I think this is something that broke well before the 2.0 release. To > > work > > > around it in pyc.py, we added DefineDynamicAssembly to the PythonOps > > class > > > in IronPython: > > > > > > import clr > > > clr.AddReference('IronPython') > > > from IronPython.Runtime.Operations import PythonOps > > > assemblyBuilder = PythonOps.DefineDynamicAssembly(...) > > > > > _______________________________________________ > > 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: -------------- next part -------------- A non-text attachment was scrubbed... Name: pinvoke.py Type: application/octet-stream Size: 7523 bytes Desc: not available URL: From sanxiyn at gmail.com Sat Mar 21 20:21:23 2009 From: sanxiyn at gmail.com (Seo Sanghyeon) Date: Sun, 22 Mar 2009 04:21:23 +0900 Subject: [IronPython] Latest IronPython on Mono In-Reply-To: <350E7D38B6D819428718949920EC2355571C3A79BE@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <5b0248170903211023g154c278dk3bd59b8a2b60ba64@mail.gmail.com> <350E7D38B6D819428718949920EC2355571C3A79BE@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <5b0248170903211221s52ed8320v4df3c7dbcf9b749a@mail.gmail.com> 2009/3/22 Dino Viehland : > If this is the only issue you might try going back a week or two in the IronPython history. ?BuiltinFunction.Generated.cs is new code that was just added. ?Alternately you could probably delete BuiltinFunction.Generated.cs and just update BuiltinFunction.cs to remove it's IFastInvokable implementation. Thanks a lot for this hint! I went back to 48270, and this time it compiles and runs without a hitch. I will test a bit more and write another email. -- Seo Sanghyeon From jdhardy at gmail.com Sat Mar 21 21:16:36 2009 From: jdhardy at gmail.com (Jeff Hardy) Date: Sat, 21 Mar 2009 14:16:36 -0600 Subject: [IronPython] Creating Dynamic Assemblies from IronPython 2.6 In-Reply-To: <350E7D38B6D819428718949920EC2355571C3A79BD@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <350E7D38B6D819428718949920EC2355571C3A79BD@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: Hi Dino, I'm updating Seo's old ctypes.py to work with 2.6, so unfortuantely it's a little more complex than just one method. I could probably use a delegate that takes an object[], but BuiltinFunction contains that code already, and it is a lot more optimized than I could manage. Plus it's less code for me to write :). - Jeff On Sat, Mar 21, 2009 at 11:45 AM, Dino Viehland wrote: > If you only have 1 method and don't need overload resolution I'd suggest making a delegate using System.Delegate.CreateDelegate. ? Otherwise this could be made public. > From fuzzyman at voidspace.org.uk Sun Mar 22 00:36:48 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sat, 21 Mar 2009 23:36:48 +0000 Subject: [IronPython] Latest IronPython on Mono In-Reply-To: <5b0248170903211221s52ed8320v4df3c7dbcf9b749a@mail.gmail.com> References: <5b0248170903211023g154c278dk3bd59b8a2b60ba64@mail.gmail.com> <350E7D38B6D819428718949920EC2355571C3A79BE@NA-EXMSG-C102.redmond.corp.microsoft.com> <5b0248170903211221s52ed8320v4df3c7dbcf9b749a@mail.gmail.com> Message-ID: <49C57A10.4000603@voidspace.org.uk> Seo Sanghyeon wrote: > 2009/3/22 Dino Viehland : > >> If this is the only issue you might try going back a week or two in the IronPython history. BuiltinFunction.Generated.cs is new code that was just added. Alternately you could probably delete BuiltinFunction.Generated.cs and just update BuiltinFunction.cs to remove it's IFastInvokable implementation. >> > > Thanks a lot for this hint! I went back to 48270, and this time it > compiles and runs without a hitch. I will test a bit more and write > another email. > > Which branch is that tracking? An updated FePy release for IronPython 2.0 would be awesome. One based against the released 2.0.1 would probably be best if possible. Thanks Michael Foord -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From akkireddy.gunta at gmail.com Sun Mar 22 15:29:58 2009 From: akkireddy.gunta at gmail.com (Akki Reddy) Date: Sun, 22 Mar 2009 19:59:58 +0530 Subject: [IronPython] Fails to import IronPythonConsole Message-ID: Hi, I have installed IronPython 2.0.1. We have a project running under CPython, but fails to run under IronPython. It is fails import the module IronPythonConsole. The script contains the following lines: import clr,sys clr.AddReferenceToFileAndPath(sys.executable) import IronPythonConsole The script fails with the following error when running under IronPython: ImportError: No module named IronPythonConsole Does anybody know how to resolve this issue? Thanks in advance, Akki. -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Sun Mar 22 15:38:26 2009 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sun, 22 Mar 2009 07:38:26 -0700 Subject: [IronPython] Fails to import IronPythonConsole In-Reply-To: References: Message-ID: You can import "clr" under CPython? Neat! :P I don't believe there's a namespace called IronPythonConsole in IronPython 2. What specifically are you trying to use from that namespace? 2009/3/22 Akki Reddy > Hi, > I have installed IronPython 2.0.1. We have a project running under CPython, > but fails to run under IronPython. > It is fails import the module IronPythonConsole. > > The script contains the following lines: > > import clr,sys > clr.AddReferenceToFileAndPath(sys.executable) > import IronPythonConsole > > The script fails with the following error when running under IronPython: > ImportError: No module named IronPythonConsole > > > Does anybody know how to resolve this issue? > > Thanks in advance, > Akki. > > _______________________________________________ > 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 akkireddy.gunta at gmail.com Sun Mar 22 16:43:53 2009 From: akkireddy.gunta at gmail.com (Akki Reddy) Date: Sun, 22 Mar 2009 21:13:53 +0530 Subject: [IronPython] Fails to import IronPythonConsole In-Reply-To: References: Message-ID: Hi Curt, Thanks for a prompt response. The usage in python\pyreadline\pyreadline\console\ironpython_console.py is as follows: import clr,sys clr.AddReferenceToFileAndPath(sys.executable) import IronPythonConsole ... ... ... class IronPythonWrapper(IronPythonConsole.IConsole): def ReadLine(self,autoIndentSize): return hook_wrap() def Write(self,text, style): System.Console.Write(text) def WriteLine(self,text, style): System.Console.WriteLine(text) IronPythonConsole.PythonCommandLine.MyConsole = IronPythonWrapper() This is from a third party python package. Can I replace it with any available console functionality from the latest IronPython? Thanks, Akki. 2009/3/22 Curt Hagenlocher > You can import "clr" under CPython? Neat! :P > > I don't believe there's a namespace called IronPythonConsole in IronPython > 2. What specifically are you trying to use from that namespace? > > 2009/3/22 Akki Reddy > >> Hi, >> I have installed IronPython 2.0.1. We have a project running under >> CPython, but fails to run under IronPython. >> It is fails import the module IronPythonConsole. >> >> The script contains the following lines: >> >> import clr,sys >> clr.AddReferenceToFileAndPath(sys.executable) >> import IronPythonConsole >> >> The script fails with the following error when running under IronPython: >> ImportError: No module named IronPythonConsole >> >> >> Does anybody know how to resolve this issue? >> >> Thanks in advance, >> Akki. >> >> _______________________________________________ >> 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 curt at hagenlocher.org Sun Mar 22 17:50:53 2009 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sun, 22 Mar 2009 09:50:53 -0700 Subject: [IronPython] Fails to import IronPythonConsole In-Reply-To: References: Message-ID: Interesting. I didn't realize that pyreadline had specific IronPython support. In 2.0, the way to hook input and output is through the DLR hosting interfaces -- through ScriptRuntime.IO. There may be quite a few changes required to adapt this. Have you asked the pyreadline maintainers if they have a 2.0-compatible version? 2009/3/22 Akki Reddy > Hi Curt, > > Thanks for a prompt response. > > > The usage in python\pyreadline\pyreadline\console\ironpython_console.py is > as follows: > > import clr,sys > clr.AddReferenceToFileAndPath(sys.executable) > import IronPythonConsole > > ... > ... > ... > > class IronPythonWrapper(IronPythonConsole.IConsole): > def ReadLine(self,autoIndentSize): > return hook_wrap() > def Write(self,text, style): > System.Console.Write(text) > def WriteLine(self,text, style): > System.Console.WriteLine(text) > IronPythonConsole.PythonCommandLine.MyConsole = IronPythonWrapper() > > > This is from a third party python package. Can I replace it with any > available console functionality from the latest IronPython? > > > Thanks, > Akki. > > 2009/3/22 Curt Hagenlocher > > You can import "clr" under CPython? Neat! :P >> >> I don't believe there's a namespace called IronPythonConsole in IronPython >> 2. What specifically are you trying to use from that namespace? >> >> 2009/3/22 Akki Reddy >> >>> Hi, >>> I have installed IronPython 2.0.1. We have a project running under >>> CPython, but fails to run under IronPython. >>> It is fails import the module IronPythonConsole. >>> >>> The script contains the following lines: >>> >>> import clr,sys >>> clr.AddReferenceToFileAndPath(sys.executable) >>> import IronPythonConsole >>> >>> The script fails with the following error when running under IronPython: >>> ImportError: No module named IronPythonConsole >>> >>> >>> Does anybody know how to resolve this issue? >>> >>> Thanks in advance, >>> Akki. >>> >>> _______________________________________________ >>> 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zsidoz at innodev.hu Mon Mar 23 09:25:24 2009 From: zsidoz at innodev.hu (=?ISO-8859-1?Q?Zsid=F3_Zolt=E1n?=) Date: Mon, 23 Mar 2009 09:25:24 +0100 Subject: [IronPython] memory leak in IP 2.0.1 References: <5b0248170903211023g154c278dk3bd59b8a2b60ba64@mail.gmail.com> <350E7D38B6D819428718949920EC2355571C3A79BE@NA-EXMSG-C102.redmond.corp.microsoft.com> <5b0248170903211221s52ed8320v4df3c7dbcf9b749a@mail.gmail.com> <49C57A10.4000603@voidspace.org.uk> Message-ID: <3FF8A94751544AC1991529D9D502EAFF@TOSHIBA> Hello, I host ironPython in c#. It worked well. I changed from 1.1.2 to 2.0.1 and now I have a memory leak. I do not know why. Any idea? I do not know the working of DLR but is there a GenerateCodeSnippet option in IP2.0.1 too? Perhaps it causes the memory leak. Thanks, Zoltan From empirebuilder at gmail.com Mon Mar 23 09:34:27 2009 From: empirebuilder at gmail.com (Dody Gunawinata) Date: Mon, 23 Mar 2009 10:34:27 +0200 Subject: [IronPython] memory leak in IP 2.0.1 In-Reply-To: <3FF8A94751544AC1991529D9D502EAFF@TOSHIBA> References: <5b0248170903211023g154c278dk3bd59b8a2b60ba64@mail.gmail.com> <350E7D38B6D819428718949920EC2355571C3A79BE@NA-EXMSG-C102.redmond.corp.microsoft.com> <5b0248170903211221s52ed8320v4df3c7dbcf9b749a@mail.gmail.com> <49C57A10.4000603@voidspace.org.uk> <3FF8A94751544AC1991529D9D502EAFF@TOSHIBA> Message-ID: <8cd017b80903230134w667d4109n96303dad535b89c8@mail.gmail.com> This was response from Dino a couple of emails ago. Direct quote " ust some comments on this as there?s a few issues intertwined here: 1. Optimized code ? this is currently the default and part of the original problem. If you execute code in ?optimized? mode we generate an uncollectible type. In 2.6 I?m switching the default to be non-optimized and I also am trying out a change that should reduce the amount of leakage when we do this. That will make the out of the box experience much better. 2. Multiple script runtimes ? there?s a bug in the DLR when you repeatedly create script runtimes that the rules aren?t getting collected. This is supposed to be fixed in 2.6 but I?m still seeing some leaks in this scenario that I?ll look into and fix. Back-porting this to 2.0 would be quite difficult as a lot of things have changed but we could certainly look at backporting a different fix to 2.0. 3. There?s a repro that defines ?TestScriptOldClass? + n which leaks. All class / function / member names in code get interned and this is where this leak is coming from. If you remove the + n then everything works. We may get rid of this interning at some point in the future but it?s a fairly significant change. I?m inclined to believe this one isn?t as much of an issue as usually you aren?t compiling code with new names every single type. " 2009/3/23 Zsid? Zolt?n > Hello, > > I host ironPython in c#. It worked well. I changed from 1.1.2 to 2.0.1 and > now I have a memory leak. > > I do not know why. Any idea? > > I do not know the working of DLR but is there a GenerateCodeSnippet option > in IP2.0.1 too? > > Perhaps it causes the memory leak. > > Thanks, > > Zoltan > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- nomadlife.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From empirebuilder at gmail.com Mon Mar 23 09:40:27 2009 From: empirebuilder at gmail.com (Dody Gunawinata) Date: Mon, 23 Mar 2009 10:40:27 +0200 Subject: [IronPython] memory leak in IP 2.0.1 In-Reply-To: <3FF8A94751544AC1991529D9D502EAFF@TOSHIBA> References: <5b0248170903211023g154c278dk3bd59b8a2b60ba64@mail.gmail.com> <350E7D38B6D819428718949920EC2355571C3A79BE@NA-EXMSG-C102.redmond.corp.microsoft.com> <5b0248170903211221s52ed8320v4df3c7dbcf9b749a@mail.gmail.com> <49C57A10.4000603@voidspace.org.uk> <3FF8A94751544AC1991529D9D502EAFF@TOSHIBA> Message-ID: <8cd017b80903230140ub72ebc2h4e134c4010c0ae0@mail.gmail.com> There is a bug item for this memory leak issue http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=20399 2009/3/23 Zsid? Zolt?n > Hello, > > I host ironPython in c#. It worked well. I changed from 1.1.2 to 2.0.1 and > now I have a memory leak. > > I do not know why. Any idea? > > I do not know the working of DLR but is there a GenerateCodeSnippet option > in IP2.0.1 too? > > Perhaps it causes the memory leak. > > Thanks, > > Zoltan > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- nomadlife.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Mon Mar 23 19:11:05 2009 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 23 Mar 2009 11:11:05 -0700 Subject: [IronPython] Creating Dynamic Assemblies from IronPython 2.6 In-Reply-To: References: <350E7D38B6D819428718949920EC2355571C3A79BD@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <350E7D38B6D819428718949920EC2355571FD5C573@NA-EXMSG-C102.redmond.corp.microsoft.com> Do you actually need MakeOrAdd or would the factory that takes multiple method infos be good enough? I'm just reluctant to open up the ability to modify any built-in function. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Jeff Hardy > Sent: Saturday, March 21, 2009 1:17 PM > To: Discussion of IronPython > Subject: Re: [IronPython] Creating Dynamic Assemblies from IronPython > 2.6 > > Hi Dino, > I'm updating Seo's old ctypes.py to work with 2.6, so unfortuantely > it's a little more complex than just one method. I could probably use > a delegate that takes an object[], but BuiltinFunction contains that > code already, and it is a lot more optimized than I could manage. Plus > it's less code for me to write :). > > - Jeff > > On Sat, Mar 21, 2009 at 11:45 AM, Dino Viehland > wrote: > > If you only have 1 method and don't need overload resolution I'd > suggest making a delegate using System.Delegate.CreateDelegate. > Otherwise this could be made public. > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From bruce.bromberek at gmail.com Mon Mar 23 22:14:57 2009 From: bruce.bromberek at gmail.com (Bruce Bromberek) Date: Mon, 23 Mar 2009 16:14:57 -0500 Subject: [IronPython] Two Problems with sys.argv and compiled scripts Message-ID: <58ad4a110903231414j6ff35054ncb3d7f50f8347851@mail.gmail.com> Problem #1 I know this is a know issue, but my google-fu has been able to uncover the solution. When I compile my script into an exe , sys.argv get sets to ' '. Using SharpDevelop and Ironpython 2.0.1 #Program.py # import clr clr.AddReference('mscorlib') clr.AddReference('System') import sys import System if __name__ == 'Program': try: print "sys.argv = ",sys.argv except System.Exception, e: print e yeilds output of C:\Program Files\IronPython 2.0.1\Samples\pyc>Program.exe fred sys.argv = [''] instead of the expected sys.argv['fred'] Problem #2: If I drag and drop a file onto the exe, I get a exception message that I can't see. In IronPython 1.0, the dropped file would populate sys.argv Hopefully someone can answer or direct me to better source. -WombatPM -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Mon Mar 23 22:16:58 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 23 Mar 2009 21:16:58 +0000 Subject: [IronPython] Two Problems with sys.argv and compiled scripts In-Reply-To: <58ad4a110903231414j6ff35054ncb3d7f50f8347851@mail.gmail.com> References: <58ad4a110903231414j6ff35054ncb3d7f50f8347851@mail.gmail.com> Message-ID: <49C7FC4A.9010909@voidspace.org.uk> Bruce Bromberek wrote: > Problem #1 > I know this is a know issue, but my google-fu has been able to uncover > the solution. When I compile my script into an exe , sys.argv get > sets to ' '. > > Using SharpDevelop and Ironpython 2.0.1 > > #Program.py > # > import clr > clr.AddReference('mscorlib') > clr.AddReference('System') > import sys > import System > > if __name__ == 'Program': > try: > print "sys.argv = ",sys.argv > except System.Exception, e: > print e > > yeilds output of > C:\Program Files\IronPython 2.0.1\Samples\pyc>Program.exe fred > sys.argv = [''] > > instead of the expected > sys.argv['fred'] > > Problem #2: > > If I drag and drop a file onto the exe, I get a exception message that > I can't see. In IronPython 1.0, the dropped file would populate sys.argv > > Hopefully someone can answer or direct me to better source. Creating a custom C# executable that embeds the IronPython engine, starts your application, and populates sys.argv is the best workaround for these problems. Michael > > -WombatPM > > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From curt at hagenlocher.org Mon Mar 23 23:43:26 2009 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 23 Mar 2009 15:43:26 -0700 Subject: [IronPython] Creating Dynamic Assemblies from IronPython 2.6 In-Reply-To: <350E7D38B6D819428718949920EC2355571FD5C573@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <350E7D38B6D819428718949920EC2355571C3A79BD@NA-EXMSG-C102.redmond.corp.microsoft.com> <350E7D38B6D819428718949920EC2355571FD5C573@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: I seem to recall that in Seo's original code, MakeOrAdd was used to build up the overloads over time as user code asked for additional method signatures for the same method name. This could presumably be simulated by replacing the method group in Python with a new method group that contained all the original infos plus the new one. On Mon, Mar 23, 2009 at 11:11 AM, Dino Viehland wrote: > Do you actually need MakeOrAdd or would the factory that takes multiple > method infos be good enough? > > I'm just reluctant to open up the ability to modify any built-in function. > > > -----Original Message----- > > From: users-bounces at lists.ironpython.com [mailto:users- > > bounces at lists.ironpython.com] On Behalf Of Jeff Hardy > > Sent: Saturday, March 21, 2009 1:17 PM > > To: Discussion of IronPython > > Subject: Re: [IronPython] Creating Dynamic Assemblies from IronPython > > 2.6 > > > > Hi Dino, > > I'm updating Seo's old ctypes.py to work with 2.6, so unfortuantely > > it's a little more complex than just one method. I could probably use > > a delegate that takes an object[], but BuiltinFunction contains that > > code already, and it is a lot more optimized than I could manage. Plus > > it's less code for me to write :). > > > > - Jeff > > > > On Sat, Mar 21, 2009 at 11:45 AM, Dino Viehland > > wrote: > > > If you only have 1 method and don't need overload resolution I'd > > suggest making a delegate using System.Delegate.CreateDelegate. > > Otherwise this could be made public. > > > > > _______________________________________________ > > 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 microsoft.com Mon Mar 23 23:46:50 2009 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 23 Mar 2009 15:46:50 -0700 Subject: [IronPython] Creating Dynamic Assemblies from IronPython 2.6 In-Reply-To: References: <350E7D38B6D819428718949920EC2355571C3A79BD@NA-EXMSG-C102.redmond.corp.microsoft.com> <350E7D38B6D819428718949920EC2355571FD5C573@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <350E7D38B6D819428718949920EC2355571FD5C77E@NA-EXMSG-C102.redmond.corp.microsoft.com> Maybe we could add a BuiltinFunctionBuild which provided this functionality. Then as long as the creator holds onto the BFB they can continue to mutate the function w/o allowing anyone else to. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher Sent: Monday, March 23, 2009 3:43 PM To: Discussion of IronPython Subject: Re: [IronPython] Creating Dynamic Assemblies from IronPython 2.6 I seem to recall that in Seo's original code, MakeOrAdd was used to build up the overloads over time as user code asked for additional method signatures for the same method name. This could presumably be simulated by replacing the method group in Python with a new method group that contained all the original infos plus the new one. On Mon, Mar 23, 2009 at 11:11 AM, Dino Viehland > wrote: Do you actually need MakeOrAdd or would the factory that takes multiple method infos be good enough? I'm just reluctant to open up the ability to modify any built-in function. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Jeff Hardy > Sent: Saturday, March 21, 2009 1:17 PM > To: Discussion of IronPython > Subject: Re: [IronPython] Creating Dynamic Assemblies from IronPython > 2.6 > > Hi Dino, > I'm updating Seo's old ctypes.py to work with 2.6, so unfortuantely > it's a little more complex than just one method. I could probably use > a delegate that takes an object[], but BuiltinFunction contains that > code already, and it is a lot more optimized than I could manage. Plus > it's less code for me to write :). > > - Jeff > > On Sat, Mar 21, 2009 at 11:45 AM, Dino Viehland > > wrote: > > If you only have 1 method and don't need overload resolution I'd > suggest making a delegate using System.Delegate.CreateDelegate. > Otherwise this could be made public. > > > _______________________________________________ > 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 bruce.bromberek at gmail.com Mon Mar 23 23:52:16 2009 From: bruce.bromberek at gmail.com (Bruce Bromberek) Date: Mon, 23 Mar 2009 17:52:16 -0500 Subject: [IronPython] Two Problems with sys.argv and compiled scripts In-Reply-To: <49C7FC4A.9010909@voidspace.org.uk> References: <58ad4a110903231414j6ff35054ncb3d7f50f8347851@mail.gmail.com> <49C7FC4A.9010909@voidspace.org.uk> Message-ID: <58ad4a110903231552v45c6c71aja53b93a4ccf0a3dc@mail.gmail.com> So if I follow your lead at http://www.voidspace.org.uk/ironpython/custom_executable.shtml it looks like I need to modify this code to call my complied DLL instead of the pythonsource code? string path = Path.Combine( Path.GetDirectoryName(Application.ExecutablePath), "main.py"); engine.ExecuteFile(path); Is that right? My end goal it to produce an exe that I can wrap up into an installer and distribute to people without ironpython installed. Once I get a working example, I'll post a detailed explanation back to this group for the benefit of the others coping with the transition from IronPython 1.0 to 2.0. Thanks in advance -WombatPM PS If you tell me that your book has all of the detail, I'll get the early access version ASAP. On Mon, Mar 23, 2009 at 4:16 PM, Michael Foord wrote: > Bruce Bromberek wrote: > >> Problem #1 >> I know this is a know issue, but my google-fu has been able to uncover the >> solution. When I compile my script into an exe , sys.argv get sets to ' '. >> >> Using SharpDevelop and Ironpython 2.0.1 >> >> #Program.py >> # >> import clr >> clr.AddReference('mscorlib') >> clr.AddReference('System') >> import sys >> import System >> >> if __name__ == 'Program': >> try: >> print "sys.argv = ",sys.argv >> except System.Exception, e: >> print e >> >> yeilds output of >> C:\Program Files\IronPython 2.0.1\Samples\pyc>Program.exe fred >> sys.argv = [''] >> >> instead of the expected >> sys.argv['fred'] >> >> Problem #2: >> >> If I drag and drop a file onto the exe, I get a exception message that I >> can't see. In IronPython 1.0, the dropped file would populate sys.argv >> >> Hopefully someone can answer or direct me to better source. >> > > > Creating a custom C# executable that embeds the IronPython engine, starts > your application, and populates sys.argv is the best workaround for these > problems. > > Michael > > >> -WombatPM >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > > _______________________________________________ > 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 fuzzyman at voidspace.org.uk Mon Mar 23 23:54:49 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 23 Mar 2009 22:54:49 +0000 Subject: [IronPython] Two Problems with sys.argv and compiled scripts In-Reply-To: <58ad4a110903231552v45c6c71aja53b93a4ccf0a3dc@mail.gmail.com> References: <58ad4a110903231414j6ff35054ncb3d7f50f8347851@mail.gmail.com> <49C7FC4A.9010909@voidspace.org.uk> <58ad4a110903231552v45c6c71aja53b93a4ccf0a3dc@mail.gmail.com> Message-ID: <49C81339.20103@voidspace.org.uk> Bruce Bromberek wrote: > So if I follow your lead at > http://www.voidspace.org.uk/ironpython/custom_executable.shtml > > it looks like I need to modify this code to call my complied DLL > instead of the pythonsource code? > string path = Path.Combine( > Path.GetDirectoryName(Application.ExecutablePath), > "main.py"); > engine.ExecuteFile(path); > > > Is that right? My end goal it to produce an exe that I can wrap up > into an installer and distribute to people without ironpython installed. > > Once I get a working example, I'll post a detailed explanation back to > this group for the benefit of the others coping with the transition > from IronPython 1.0 to 2.0. > That article is for IronPython 1 as it says at the start. It sounds like that is what you want. If you want IronPython 2 then you are better off with this article: http://www.voidspace.org.uk/ironpython/hosting_api.shtml All the best, Michael Foord > > Thanks in advance > > > -WombatPM > > PS If you tell me that your book has all of the detail, I'll get the > early access version ASAP. > > > > > On Mon, Mar 23, 2009 at 4:16 PM, Michael Foord > > wrote: > > Bruce Bromberek wrote: > > Problem #1 > I know this is a know issue, but my google-fu has been able to > uncover the solution. When I compile my script into an exe , > sys.argv get sets to ' '. > > Using SharpDevelop and Ironpython 2.0.1 > > #Program.py > # > import clr > clr.AddReference('mscorlib') > clr.AddReference('System') > import sys > import System > > if __name__ == 'Program': > try: > print "sys.argv = ",sys.argv > except System.Exception, e: > print e > > yeilds output of > C:\Program Files\IronPython 2.0.1\Samples\pyc>Program.exe fred > sys.argv = [''] > > instead of the expected > sys.argv['fred'] > > Problem #2: > > If I drag and drop a file onto the exe, I get a exception > message that I can't see. In IronPython 1.0, the dropped file > would populate sys.argv > > Hopefully someone can answer or direct me to better source. > > > > Creating a custom C# executable that embeds the IronPython engine, > starts your application, and populates sys.argv is the best > workaround for these problems. > > Michael > > > -WombatPM > > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > > _______________________________________________ > 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 > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog From jdhardy at gmail.com Tue Mar 24 00:21:36 2009 From: jdhardy at gmail.com (Jeff Hardy) Date: Mon, 23 Mar 2009 17:21:36 -0600 Subject: [IronPython] Creating Dynamic Assemblies from IronPython 2.6 In-Reply-To: References: <350E7D38B6D819428718949920EC2355571C3A79BD@NA-EXMSG-C102.redmond.corp.microsoft.com> <350E7D38B6D819428718949920EC2355571FD5C573@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: I've been thinking about whether that functionality is really needed. C doesn't support function overloading, so presumably there would only ever by one signature per name? I'll have to see if CPython supports that. - Jeff 2009/3/23 Curt Hagenlocher : > I seem to recall that in Seo's original code, MakeOrAdd was used to build up > the overloads over time as user code asked for additional method signatures > for the same method name. ?This could presumably be simulated by replacing > the method group in Python with a new method group that contained all the > original infos plus the new one. > > On Mon, Mar 23, 2009 at 11:11 AM, Dino Viehland wrote: >> >> Do you actually need MakeOrAdd or would the factory that takes multiple >> method infos be good enough? >> >> I'm just reluctant to open up the ability to modify any built-in function. >> >> > -----Original Message----- >> > From: users-bounces at lists.ironpython.com [mailto:users- >> > bounces at lists.ironpython.com] On Behalf Of Jeff Hardy >> > Sent: Saturday, March 21, 2009 1:17 PM >> > To: Discussion of IronPython >> > Subject: Re: [IronPython] Creating Dynamic Assemblies from IronPython >> > 2.6 >> > >> > Hi Dino, >> > I'm updating Seo's old ctypes.py to work with 2.6, so unfortuantely >> > it's a little more complex than just one method. I could probably use >> > a delegate that takes an object[], but BuiltinFunction contains that >> > code already, and it is a lot more optimized than I could manage. Plus >> > it's less code for me to write :). >> > >> > - Jeff >> > >> > On Sat, Mar 21, 2009 at 11:45 AM, Dino Viehland >> > wrote: >> > > If you only have 1 method and don't need overload resolution I'd >> > suggest making a delegate using System.Delegate.CreateDelegate. >> > Otherwise this could be made public. >> > > >> > _______________________________________________ >> > 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 Tue Mar 24 00:34:31 2009 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 23 Mar 2009 16:34:31 -0700 Subject: [IronPython] Creating Dynamic Assemblies from IronPython 2.6 In-Reply-To: References: <350E7D38B6D819428718949920EC2355571C3A79BD@NA-EXMSG-C102.redmond.corp.microsoft.com> <350E7D38B6D819428718949920EC2355571FD5C573@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: It's not quite that straightforward with p/Invoke though -- it can be *very* convenient to define multiple overloads for the same C function with different signatures. Consider the GetPrinter function and the different versions of the PRINTER_INFO_x structure it can deal with: http://msdn.microsoft.com/en-us/library/dd144911(VS.85).aspx On Mon, Mar 23, 2009 at 4:21 PM, Jeff Hardy wrote: > I've been thinking about whether that functionality is really needed. > C doesn't support function overloading, so presumably there would only > ever by one signature per name? I'll have to see if CPython supports > that. > > - Jeff > > 2009/3/23 Curt Hagenlocher : > > I seem to recall that in Seo's original code, MakeOrAdd was used to build > up > > the overloads over time as user code asked for additional method > signatures > > for the same method name. This could presumably be simulated by > replacing > > the method group in Python with a new method group that contained all the > > original infos plus the new one. > > > > On Mon, Mar 23, 2009 at 11:11 AM, Dino Viehland > wrote: > >> > >> Do you actually need MakeOrAdd or would the factory that takes multiple > >> method infos be good enough? > >> > >> I'm just reluctant to open up the ability to modify any built-in > function. > >> > >> > -----Original Message----- > >> > From: users-bounces at lists.ironpython.com [mailto:users- > >> > bounces at lists.ironpython.com] On Behalf Of Jeff Hardy > >> > Sent: Saturday, March 21, 2009 1:17 PM > >> > To: Discussion of IronPython > >> > Subject: Re: [IronPython] Creating Dynamic Assemblies from IronPython > >> > 2.6 > >> > > >> > Hi Dino, > >> > I'm updating Seo's old ctypes.py to work with 2.6, so unfortuantely > >> > it's a little more complex than just one method. I could probably use > >> > a delegate that takes an object[], but BuiltinFunction contains that > >> > code already, and it is a lot more optimized than I could manage. Plus > >> > it's less code for me to write :). > >> > > >> > - Jeff > >> > > >> > On Sat, Mar 21, 2009 at 11:45 AM, Dino Viehland > >> > wrote: > >> > > If you only have 1 method and don't need overload resolution I'd > >> > suggest making a delegate using System.Delegate.CreateDelegate. > >> > Otherwise this could be made public. > >> > > > >> > _______________________________________________ > >> > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jimmy.Schementi at microsoft.com Tue Mar 24 08:08:20 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Tue, 24 Mar 2009 07:08:20 +0000 Subject: [IronPython] [ATTN] AgDLR 0.5 Released Message-ID: In conjunction with MIX ?09 and the announcement of IronRuby 0.3, I?d like to announce a new release of AgDLR 0.5 ? the Silverlight Dynamic Languages SDK. Download AgDLR 0.5 http://sdlsdk.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=25120 You can also check out and download the source code for this release: View: http://github.com/jschementi/agdlr/tree/v0.5.0 Download: http://github.com/jschementi/agdlr/zipball/v0.5.0 This is the MIX ?09 release for Silverlight 2 and Silverlight 3 Beta. It updates the languages to IronRuby 0.3 and IronPython 2.6 pre-alpha, and adds a bunch of new features to Microsoft.Scripting.Silverlight and Chiron. Please read the release notes for details, or my announcement post: http://blog.jimmy.schementi.com/2009/03/silverlight-dynamic-languages-sdk-05.html ~Jimmy From utinimail at gmail.com Tue Mar 24 12:46:55 2009 From: utinimail at gmail.com (Utini) Date: Tue, 24 Mar 2009 11:46:55 +0000 Subject: [IronPython] IronPython Excel 2007 Interop on Vista - problem Message-ID: <2af4570d0903240446qd6fc3k7ef8e9c36c8a232a@mail.gmail.com> Hi all, I'm attempting to automate Excel 2007 using IronPython 2.0.1. I've followed a couple of examples (which I gather were written against Excel 2003), but they don't work for me. Here's my code: import clr clr.AddReference('Microsoft.Office.Interop.Excel') import Microsoft.Office.Interop.Excel as Excel xlApp = Excel.ApplicationClass() xlApp.Visible = True wbook = xlApp.Workbooks.Add() wsheet = wbook.Worksheets[1] # produces an error The error I get is: Error while invoking _Default. at Microsoft.Scripting.Com.ComRuntimeHelpers.CheckThrowException(Int32 hresul t, ExcepInfo& excepInfo, UInt32 argErr, String message) at _stub_$27##25(Closure , CallSite , DispCallable ) at Microsoft.Scripting.Actions.MatchCaller.Call1[T0,TRet](Func`3 target, Call Site site, Object[] args) at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args) at Microsoft.Scripting.Actions.UpdateDelegates.Update1[T,T0,TRet](CallSite si te, T0 arg0) at _stub_$26##24(Closure , CallSite , ComObject , Int32 ) at Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4 target, C allSite site, Object[] args) at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args) at Microsoft.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) at _stub_$25##23(Closure , CallSite , Object , Int32 ) at Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4 target, C allSite site, Object[] args) at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args) at Microsoft.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) at S$2.Initialize(Scope $scope, LanguageContext $language) at Microsoft.Scripting.Runtime.OptimizedScriptCode.InvokeTarget(LambdaExpress ion code, Scope scope) at Microsoft.Scripting.ScriptCode.Run(Scope scope) at IronPython.Hosting.PythonCommandLine.RunFileWorker(String fileName) at IronPython.Hosting.PythonCommandLine.RunFile(String fileName) StandardError: Error while invoking _Default. Can anyone shed any light on this? Cheers, David. -------------- next part -------------- An HTML attachment was scrubbed... URL: From empirebuilder at gmail.com Tue Mar 24 12:55:03 2009 From: empirebuilder at gmail.com (Dody Gunawinata) Date: Tue, 24 Mar 2009 13:55:03 +0200 Subject: [IronPython] IronPython Excel 2007 Interop on Vista - problem In-Reply-To: <2af4570d0903240446qd6fc3k7ef8e9c36c8a232a@mail.gmail.com> References: <2af4570d0903240446qd6fc3k7ef8e9c36c8a232a@mail.gmail.com> Message-ID: <8cd017b80903240455l55afa007scadb855534f3e62b@mail.gmail.com> Does workbook automatically generates default worksheets when you create them? It looks like an array out of bound problem. 2009/3/24 Utini > Hi all, > > I'm attempting to automate Excel 2007 using IronPython 2.0.1. I've followed > a couple of examples (which I gather were written against Excel 2003), but > they don't work for me. > > Here's my code: > > import clr > clr.AddReference('Microsoft.Office.Interop.Excel') > import Microsoft.Office.Interop.Excel as Excel > xlApp = Excel.ApplicationClass() > xlApp.Visible = True > wbook = xlApp.Workbooks.Add() > wsheet = wbook.Worksheets[1] # produces an error > > The error I get is: > > Error while invoking _Default. > at Microsoft.Scripting.Com.ComRuntimeHelpers.CheckThrowException(Int32 > hresul > t, ExcepInfo& excepInfo, UInt32 argErr, String message) > at _stub_$27##25(Closure , CallSite , DispCallable ) > at Microsoft.Scripting.Actions.MatchCaller.Call1[T0,TRet](Func`3 target, > Call > Site site, Object[] args) > at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] > args) > at > Microsoft.Scripting.Actions.UpdateDelegates.Update1[T,T0,TRet](CallSite si > te, T0 arg0) > at _stub_$26##24(Closure , CallSite , ComObject , Int32 ) > at Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4 > target, C > allSite site, Object[] args) > at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] > args) > at > Microsoft.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite > site, T0 arg0, T1 arg1) > at _stub_$25##23(Closure , CallSite , Object , Int32 ) > at Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4 > target, C > allSite site, Object[] args) > at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] > args) > at > Microsoft.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite > site, T0 arg0, T1 arg1) > at S$2.Initialize(Scope $scope, LanguageContext $language) > at > Microsoft.Scripting.Runtime.OptimizedScriptCode.InvokeTarget(LambdaExpress > ion code, Scope scope) > at Microsoft.Scripting.ScriptCode.Run(Scope scope) > at IronPython.Hosting.PythonCommandLine.RunFileWorker(String fileName) > at IronPython.Hosting.PythonCommandLine.RunFile(String fileName) > StandardError: Error while invoking _Default. > > Can anyone shed any light on this? > > Cheers, > > David. > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -- nomadlife.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From utinimail at gmail.com Tue Mar 24 13:00:10 2009 From: utinimail at gmail.com (Utini) Date: Tue, 24 Mar 2009 12:00:10 +0000 Subject: [IronPython] IronPython Excel 2007 Interop on Vista - problem In-Reply-To: <8cd017b80903240455l55afa007scadb855534f3e62b@mail.gmail.com> References: <2af4570d0903240446qd6fc3k7ef8e9c36c8a232a@mail.gmail.com> <8cd017b80903240455l55afa007scadb855534f3e62b@mail.gmail.com> Message-ID: <2af4570d0903240500k154a358i31b1898275ba01db@mail.gmail.com> It appears that the default Workbook.Add always includes 3 Worksheets. 2009/3/24 Dody Gunawinata > Does workbook automatically generates default worksheets when you create > them? It looks like an array out of bound problem. > > 2009/3/24 Utini > >> Hi all, >> >> I'm attempting to automate Excel 2007 using IronPython 2.0.1. I've >> followed a couple of examples (which I gather were written against Excel >> 2003), but they don't work for me. >> >> Here's my code: >> >> import clr >> clr.AddReference('Microsoft.Office.Interop.Excel') >> import Microsoft.Office.Interop.Excel as Excel >> xlApp = Excel.ApplicationClass() >> xlApp.Visible = True >> wbook = xlApp.Workbooks.Add() >> wsheet = wbook.Worksheets[1] # produces an error >> >> The error I get is: >> >> Error while invoking _Default. >> at Microsoft.Scripting.Com.ComRuntimeHelpers.CheckThrowException(Int32 >> hresul >> t, ExcepInfo& excepInfo, UInt32 argErr, String message) >> at _stub_$27##25(Closure , CallSite , DispCallable ) >> at Microsoft.Scripting.Actions.MatchCaller.Call1[T0,TRet](Func`3 >> target, Call >> Site site, Object[] args) >> at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] >> args) >> at >> Microsoft.Scripting.Actions.UpdateDelegates.Update1[T,T0,TRet](CallSite si >> te, T0 arg0) >> at _stub_$26##24(Closure , CallSite , ComObject , Int32 ) >> at Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4 >> target, C >> allSite site, Object[] args) >> at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] >> args) >> at >> Microsoft.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite >> site, T0 arg0, T1 arg1) >> at _stub_$25##23(Closure , CallSite , Object , Int32 ) >> at Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4 >> target, C >> allSite site, Object[] args) >> at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] >> args) >> at >> Microsoft.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite >> site, T0 arg0, T1 arg1) >> at S$2.Initialize(Scope $scope, LanguageContext $language) >> at >> Microsoft.Scripting.Runtime.OptimizedScriptCode.InvokeTarget(LambdaExpress >> ion code, Scope scope) >> at Microsoft.Scripting.ScriptCode.Run(Scope scope) >> at IronPython.Hosting.PythonCommandLine.RunFileWorker(String fileName) >> at IronPython.Hosting.PythonCommandLine.RunFile(String fileName) >> StandardError: Error while invoking _Default. >> >> Can anyone shed any light on this? >> >> Cheers, >> >> David. >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > > -- > nomadlife.org > > > _______________________________________________ > 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 empirebuilder at gmail.com Tue Mar 24 13:05:00 2009 From: empirebuilder at gmail.com (Dody Gunawinata) Date: Tue, 24 Mar 2009 14:05:00 +0200 Subject: [IronPython] IronPython Excel 2007 Interop on Vista - problem In-Reply-To: <2af4570d0903240500k154a358i31b1898275ba01db@mail.gmail.com> References: <2af4570d0903240446qd6fc3k7ef8e9c36c8a232a@mail.gmail.com> <8cd017b80903240455l55afa007scadb855534f3e62b@mail.gmail.com> <2af4570d0903240500k154a358i31b1898275ba01db@mail.gmail.com> Message-ID: <8cd017b80903240505n243e4210q9cc4ae5d3af36ad2@mail.gmail.com> Did you get the same error if you change the last code to wbook.Worksheets[1].Name = "second worksheet" On Tue, Mar 24, 2009 at 2:00 PM, Utini wrote: > It appears that the default Workbook.Add always includes 3 Worksheets. > > 2009/3/24 Dody Gunawinata > > Does workbook automatically generates default worksheets when you create >> them? It looks like an array out of bound problem. >> >> 2009/3/24 Utini >> >>> Hi all, >>> >>> I'm attempting to automate Excel 2007 using IronPython 2.0.1. I've >>> followed a couple of examples (which I gather were written against Excel >>> 2003), but they don't work for me. >>> >>> Here's my code: >>> >>> import clr >>> clr.AddReference('Microsoft.Office.Interop.Excel') >>> import Microsoft.Office.Interop.Excel as Excel >>> xlApp = Excel.ApplicationClass() >>> xlApp.Visible = True >>> wbook = xlApp.Workbooks.Add() >>> wsheet = wbook.Worksheets[1] # produces an error >>> >>> The error I get is: >>> >>> Error while invoking _Default. >>> at Microsoft.Scripting.Com.ComRuntimeHelpers.CheckThrowException(Int32 >>> hresul >>> t, ExcepInfo& excepInfo, UInt32 argErr, String message) >>> at _stub_$27##25(Closure , CallSite , DispCallable ) >>> at Microsoft.Scripting.Actions.MatchCaller.Call1[T0,TRet](Func`3 >>> target, Call >>> Site site, Object[] args) >>> at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] >>> args) >>> at >>> Microsoft.Scripting.Actions.UpdateDelegates.Update1[T,T0,TRet](CallSite si >>> te, T0 arg0) >>> at _stub_$26##24(Closure , CallSite , ComObject , Int32 ) >>> at Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4 >>> target, C >>> allSite site, Object[] args) >>> at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] >>> args) >>> at >>> Microsoft.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite >>> site, T0 arg0, T1 arg1) >>> at _stub_$25##23(Closure , CallSite , Object , Int32 ) >>> at Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4 >>> target, C >>> allSite site, Object[] args) >>> at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] >>> args) >>> at >>> Microsoft.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite >>> site, T0 arg0, T1 arg1) >>> at S$2.Initialize(Scope $scope, LanguageContext $language) >>> at >>> Microsoft.Scripting.Runtime.OptimizedScriptCode.InvokeTarget(LambdaExpress >>> ion code, Scope scope) >>> at Microsoft.Scripting.ScriptCode.Run(Scope scope) >>> at IronPython.Hosting.PythonCommandLine.RunFileWorker(String fileName) >>> at IronPython.Hosting.PythonCommandLine.RunFile(String fileName) >>> StandardError: Error while invoking _Default. >>> >>> Can anyone shed any light on this? >>> >>> Cheers, >>> >>> David. >>> >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >> >> >> -- >> nomadlife.org >> >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > -- nomadlife.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From empirebuilder at gmail.com Tue Mar 24 13:07:20 2009 From: empirebuilder at gmail.com (Dody Gunawinata) Date: Tue, 24 Mar 2009 14:07:20 +0200 Subject: [IronPython] IronPython Excel 2007 Interop on Vista - problem In-Reply-To: <8cd017b80903240505n243e4210q9cc4ae5d3af36ad2@mail.gmail.com> References: <2af4570d0903240446qd6fc3k7ef8e9c36c8a232a@mail.gmail.com> <8cd017b80903240455l55afa007scadb855534f3e62b@mail.gmail.com> <2af4570d0903240500k154a358i31b1898275ba01db@mail.gmail.com> <8cd017b80903240505n243e4210q9cc4ae5d3af36ad2@mail.gmail.com> Message-ID: <8cd017b80903240507j31736a68j8b72ab7653143437@mail.gmail.com> Check this link on how it is done in powershell http://www.microsoft.com/technet/scriptcenter/resources/qanda/jan09/hey0112.mspx. I wonder if Worksheet is actually an array or it's some other data structure. On Tue, Mar 24, 2009 at 2:05 PM, Dody Gunawinata wrote: > Did you get the same error if you change the last code to > wbook.Worksheets[1].Name = "second worksheet" > > > On Tue, Mar 24, 2009 at 2:00 PM, Utini wrote: > >> It appears that the default Workbook.Add always includes 3 Worksheets. >> >> 2009/3/24 Dody Gunawinata >> >> Does workbook automatically generates default worksheets when you create >>> them? It looks like an array out of bound problem. >>> >>> 2009/3/24 Utini >>> >>>> Hi all, >>>> >>>> I'm attempting to automate Excel 2007 using IronPython 2.0.1. I've >>>> followed a couple of examples (which I gather were written against Excel >>>> 2003), but they don't work for me. >>>> >>>> Here's my code: >>>> >>>> import clr >>>> clr.AddReference('Microsoft.Office.Interop.Excel') >>>> import Microsoft.Office.Interop.Excel as Excel >>>> xlApp = Excel.ApplicationClass() >>>> xlApp.Visible = True >>>> wbook = xlApp.Workbooks.Add() >>>> wsheet = wbook.Worksheets[1] # produces an error >>>> >>>> The error I get is: >>>> >>>> Error while invoking _Default. >>>> at >>>> Microsoft.Scripting.Com.ComRuntimeHelpers.CheckThrowException(Int32 hresul >>>> t, ExcepInfo& excepInfo, UInt32 argErr, String message) >>>> at _stub_$27##25(Closure , CallSite , DispCallable ) >>>> at Microsoft.Scripting.Actions.MatchCaller.Call1[T0,TRet](Func`3 >>>> target, Call >>>> Site site, Object[] args) >>>> at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] >>>> args) >>>> at >>>> Microsoft.Scripting.Actions.UpdateDelegates.Update1[T,T0,TRet](CallSite si >>>> te, T0 arg0) >>>> at _stub_$26##24(Closure , CallSite , ComObject , Int32 ) >>>> at Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4 >>>> target, C >>>> allSite site, Object[] args) >>>> at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] >>>> args) >>>> at >>>> Microsoft.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite >>>> site, T0 arg0, T1 arg1) >>>> at _stub_$25##23(Closure , CallSite , Object , Int32 ) >>>> at Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4 >>>> target, C >>>> allSite site, Object[] args) >>>> at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] >>>> args) >>>> at >>>> Microsoft.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite >>>> site, T0 arg0, T1 arg1) >>>> at S$2.Initialize(Scope $scope, LanguageContext $language) >>>> at >>>> Microsoft.Scripting.Runtime.OptimizedScriptCode.InvokeTarget(LambdaExpress >>>> ion code, Scope scope) >>>> at Microsoft.Scripting.ScriptCode.Run(Scope scope) >>>> at IronPython.Hosting.PythonCommandLine.RunFileWorker(String >>>> fileName) >>>> at IronPython.Hosting.PythonCommandLine.RunFile(String fileName) >>>> StandardError: Error while invoking _Default. >>>> >>>> Can anyone shed any light on this? >>>> >>>> Cheers, >>>> >>>> David. >>>> >>>> _______________________________________________ >>>> Users mailing list >>>> Users at lists.ironpython.com >>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>>> >>>> >>> >>> >>> -- >>> nomadlife.org >>> >>> >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >> > > > -- > nomadlife.org > > -- nomadlife.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From antonio.piteira at wtvision.com Tue Mar 24 13:29:58 2009 From: antonio.piteira at wtvision.com (=?iso-8859-1?Q?Ant=F3nio_Piteira?=) Date: Tue, 24 Mar 2009 12:29:58 -0000 Subject: [IronPython] IronPython Excel 2007 Interop on Vista - problem In-Reply-To: <2af4570d0903240500k154a358i31b1898275ba01db@mail.gmail.com> References: <2af4570d0903240446qd6fc3k7ef8e9c36c8a232a@mail.gmail.com> <8cd017b80903240455l55afa007scadb855534f3e62b@mail.gmail.com> <2af4570d0903240500k154a358i31b1898275ba01db@mail.gmail.com> Message-ID: <49c8d24f.05035a0a.1256.ffffd555@mx.google.com> Hello Utini, Instead of ?wsheet = wbook.Worksheets[1]? try this ?wsheet = wbook.Worksheets.Item[1]?. It should work like that. Good luck, Ant?nio Piteira ------------------- It appears that the default Workbook.Add always includes 3 Worksheets. 2009/3/24 Dody Gunawinata Does workbook automatically generates default worksheets when you create them? It looks like an array out of bound problem. 2009/3/24 Utini Hi all, I'm attempting to automate Excel 2007 using IronPython 2.0.1. I've followed a couple of examples (which I gather were written against Excel 2003), but they don't work for me. Here's my code: import clr clr.AddReference('Microsoft.Office.Interop.Excel') import Microsoft.Office.Interop.Excel as Excel xlApp = Excel.ApplicationClass() xlApp.Visible = True wbook = xlApp.Workbooks.Add() wsheet = wbook.Worksheets[1] # produces an error The error I get is: Error while invoking _Default. at Microsoft.Scripting.Com.ComRuntimeHelpers.CheckThrowException(Int32 hresul t, ExcepInfo& excepInfo, UInt32 argErr, String message) at _stub_$27##25(Closure , CallSite , DispCallable ) at Microsoft.Scripting.Actions.MatchCaller.Call1[T0,TRet](Func`3 target, Call Site site, Object[] args) at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args) at Microsoft.Scripting.Actions.UpdateDelegates.Update1[T,T0,TRet](CallSite si te, T0 arg0) at _stub_$26##24(Closure , CallSite , ComObject , Int32 ) at Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4 target, C allSite site, Object[] args) at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args) at Microsoft.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) at _stub_$25##23(Closure , CallSite , Object , Int32 ) at Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4 target, C allSite site, Object[] args) at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args) at Microsoft.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) at S$2.Initialize(Scope $scope, LanguageContext $language) at Microsoft.Scripting.Runtime.OptimizedScriptCode.InvokeTarget(LambdaExpress ion code, Scope scope) at Microsoft.Scripting.ScriptCode.Run(Scope scope) at IronPython.Hosting.PythonCommandLine.RunFileWorker(String fileName) at IronPython.Hosting.PythonCommandLine.RunFile(String fileName) StandardError: Error while invoking _Default. Can anyone shed any light on this? Cheers, David. _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- nomadlife.org _______________________________________________ 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 jdhardy at gmail.com Tue Mar 24 14:40:44 2009 From: jdhardy at gmail.com (Jeff Hardy) Date: Tue, 24 Mar 2009 07:40:44 -0600 Subject: [IronPython] Creating Dynamic Assemblies from IronPython 2.6 In-Reply-To: References: <350E7D38B6D819428718949920EC2355571C3A79BD@NA-EXMSG-C102.redmond.corp.microsoft.com> <350E7D38B6D819428718949920EC2355571FD5C573@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: 2009/3/23 Curt Hagenlocher : > It's not quite that straightforward with p/Invoke though -- it can be *very* > convenient to define multiple overloads for the same C function with > different signatures. Consider the GetPrinter function and the different > versions of the PRINTER_INFO_x structure it can deal > with:?http://msdn.microsoft.com/en-us/library/dd144911(VS.85).aspx My eyes! The goggles, they do nothing! Seo also mentioned printf-style varargs functions, which need a different signature for each set of arguments. Back to the drawing board. - Jeff From fuzzyman at voidspace.org.uk Tue Mar 24 21:50:10 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 24 Mar 2009 20:50:10 +0000 Subject: [IronPython] IronPython, Python 2.6 and sys._getframe Message-ID: <49C94782.70903@voidspace.org.uk> Hello all, Dave has posted a blog entry on IronPython 2.6 and the Python 2.6 standard library. http://knowbody.livejournal.com/13271.html Many standard libraries now depend on collections.py, which is incompatible with IronPython because it assumes that if sys._getframe exists that it works! As Jython used to not implement sys._getframe there are various places in the standard library (and other code) that attempt compatibility with implementation that don't have a working _getframe by doing if hasattr(sys, '_getframe'). Wouldn't it make more sense for IronPython *not* to define _getframe rather than the current situation? Thanks Michael -- http://www.ironpythoninaction.com/ From curt at hagenlocher.org Tue Mar 24 22:13:36 2009 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Tue, 24 Mar 2009 14:13:36 -0700 Subject: [IronPython] IronPython, Python 2.6 and sys._getframe In-Reply-To: <49C94782.70903@voidspace.org.uk> References: <49C94782.70903@voidspace.org.uk> Message-ID: On Tue, Mar 24, 2009 at 1:50 PM, Michael Foord wrote: > > Wouldn't it make more sense for IronPython *not* to define _getframe rather > than the current situation? Dino's current thinking is that _getframe will be undefined by default, but that opting in with a command-line argument will enable _getframe(n) for all legal values of "n". -- Curt Hagenlocher curt at hagenlocher.org From fuzzyman at voidspace.org.uk Tue Mar 24 22:43:46 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 24 Mar 2009 21:43:46 +0000 Subject: [IronPython] IronPython, Python 2.6 and sys._getframe In-Reply-To: References: <49C94782.70903@voidspace.org.uk> Message-ID: <49C95412.30203@voidspace.org.uk> Curt Hagenlocher wrote: > On Tue, Mar 24, 2009 at 1:50 PM, Michael Foord > wrote: > >> Wouldn't it make more sense for IronPython *not* to define _getframe rather >> than the current situation? >> > > Dino's current thinking is that _getframe will be undefined by > default, but that opting in with a command-line argument will enable > _getframe(n) for all legal values of "n". > That sounds like a good solution. I *won't* submit a patch for collections.py then. Michael > -- > Curt Hagenlocher > curt at hagenlocher.org > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ From boesen at xefion.com Wed Mar 25 10:56:00 2009 From: boesen at xefion.com (Thomas P. Boesen) Date: Wed, 25 Mar 2009 10:56:00 +0100 Subject: [IronPython] Free Excel add-in for easily making Excel macros using IronPython Message-ID: <49C9FFB0.8020807@xefion.com> Hi, I have just release the beta-version of DiscoveryScript, a free Excel add-in that makes it very easy to create Excel macros/scripts using Python. DiscoveryScript takes care of all the ?plumbing? involved in calling Python scripts from Excel. You can create a one-line Python script and place it in a specific folder, then DiscoveryScript takes care of creating a menu-item in Excel and calling your script when the user clicks the menu-item. DiscoveryScript also includes an interactive console that makes it easy to test you code; this is very useful for figuring out how to work with the Excel object model. DiscoveryScript uses IronPython 1.1.2. You can find DiscoveryScript at www.xefion.com/en/discoveryscript.html Please let me know if you find this tool useful and what features you are missing. Best regards, Thomas P. Boesen From igor_elyas at hotmail.com Wed Mar 25 20:17:08 2009 From: igor_elyas at hotmail.com (Igor Elyas) Date: Wed, 25 Mar 2009 21:17:08 +0200 Subject: [IronPython] Embedding & Charsets Message-ID: Hello I'm use IronPython 2.0.1 as embedded interpreter for read data from database. Code for create Engine: fEngine = Python.CreateEngine(); Ops = fEngine.CreateOperations(); // core libs fEngine.Runtime.LoadAssembly(typeof(Decimal).Assembly); fEngine.Runtime.LoadAssembly(typeof(IValue).Assembly); // loading ADO.NET driver assemblies LoadAssemblies(from v in EtlBaseCfg.BaseCfg.Element("dlls").Elements("dll") select v.Value); After that, I use generated Ipy class for read one value from specific IDbDataReader: from ETL.Common.pipes import IValuePipe class SelectExtractor(IValuePipe): def __init__(self,adoreader,originId,storage): self._name = originId self._reader = adoreader self._idx = adoreader.GetOrdinal(self._name) self._transport = storage def Do(self, pydict): val = self._transport.Clone() if not self._reader.IsDBNull(self._idx): val.Data = self._reader.GetString(self._idx) if pydict.ContainsKey(self._name): pydict[self._name] = val else: pydict.Add(self._name,val) This operation return string with Russian symbols and I get Exception: "'ascii' codec can't decode byte 0 in position 0: ordinal not in range" How I can enable unicode .NET strings ? Looks like I not initialize IronPython correctly, because this code in Ipy console work fine with Russian charset (Russian Windows), but not sure about other charsets. I need use .NET unicode strings. Best regards Igor Elyas -------------- next part -------------- An HTML attachment was scrubbed... URL: From igor_elyas at hotmail.com Wed Mar 25 20:29:39 2009 From: igor_elyas at hotmail.com (Igor Elyas) Date: Wed, 25 Mar 2009 21:29:39 +0200 Subject: [IronPython] Embedding & Charsets In-Reply-To: References: Message-ID: Ops Deep in code on returned value used Python str() function and looks like: str(self._reader.GetString(self._idx)) That correct situation ? From: Igor Elyas Sent: Wednesday, March 25, 2009 9:17 PM To: Users at lists.ironpython.com Subject: [IronPython] Embedding & Charsets Hello I'm use IronPython 2.0.1 as embedded interpreter for read data from database. Code for create Engine: fEngine = Python.CreateEngine(); Ops = fEngine.CreateOperations(); // core libs fEngine.Runtime.LoadAssembly(typeof(Decimal).Assembly); fEngine.Runtime.LoadAssembly(typeof(IValue).Assembly); // loading ADO.NET driver assemblies LoadAssemblies(from v in EtlBaseCfg.BaseCfg.Element("dlls").Elements("dll") select v.Value); After that, I use generated Ipy class for read one value from specific IDbDataReader: from ETL.Common.pipes import IValuePipe class SelectExtractor(IValuePipe): def __init__(self,adoreader,originId,storage): self._name = originId self._reader = adoreader self._idx = adoreader.GetOrdinal(self._name) self._transport = storage def Do(self, pydict): val = self._transport.Clone() if not self._reader.IsDBNull(self._idx): val.Data = self._reader.GetString(self._idx) if pydict.ContainsKey(self._name): pydict[self._name] = val else: pydict.Add(self._name,val) This operation return string with Russian symbols and I get Exception: "'ascii' codec can't decode byte 0 in position 0: ordinal not in range" How I can enable unicode .NET strings ? Looks like I not initialize IronPython correctly, because this code in Ipy console work fine with Russian charset (Russian Windows), but not sure about other charsets. I need use .NET unicode strings. Best regards Igor Elyas -------------------------------------------------------------------------------- _______________________________________________ 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 fuzzyman at voidspace.org.uk Wed Mar 25 21:03:13 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Wed, 25 Mar 2009 20:03:13 +0000 Subject: [IronPython] Embedding & Charsets In-Reply-To: References: Message-ID: <49CA8E01.5030302@voidspace.org.uk> Igor Elyas wrote: > Ops > > Deep in code on returned value used Python str() function and looks like: > str(self._reader.GetString(self._idx)) > You can't call str on a string if it contains non-ascii characters. :-) (and why would you need to...) Michael > That correct situation ? > > *From:* Igor Elyas > *Sent:* Wednesday, March 25, 2009 9:17 PM > *To:* Users at lists.ironpython.com > *Subject:* [IronPython] Embedding & Charsets > > Hello > > I'm use IronPython 2.0.1 as embedded interpreter for read data from > database. > Code for create Engine: > > fEngine = Python.CreateEngine(); > Ops = fEngine.CreateOperations(); > // core libs > fEngine.Runtime.LoadAssembly(typeof(Decimal).Assembly); > > fEngine.Runtime.LoadAssembly(typeof(IValue).Assembly); > > // loading ADO.NET driver assemblies > LoadAssemblies(from v in > EtlBaseCfg.BaseCfg.Element("dlls").Elements("dll") select v.Value); > > After that, I use generated Ipy class for read one value from specific > IDbDataReader: > > from ETL.Common.pipes import IValuePipe > class SelectExtractor(IValuePipe): > def __init__(self,adoreader,originId,storage): > self._name = originId > self._reader = adoreader > self._idx = adoreader.GetOrdinal(self._name) > self._transport = storage > def Do(self, pydict): > val = self._transport.Clone() > if not self._reader.IsDBNull(self._idx): > val.Data = self._reader.GetString(self._idx) > if pydict.ContainsKey(self._name): > pydict[self._name] = val > else: > pydict.Add(self._name,val) > > This operation return string with Russian symbols and I get > Exception: "'ascii' codec can't decode byte 0 in position 0: ordinal > not in range" > How I can enable unicode .NET strings ? > Looks like I not initialize IronPython correctly, because this code in > Ipy console work fine with Russian charset (Russian Windows), but not > sure about other charsets. I need use .NET unicode strings. > > Best regards > > Igor Elyas > > ------------------------------------------------------------------------ > _______________________________________________ > 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 > -- http://www.ironpythoninaction.com/ From igor_elyas at hotmail.com Wed Mar 25 22:08:08 2009 From: igor_elyas at hotmail.com (Igor Elyas) Date: Wed, 25 Mar 2009 23:08:08 +0200 Subject: [IronPython] Embedding & Charsets In-Reply-To: <49CA8E01.5030302@voidspace.org.uk> References: <49CA8E01.5030302@voidspace.org.uk> Message-ID: Interesting info: 1. Calling unicode('russian symbols') throws "'ascii' codec can't decode byte 0 in position 0: ordinal not in range" 2. IronPython 2.0 (2.0.0.0) on .NET 2.0.50727.3082 Type "help", "copyright", "credits" or "license" for more information. >>> str(u''russian symbols'.encode('cp1251')) Traceback (most recent call last): File "", line 1, in File "mscorlib", line unknown, in GetString File "mscorlib", line unknown, in GetChars File "mscorlib", line unknown, in Fallback File "mscorlib", line unknown, in Throw UnicodeDecodeError: ('unknown', u'\xef', 0, 1, '') Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> str(u''russian symbols'.encode('cp1251')) '\xef\xf0\xe8\xe2\xe5\xf2' -------------------------------------------------- From: "Michael Foord" Sent: Wednesday, March 25, 2009 10:03 PM To: "Discussion of IronPython" Subject: Re: [IronPython] Embedding & Charsets > Igor Elyas wrote: >> Ops >> Deep in code on returned value used Python str() function and looks >> like: >> str(self._reader.GetString(self._idx)) >> > > You can't call str on a string if it contains non-ascii characters. :-) > > (and why would you need to...) > > Michael > >> That correct situation ? >> >> *From:* Igor Elyas >> *Sent:* Wednesday, March 25, 2009 9:17 PM >> *To:* Users at lists.ironpython.com >> *Subject:* [IronPython] Embedding & Charsets >> >> Hello >> I'm use IronPython 2.0.1 as embedded interpreter for read data from >> database. >> Code for create Engine: >> fEngine = Python.CreateEngine(); >> Ops = fEngine.CreateOperations(); >> // core libs >> fEngine.Runtime.LoadAssembly(typeof(Decimal).Assembly); >> fEngine.Runtime.LoadAssembly(typeof(IValue).Assembly); >> // loading ADO.NET driver assemblies >> LoadAssemblies(from v in >> EtlBaseCfg.BaseCfg.Element("dlls").Elements("dll") select v.Value); >> After that, I use generated Ipy class for read one value from specific >> IDbDataReader: >> from ETL.Common.pipes import IValuePipe >> class SelectExtractor(IValuePipe): >> def __init__(self,adoreader,originId,storage): >> self._name = originId >> self._reader = adoreader >> self._idx = adoreader.GetOrdinal(self._name) >> self._transport = storage >> def Do(self, pydict): >> val = self._transport.Clone() >> if not self._reader.IsDBNull(self._idx): >> val.Data = self._reader.GetString(self._idx) >> if pydict.ContainsKey(self._name): >> pydict[self._name] = val >> else: >> pydict.Add(self._name,val) >> This operation return string with Russian symbols and I get Exception: >> "'ascii' codec can't decode byte 0 in position 0: ordinal not in range" >> How I can enable unicode .NET strings ? >> Looks like I not initialize IronPython correctly, because this code in >> Ipy console work fine with Russian charset (Russian Windows), but not >> sure about other charsets. I need use .NET unicode strings. >> >> Best regards >> >> Igor Elyas >> >> ------------------------------------------------------------------------ >> _______________________________________________ >> 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 >> > > > -- > http://www.ironpythoninaction.com/ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From fuzzyman at voidspace.org.uk Thu Mar 26 00:33:18 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Wed, 25 Mar 2009 23:33:18 +0000 Subject: [IronPython] Embedding & Charsets In-Reply-To: References: <49CA8E01.5030302@voidspace.org.uk> Message-ID: <49CABF3E.1020106@voidspace.org.uk> Igor Elyas wrote: > Interesting info: > 1. Calling unicode('russian symbols') throws "'ascii' codec can't > decode byte 0 in position 0: ordinal not in range" In IronPython calling unicode is the same as calling str. Calling unicode on a bytestring with non-ascii characters in it would also blow up in CPython. Michael > 2. > IronPython 2.0 (2.0.0.0) on .NET 2.0.50727.3082 > Type "help", "copyright", "credits" or "license" for more information. >>>> str(u''russian symbols'.encode('cp1251')) > Traceback (most recent call last): > File "", line 1, in > File "mscorlib", line unknown, in GetString > File "mscorlib", line unknown, in GetChars > File "mscorlib", line unknown, in Fallback > File "mscorlib", line unknown, in Throw > UnicodeDecodeError: ('unknown', u'\xef', 0, 1, '') > > Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit > (Intel)] on win32 > Type "help", "copyright", "credits" or "license" for more information. >>>> str(u''russian symbols'.encode('cp1251')) > '\xef\xf0\xe8\xe2\xe5\xf2' > > -------------------------------------------------- > From: "Michael Foord" > Sent: Wednesday, March 25, 2009 10:03 PM > To: "Discussion of IronPython" > Subject: Re: [IronPython] Embedding & Charsets > >> Igor Elyas wrote: >>> Ops >>> Deep in code on returned value used Python str() function and >>> looks like: >>> str(self._reader.GetString(self._idx)) >>> >> >> You can't call str on a string if it contains non-ascii characters. :-) >> >> (and why would you need to...) >> >> Michael >> >>> That correct situation ? >>> >>> *From:* Igor Elyas >>> *Sent:* Wednesday, March 25, 2009 9:17 PM >>> *To:* Users at lists.ironpython.com >>> *Subject:* [IronPython] Embedding & Charsets >>> >>> Hello >>> I'm use IronPython 2.0.1 as embedded interpreter for read data from >>> database. >>> Code for create Engine: >>> fEngine = Python.CreateEngine(); >>> Ops = fEngine.CreateOperations(); >>> // core libs >>> fEngine.Runtime.LoadAssembly(typeof(Decimal).Assembly); >>> fEngine.Runtime.LoadAssembly(typeof(IValue).Assembly); >>> // loading ADO.NET driver assemblies >>> LoadAssemblies(from v in >>> EtlBaseCfg.BaseCfg.Element("dlls").Elements("dll") select v.Value); >>> After that, I use generated Ipy class for read one value from >>> specific IDbDataReader: >>> from ETL.Common.pipes import IValuePipe >>> class SelectExtractor(IValuePipe): >>> def __init__(self,adoreader,originId,storage): >>> self._name = originId >>> self._reader = adoreader >>> self._idx = adoreader.GetOrdinal(self._name) >>> self._transport = storage >>> def Do(self, pydict): >>> val = self._transport.Clone() >>> if not self._reader.IsDBNull(self._idx): >>> val.Data = self._reader.GetString(self._idx) >>> if pydict.ContainsKey(self._name): >>> pydict[self._name] = val >>> else: >>> pydict.Add(self._name,val) >>> This operation return string with Russian symbols and I get >>> Exception: "'ascii' codec can't decode byte 0 in position 0: ordinal >>> not in range" >>> How I can enable unicode .NET strings ? >>> Looks like I not initialize IronPython correctly, because this code >>> in Ipy console work fine with Russian charset (Russian Windows), but >>> not sure about other charsets. I need use .NET unicode strings. >>> >>> Best regards >>> >>> Igor Elyas >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> 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 >>> >> >> >> -- >> http://www.ironpythoninaction.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 -- http://www.ironpythoninaction.com/ From igor_elyas at hotmail.com Thu Mar 26 08:38:40 2009 From: igor_elyas at hotmail.com (Igor Elyas) Date: Thu, 26 Mar 2009 09:38:40 +0200 Subject: [IronPython] Embedding & Charsets In-Reply-To: <49CABF3E.1020106@voidspace.org.uk> References: <49CA8E01.5030302@voidspace.org.uk> <49CABF3E.1020106@voidspace.org.uk> Message-ID: Thanks for explaining. -------------------------------------------------- From: "Michael Foord" Sent: Thursday, March 26, 2009 1:33 AM To: "Discussion of IronPython" Subject: Re: [IronPython] Embedding & Charsets > Igor Elyas wrote: >> Interesting info: >> 1. Calling unicode('russian symbols') throws "'ascii' codec can't decode >> byte 0 in position 0: ordinal not in range" > In IronPython calling unicode is the same as calling str. Calling unicode > on a bytestring with non-ascii characters in it would also blow up in > CPython. > > Michael > >> 2. >> IronPython 2.0 (2.0.0.0) on .NET 2.0.50727.3082 >> Type "help", "copyright", "credits" or "license" for more information. >>>>> str(u''russian symbols'.encode('cp1251')) >> Traceback (most recent call last): >> File "", line 1, in >> File "mscorlib", line unknown, in GetString >> File "mscorlib", line unknown, in GetChars >> File "mscorlib", line unknown, in Fallback >> File "mscorlib", line unknown, in Throw >> UnicodeDecodeError: ('unknown', u'\xef', 0, 1, '') >> >> Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit >> (Intel)] on win32 >> Type "help", "copyright", "credits" or "license" for more information. >>>>> str(u''russian symbols'.encode('cp1251')) >> '\xef\xf0\xe8\xe2\xe5\xf2' >> >> -------------------------------------------------- >> From: "Michael Foord" >> Sent: Wednesday, March 25, 2009 10:03 PM >> To: "Discussion of IronPython" >> Subject: Re: [IronPython] Embedding & Charsets >> >>> Igor Elyas wrote: >>>> Ops >>>> Deep in code on returned value used Python str() function and looks >>>> like: >>>> str(self._reader.GetString(self._idx)) >>>> >>> >>> You can't call str on a string if it contains non-ascii characters. :-) >>> >>> (and why would you need to...) >>> >>> Michael >>> >>>> That correct situation ? >>>> >>>> *From:* Igor Elyas >>>> *Sent:* Wednesday, March 25, 2009 9:17 PM >>>> *To:* Users at lists.ironpython.com >>>> *Subject:* [IronPython] Embedding & Charsets >>>> >>>> Hello >>>> I'm use IronPython 2.0.1 as embedded interpreter for read data from >>>> database. >>>> Code for create Engine: >>>> fEngine = Python.CreateEngine(); >>>> Ops = fEngine.CreateOperations(); >>>> // core libs >>>> fEngine.Runtime.LoadAssembly(typeof(Decimal).Assembly); >>>> fEngine.Runtime.LoadAssembly(typeof(IValue).Assembly); // >>>> loading ADO.NET driver assemblies >>>> LoadAssemblies(from v in >>>> EtlBaseCfg.BaseCfg.Element("dlls").Elements("dll") select v.Value); >>>> After that, I use generated Ipy class for read one value from specific >>>> IDbDataReader: >>>> from ETL.Common.pipes import IValuePipe >>>> class SelectExtractor(IValuePipe): >>>> def __init__(self,adoreader,originId,storage): >>>> self._name = originId >>>> self._reader = adoreader >>>> self._idx = adoreader.GetOrdinal(self._name) >>>> self._transport = storage >>>> def Do(self, pydict): >>>> val = self._transport.Clone() >>>> if not self._reader.IsDBNull(self._idx): >>>> val.Data = self._reader.GetString(self._idx) >>>> if pydict.ContainsKey(self._name): >>>> pydict[self._name] = val >>>> else: >>>> pydict.Add(self._name,val) >>>> This operation return string with Russian symbols and I get Exception: >>>> "'ascii' codec can't decode byte 0 in position 0: ordinal not in range" >>>> How I can enable unicode .NET strings ? >>>> Looks like I not initialize IronPython correctly, because this code in >>>> Ipy console work fine with Russian charset (Russian Windows), but not >>>> sure about other charsets. I need use .NET unicode strings. >>>> >>>> Best regards >>>> >>>> Igor Elyas >>>> >>>> ------------------------------------------------------------------------ >>>> >>>> _______________________________________________ >>>> 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 >>>> >>> >>> >>> -- >>> http://www.ironpythoninaction.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 > > > -- > http://www.ironpythoninaction.com/ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From dfugate at microsoft.com Thu Mar 26 19:36:48 2009 From: dfugate at microsoft.com (Dave Fugate) Date: Thu, 26 Mar 2009 11:36:48 -0700 Subject: [IronPython] Announcing IronPython 2.6 Alpha 1 In-Reply-To: References: <350E7D38B6D819428718949920EC2355572684CC14@NA-EXMSG-C102.redmond.corp.microsoft.com> <710DF26F214D2B4BB94287123FFE980A2E15A3F55E@NA-EXMSG-C104.redmond.corp.microsoft.com> <918705E903F4714CB713D89AB5F1857D884DB20530@NA-EXMSG-C116.redmond.corp.microsoft.com> Message-ID: Hello Python Community, We're pleased to announce the release of IronPython 2.6 Alpha 1. As you might imagine, this release is all about supporting new CPython 2.6 features such as the 'bytes' and 'bytearray' types (PEP 3112), decorators for classes (PEP 3129), advanced string formatting (PEP 3101), etc. The minimum .NET version required for this release is the same as IronPython 2.0; namely .NET 2.0 Service Pack 1. Unlike the 2.0 series of IronPython, we plan to release only a couple Alphas and Betas of IronPython 2.6. As such, it's key that we get your feedback on the release(s) quickly to incorporate requested changes. Besides CPython 2.6 features, another significant change in this release is that ipy.exe now uses "adaptive compilation" by default. Adaptive compilation is a technique in which IronPython: 1. Interprets and executes Python method calls up to N times for a given method. If you're only going to execute a method a few times, it's typically faster to interpret the method instead of compiling and executing it 2. Compiles and executes the Python method call on the N+1 invocation of the method. Compilation of a Python method is a heavyweight operation, but we can reuse the result for subsequent invocations 3. Reuses the previously compiled method for new calls to the Python method. This operation is much faster than interpreting the method call as the method was already compiled in the previous step The reason for this change is that it provides a nice performance gain for Python code containing lots of functions/methods that only get called a few times. All this said, this feature is still undergoing active development and as a consequence some Python scripts may actually run slower with it turned on. For this reason, our old default mode of running Python scripts is still available by passing the -O or -D flags to ipy.exe. Any feedback on how this new feature affects your IronPython applications performance-wise would be greatly appreciated. There's also a few minor changes since IronPython 2.0.1 that are worth calling out here: * IronPython.msi now installs NGEN'ed binaries by default * IronPython.msi now offers a little more selection with respect to what you'd like to install. For example, Silverlight templates are optional * The default installation location of IronPython.msi no longer indicates whether the 2.6 release is an Alpha, Beta, or a patched release. Future IronPython 2.6 installations will replace previous 2.6 releases which will be uninstalled automatically * The -X:PreferComInteropAssembly flag has been removed. All COM interop is now done through normal COM dispatch You can download IronPython 2.6 Alpha 1 at: http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=22982 The IronPython Team -------------- next part -------------- An HTML attachment was scrubbed... URL: From carolj at microsoft.com Thu Mar 26 21:46:48 2009 From: carolj at microsoft.com (Carolyn Johnston (MSNAR)) Date: Thu, 26 Mar 2009 13:46:48 -0700 Subject: [IronPython] .NET casts in IronPython Message-ID: <387DA5F5806B6A49A69468E4EA24DB2A80C0F09CD1@NA-EXMSG-C125.redmond.corp.microsoft.com> I need to cast a .NET object A to a .NET object B. There is nothing tricky about the cast, it's a straightforward cast to a base type. How can I do this in IP? Thanks! :) Carolyn Carolyn Johnston (carolj) Lead Researcher, MSN Applied Research Text group Bldg 109/4053 | MIcrosoft Corporation 425-706-2153 -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Thu Mar 26 21:59:11 2009 From: dinov at microsoft.com (Dino Viehland) Date: Thu, 26 Mar 2009 13:59:11 -0700 Subject: [IronPython] .NET casts in IronPython In-Reply-To: <387DA5F5806B6A49A69468E4EA24DB2A80C0F09CD1@NA-EXMSG-C125.redmond.corp.microsoft.com> References: <387DA5F5806B6A49A69468E4EA24DB2A80C0F09CD1@NA-EXMSG-C125.redmond.corp.microsoft.com> Message-ID: <350E7D38B6D819428718949920EC2355572684D281@NA-EXMSG-C102.redmond.corp.microsoft.com> Why do you need to cast to the base class? All of the members you need should already be there. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Carolyn Johnston (MSNAR) Sent: Thursday, March 26, 2009 3:47 PM To: Users at lists.ironpython.com Subject: [IronPython] .NET casts in IronPython I need to cast a .NET object A to a .NET object B. There is nothing tricky about the cast, it's a straightforward cast to a base type. How can I do this in IP? Thanks! :) Carolyn Carolyn Johnston (carolj) Lead Researcher, MSN Applied Research Text group Bldg 109/4053 | MIcrosoft Corporation 425-706-2153 -------------- next part -------------- An HTML attachment was scrubbed... URL: From giles.thomas at resolversystems.com Thu Mar 26 22:08:26 2009 From: giles.thomas at resolversystems.com (Giles Thomas) Date: Thu, 26 Mar 2009 21:08:26 +0000 Subject: [IronPython] Announcing IronPython 2.6 Alpha 1 In-Reply-To: References: <350E7D38B6D819428718949920EC2355572684CC14@NA-EXMSG-C102.redmond.corp.microsoft.com> <710DF26F214D2B4BB94287123FFE980A2E15A3F55E@NA-EXMSG-C104.redmond.corp.microsoft.com> <918705E903F4714CB713D89AB5F1857D884DB20530@NA-EXMSG-C116.redmond.corp.microsoft.com> Message-ID: <49CBEECA.2080104@resolversystems.com> Dave, This is great news, congratulations to the IP team on this release! We'll do a test-port of Resolver One early next week and will reply to the list with any issues we find. Cheers, Giles Dave Fugate wrote: > Hello Python Community, > > We?re pleased to announce the release of IronPython 2.6 Alpha 1. As > you might imagine, this release is all about supporting new CPython > 2.6 features such as the ?bytes? and ?bytearray? types (PEP 3112), > decorators for classes (PEP 3129), advanced string formatting (PEP > 3101), etc. The minimum .NET version required for this release is the > same as IronPython 2.0; namely .NET 2.0 Service Pack 1. Unlike the 2.0 > series of IronPython, we plan to release only a couple Alphas and > Betas of IronPython 2.6. As such, it?s key that we get your feedback > on the release(s) quickly to incorporate requested changes. > > Besides CPython 2.6 features, another significant change in this > release is that ipy.exe now uses ?adaptive compilation? by default. > Adaptive compilation is a technique in which IronPython: > > 1. Interprets and executes Python method calls up to /N/ times for a > given method. If you?re only going to execute a method a few times, > it?s typically faster to interpret the method instead of compiling and > executing it > > 2. Compiles and executes the Python method call on the /N+1/ > invocation of the method. Compilation of a Python method is a > heavyweight operation, but we can reuse the result for subsequent > invocations > > 3. Reuses the previously compiled method for new calls to the Python > method. This operation is much faster than interpreting the method > call as the method was already compiled in the previous step > > The reason for this change is that it provides a nice performance gain > for Python code containing lots of functions/methods that only get > called a few times. All this said, this feature is still undergoing > active development and as a consequence some Python scripts may > actually run slower with it turned on. For this reason, our old > default mode of running Python scripts is still available by passing > the ?O or -D flags to ipy.exe. Any feedback on how this new feature > affects your IronPython applications performance-wise would be greatly > appreciated. > > There?s also a few minor changes since IronPython 2.0.1 that are worth > calling out here: > > ? IronPython.msi now installs NGEN?ed binaries by default > > ? IronPython.msi now offers a little more selection with respect to > what you?d like to install. For example, Silverlight templates are > optional > > ? The default installation location of IronPython.msi no longer > indicates whether the 2.6 release is an Alpha, Beta, or a patched > release. Future IronPython 2.6 installations will replace previous 2.6 > releases which will be uninstalled automatically > > ? The -X:PreferComInteropAssembly flag has been removed. All COM > interop is now done through normal COM dispatch > > You can download IronPython 2.6 Alpha 1 at: > http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=22982 > > > The IronPython Team > >------------------------------------------------------------------------ > >_______________________________________________ >Users mailing list >Users at lists.ironpython.com >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > From carolj at microsoft.com Thu Mar 26 23:49:27 2009 From: carolj at microsoft.com (Carolyn Johnston (MSNAR)) Date: Thu, 26 Mar 2009 15:49:27 -0700 Subject: [IronPython] .NET casts in IronPython In-Reply-To: <350E7D38B6D819428718949920EC2355572684D281@NA-EXMSG-C102.redmond.corp.microsoft.com> References: <387DA5F5806B6A49A69468E4EA24DB2A80C0F09CD1@NA-EXMSG-C125.redmond.corp.microsoft.com> <350E7D38B6D819428718949920EC2355572684D281@NA-EXMSG-C102.redmond.corp.microsoft.com> Message-ID: <387DA5F5806B6A49A69468E4EA24DB2A80C0F09E3C@NA-EXMSG-C125.redmond.corp.microsoft.com> You are right, I didn't need to do the cast - was just transcribing some C# code that did that for some reason. However, it is still a good question (instead of upcasting, think of downcasting), and the answer isn't out there that I could find. Thanks, Carolyn Carolyn Johnston (carolj) Lead Researcher, MSN Applied Research Text group Bldg 109/4053 | MIcrosoft Corporation 425-706-2153 From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: Thursday, March 26, 2009 1:59 PM To: Discussion of IronPython Subject: Re: [IronPython] .NET casts in IronPython Why do you need to cast to the base class? All of the members you need should already be there. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Carolyn Johnston (MSNAR) Sent: Thursday, March 26, 2009 3:47 PM To: Users at lists.ironpython.com Subject: [IronPython] .NET casts in IronPython I need to cast a .NET object A to a .NET object B. There is nothing tricky about the cast, it's a straightforward cast to a base type. How can I do this in IP? Thanks! :) Carolyn Carolyn Johnston (carolj) Lead Researcher, MSN Applied Research Text group Bldg 109/4053 | MIcrosoft Corporation 425-706-2153 -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Fri Mar 27 00:35:00 2009 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Thu, 26 Mar 2009 16:35:00 -0700 Subject: [IronPython] .NET casts in IronPython In-Reply-To: <387DA5F5806B6A49A69468E4EA24DB2A80C0F09E3C@NA-EXMSG-C125.redmond.corp.microsoft.com> References: <387DA5F5806B6A49A69468E4EA24DB2A80C0F09CD1@NA-EXMSG-C125.redmond.corp.microsoft.com> <350E7D38B6D819428718949920EC2355572684D281@NA-EXMSG-C102.redmond.corp.microsoft.com> <387DA5F5806B6A49A69468E4EA24DB2A80C0F09E3C@NA-EXMSG-C125.redmond.corp.microsoft.com> Message-ID: The Python object will always reflect the underlying .NET type, so you never need to upcast or downcast. 2009/3/26 Carolyn Johnston (MSNAR) > You are right, I didn?t need to do the cast ? was just transcribing some > C# code that did that for some reason. > > > > However, it is still a good question (instead of upcasting, think of > downcasting), and the answer isn?t out there that I could find. > > > > Thanks, Carolyn > > > > *Carolyn Johnston (carolj)* > Lead Researcher, MSN Applied Research Text group > Bldg 109/4053 | MIcrosoft Corporation > 425-706-2153 > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Dino Viehland > *Sent:* Thursday, March 26, 2009 1:59 PM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] .NET casts in IronPython > > > > Why do you need to cast to the base class? All of the members you need > should already be there. > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Carolyn Johnston > (MSNAR) > *Sent:* Thursday, March 26, 2009 3:47 PM > *To:* Users at lists.ironpython.com > *Subject:* [IronPython] .NET casts in IronPython > > > > I need to cast a .NET object A to a .NET object B. There is nothing tricky > about the cast, it?s a straightforward cast to a base type. How can I do > this in IP? > > > > Thanks! > > J Carolyn > > > > *Carolyn Johnston (carolj)* > Lead Researcher, MSN Applied Research Text group > Bldg 109/4053 | MIcrosoft Corporation > 425-706-2153 > > > > > > _______________________________________________ > 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 timr at probo.com Fri Mar 27 18:33:15 2009 From: timr at probo.com (Tim Roberts) Date: Fri, 27 Mar 2009 10:33:15 -0700 Subject: [IronPython] .NET casts in IronPython In-Reply-To: References: Message-ID: <49CD0DDB.6090101@probo.com> On Thu, 26 Mar 2009 15:49:27 -0700, "Carolyn Johnston (MSNAR)" > You are right, I didn't need to do the cast - was just transcribing some C# code that did that for some reason. > > However, it is still a good question (instead of upcasting, think of downcasting), and the answer isn't out there that I could find. > You are trying to apply C++ and C# thinking to Python. This is a fundamental philosophical difference between the languages. Python doesn't care what the object IS. Python only cares what it EXPOSES. If it has a GetName() method, you can call it, no matter what the object ancestry was. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From carolj at microsoft.com Fri Mar 27 19:25:26 2009 From: carolj at microsoft.com (Carolyn Johnston (MSNAR)) Date: Fri, 27 Mar 2009 11:25:26 -0700 Subject: [IronPython] .NET casts in IronPython In-Reply-To: <49CD0DDB.6090101@probo.com> References: <49CD0DDB.6090101@probo.com> Message-ID: <387DA5F5806B6A49A69468E4EA24DB2A80C103BC3C@NA-EXMSG-C125.redmond.corp.microsoft.com> You are trying to apply C++ and C# thinking to Python. This is a fundamental philosophical difference between the languages. Python doesn't care what the object IS. Python only cares what it EXPOSES. If it has a GetName() method, you can call it, no matter what the object ancestry was. -- tim Well, C++ was my first language -- but I am a huge fan of Python and IronPython. Since I've dived into the deep end philosophically, I may as well push it a bit further. One of the most useful aspects of IronPython for me is the way that I can use IronPython as a loosely typed test environment for .NET classes that I've built in C#. Suppose I have a class B which is a subclass of A, which both define a function f(x). Suppose I have an object of class B on which (for some purely hypothetical reason) I want to run A.f(x) rather than B.f(x). This is clearly at the interface of .NET design and Pythonian antiObjectian philosophy. Here's my question: is it doable within IronPython, or is it not? And if so, how? Thanks, :) Carolyn _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From curt at hagenlocher.org Fri Mar 27 19:26:57 2009 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Fri, 27 Mar 2009 11:26:57 -0700 Subject: [IronPython] .NET casts in IronPython In-Reply-To: <387DA5F5806B6A49A69468E4EA24DB2A80C103BC3C@NA-EXMSG-C125.redmond.corp.microsoft.com> References: <49CD0DDB.6090101@probo.com> <387DA5F5806B6A49A69468E4EA24DB2A80C103BC3C@NA-EXMSG-C125.redmond.corp.microsoft.com> Message-ID: You should be able to do it exactly like that: A.f(x) On Fri, Mar 27, 2009 at 11:25 AM, Carolyn Johnston (MSNAR) < carolj at microsoft.com> wrote: > > You are trying to apply C++ and C# thinking to Python. This is a > fundamental philosophical difference between the languages. Python > doesn't care what the object IS. Python only cares what it EXPOSES. If > it has a GetName() method, you can call it, no matter what the object > ancestry was. -- tim > > Well, C++ was my first language -- but I am a huge fan of Python and > IronPython. Since I've dived into the deep end philosophically, I may as > well push it a bit further. > > One of the most useful aspects of IronPython for me is the way that I can > use IronPython as a loosely typed test environment for .NET classes that > I've built in C#. Suppose I have a class B which is a subclass of A, which > both define a function f(x). Suppose I have an object of class B on which > (for some purely hypothetical reason) I want to run A.f(x) rather than > B.f(x). This is clearly at the interface of .NET design and Pythonian > antiObjectian philosophy. Here's my question: is it doable within > IronPython, or is it not? And if so, how? > > > Thanks, > :) Carolyn > > _______________________________________________ > 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 fuzzyman at voidspace.org.uk Fri Mar 27 19:28:36 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Fri, 27 Mar 2009 13:28:36 -0500 Subject: [IronPython] .NET casts in IronPython In-Reply-To: <387DA5F5806B6A49A69468E4EA24DB2A80C103BC3C@NA-EXMSG-C125.redmond.corp.microsoft.com> References: <49CD0DDB.6090101@probo.com> <387DA5F5806B6A49A69468E4EA24DB2A80C103BC3C@NA-EXMSG-C125.redmond.corp.microsoft.com> Message-ID: <49CD1AD4.1020007@voidspace.org.uk> Carolyn Johnston (MSNAR) wrote: > You are trying to apply C++ and C# thinking to Python. This is a > fundamental philosophical difference between the languages. Python > doesn't care what the object IS. Python only cares what it EXPOSES. If > it has a GetName() method, you can call it, no matter what the object > ancestry was. -- tim > > Well, C++ was my first language -- but I am a huge fan of Python and IronPython. Since I've dived into the deep end philosophically, I may as well push it a bit further. > > One of the most useful aspects of IronPython for me is the way that I can use IronPython as a loosely typed test environment for .NET classes that I've built in C#. Suppose I have a class B which is a subclass of A, which both define a function f(x). Suppose I have an object of class B on which (for some purely hypothetical reason) I want to run A.f(x) rather than B.f(x). Actually the example pattern is pretty much how you do it. Suppose you have an object 'a', which is an instance of a class that inherits from (or implements) both A and B. You can explicitly call the A version using: A.f(a, x) Or the B version: B.f(a, x) As you are calling the unbound method (on the class or interface), you pass in the instance as the first argument. Michael > This is clearly at the interface of .NET design and Pythonian antiObjectian philosophy. Here's my question: is it doable within IronPython, or is it not? And if so, how? > > > Thanks, > :) Carolyn > > _______________________________________________ > 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 > -- http://www.ironpythoninaction.com/ From carolj at microsoft.com Fri Mar 27 19:48:59 2009 From: carolj at microsoft.com (Carolyn Johnston (MSNAR)) Date: Fri, 27 Mar 2009 11:48:59 -0700 Subject: [IronPython] .NET casts in IronPython In-Reply-To: <49CD1AD4.1020007@voidspace.org.uk> References: <49CD0DDB.6090101@probo.com> <387DA5F5806B6A49A69468E4EA24DB2A80C103BC3C@NA-EXMSG-C125.redmond.corp.microsoft.com> <49CD1AD4.1020007@voidspace.org.uk> Message-ID: <387DA5F5806B6A49A69468E4EA24DB2A80C103BC81@NA-EXMSG-C125.redmond.corp.microsoft.com> Very good. I tried this with the following example and got the kind of behavior I wanted. Thanks, everyone. class A: def __init__(self): pass def f(self): print "A.f" return class B(A): # no init method, inherit the A one def f(self): print "B.f" return class C(A): def f(self): print "C.f" return >>> from testClasses import * >>> cc = C() >>> cc.f() C.f >>> A.f(cc) A.f >>> B.f(cc) Traceback (most recent call last): File , line 0, in ##188 TypeError: unbound method f() must be called with B instance as first argument (got C instance instead) Carolyn Johnston (carolj) Lead Researcher, MSN Applied Research Text group Bldg 109/4053 | MIcrosoft Corporation 425-706-2153 -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Friday, March 27, 2009 11:29 AM To: Discussion of IronPython Subject: Re: [IronPython] .NET casts in IronPython Carolyn Johnston (MSNAR) wrote: > You are trying to apply C++ and C# thinking to Python. This is a > fundamental philosophical difference between the languages. Python > doesn't care what the object IS. Python only cares what it EXPOSES. If > it has a GetName() method, you can call it, no matter what the object > ancestry was. -- tim > > Well, C++ was my first language -- but I am a huge fan of Python and IronPython. Since I've dived into the deep end philosophically, I may as well push it a bit further. > > One of the most useful aspects of IronPython for me is the way that I can use IronPython as a loosely typed test environment for .NET classes that I've built in C#. Suppose I have a class B which is a subclass of A, which both define a function f(x). Suppose I have an object of class B on which (for some purely hypothetical reason) I want to run A.f(x) rather than B.f(x). Actually the example pattern is pretty much how you do it. Suppose you have an object 'a', which is an instance of a class that inherits from (or implements) both A and B. You can explicitly call the A version using: A.f(a, x) Or the B version: B.f(a, x) As you are calling the unbound method (on the class or interface), you pass in the instance as the first argument. Michael > This is clearly at the interface of .NET design and Pythonian antiObjectian philosophy. Here's my question: is it doable within IronPython, or is it not? And if so, how? > > > Thanks, > :) Carolyn > > _______________________________________________ > 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 > -- http://www.ironpythoninaction.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 Mar 27 19:56:14 2009 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Fri, 27 Mar 2009 13:56:14 -0500 Subject: [IronPython] .NET casts in IronPython In-Reply-To: <387DA5F5806B6A49A69468E4EA24DB2A80C103BC81@NA-EXMSG-C125.redmond.corp.microsoft.com> References: <49CD0DDB.6090101@probo.com> <387DA5F5806B6A49A69468E4EA24DB2A80C103BC3C@NA-EXMSG-C125.redmond.corp.microsoft.com> <49CD1AD4.1020007@voidspace.org.uk> <387DA5F5806B6A49A69468E4EA24DB2A80C103BC81@NA-EXMSG-C125.redmond.corp.microsoft.com> Message-ID: <49CD214E.7040600@voidspace.org.uk> Carolyn Johnston (MSNAR) wrote: > Very good. I tried this with the following example and got the kind of behavior I wanted. Thanks, everyone. > > > class A: > def __init__(self): > pass > > def f(self): > print "A.f" > return > > class B(A): > # no init method, inherit the A one > > def f(self): > print "B.f" > return > > class C(A): > > def f(self): > print "C.f" > return > > >>>> from testClasses import * >>>> cc = C() >>>> cc.f() >>>> > C.f > >>>> A.f(cc) >>>> > A.f > >>>> B.f(cc) >>>> > Traceback (most recent call last): > File , line 0, in ##188 > TypeError: unbound method f() must be called with B instance as first argument (got C instance instead) > > That's because cc is not an instance of B. Try: class C(A, B): .... Michael > Carolyn Johnston (carolj) > Lead Researcher, MSN Applied Research Text group > Bldg 109/4053 | MIcrosoft Corporation > 425-706-2153 > > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Friday, March 27, 2009 11:29 AM > To: Discussion of IronPython > Subject: Re: [IronPython] .NET casts in IronPython > > Carolyn Johnston (MSNAR) wrote: > >> You are trying to apply C++ and C# thinking to Python. This is a >> fundamental philosophical difference between the languages. Python >> doesn't care what the object IS. Python only cares what it EXPOSES. If >> it has a GetName() method, you can call it, no matter what the object >> ancestry was. -- tim >> >> Well, C++ was my first language -- but I am a huge fan of Python and IronPython. Since I've dived into the deep end philosophically, I may as well push it a bit further. >> >> One of the most useful aspects of IronPython for me is the way that I can use IronPython as a loosely typed test environment for .NET classes that I've built in C#. Suppose I have a class B which is a subclass of A, which both define a function f(x). Suppose I have an object of class B on which (for some purely hypothetical reason) I want to run A.f(x) rather than B.f(x). >> > > Actually the example pattern is pretty much how you do it. > > Suppose you have an object 'a', which is an instance of a class that > inherits from (or implements) both A and B. > > You can explicitly call the A version using: > > A.f(a, x) > > Or the B version: > > B.f(a, x) > > As you are calling the unbound method (on the class or interface), you > pass in the instance as the first argument. > > Michael > > >> This is clearly at the interface of .NET design and Pythonian antiObjectian philosophy. Here's my question: is it doable within IronPython, or is it not? And if so, how? >> >> >> Thanks, >> :) Carolyn >> >> _______________________________________________ >> 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 >> >> > > > -- http://www.ironpythoninaction.com/ From chenrong2003 at gmail.com Sat Mar 28 13:33:44 2009 From: chenrong2003 at gmail.com (Neil Chen) Date: Sat, 28 Mar 2009 20:33:44 +0800 Subject: [IronPython] Typo in IronPython 2.6A1 source Message-ID: <26756bf60903280533lc5fe00fs91debca98f711764@mail.gmail.com> Hello, there is a typo error in \IronPython-2.6A1\Src\Scripts\generate_walker.py, Line 23: "# it wills can all types in IronPython and detect AST nodes based on type inheritence." I think "it wills can" should be "it will scan" here. Regards, Neil Chen From empirebuilder at gmail.com Sat Mar 28 21:09:06 2009 From: empirebuilder at gmail.com (Dody Gunawinata) Date: Sat, 28 Mar 2009 22:09:06 +0200 Subject: [IronPython] Announcing IronPython 2.6 Alpha 1 In-Reply-To: <49CBEECA.2080104@resolversystems.com> References: <350E7D38B6D819428718949920EC2355572684CC14@NA-EXMSG-C102.redmond.corp.microsoft.com> <710DF26F214D2B4BB94287123FFE980A2E15A3F55E@NA-EXMSG-C104.redmond.corp.microsoft.com> <918705E903F4714CB713D89AB5F1857D884DB20530@NA-EXMSG-C116.redmond.corp.microsoft.com> <49CBEECA.2080104@resolversystems.com> Message-ID: <8cd017b80903281309m4a1e2767n9003a4034a8b0113@mail.gmail.com> This is awesome. Web application can benefit from this "adaptive compilation" approach a lot - especially for low trafficked sites. On Thu, Mar 26, 2009 at 11:08 PM, Giles Thomas < giles.thomas at resolversystems.com> wrote: > Dave, > > This is great news, congratulations to the IP team on this release! We'll > do a test-port of Resolver One early next week and will reply to the list > with any issues we find. > > > Cheers, > > Giles > > > Dave Fugate wrote: > > Hello Python Community, >> >> We?re pleased to announce the release of IronPython 2.6 Alpha 1. As you >> might imagine, this release is all about supporting new CPython 2.6 features >> such as the ?bytes? and ?bytearray? types (PEP 3112), decorators for classes >> (PEP 3129), advanced string formatting (PEP 3101), etc. The minimum .NET >> version required for this release is the same as IronPython 2.0; namely .NET >> 2.0 Service Pack 1. Unlike the 2.0 series of IronPython, we plan to release >> only a couple Alphas and Betas of IronPython 2.6. As such, it?s key that we >> get your feedback on the release(s) quickly to incorporate requested >> changes. >> >> Besides CPython 2.6 features, another significant change in this release >> is that ipy.exe now uses ?adaptive compilation? by default. Adaptive >> compilation is a technique in which IronPython: >> >> 1. Interprets and executes Python method calls up to /N/ times for a given >> method. If you?re only going to execute a method a few times, it?s typically >> faster to interpret the method instead of compiling and executing it >> >> 2. Compiles and executes the Python method call on the /N+1/ invocation of >> the method. Compilation of a Python method is a heavyweight operation, but >> we can reuse the result for subsequent invocations >> >> 3. Reuses the previously compiled method for new calls to the Python >> method. This operation is much faster than interpreting the method call as >> the method was already compiled in the previous step >> >> The reason for this change is that it provides a nice performance gain for >> Python code containing lots of functions/methods that only get called a few >> times. All this said, this feature is still undergoing active development >> and as a consequence some Python scripts may actually run slower with it >> turned on. For this reason, our old default mode of running Python scripts >> is still available by passing the ?O or -D flags to ipy.exe. Any feedback on >> how this new feature affects your IronPython applications performance-wise >> would be greatly appreciated. >> >> There?s also a few minor changes since IronPython 2.0.1 that are worth >> calling out here: >> >> ? IronPython.msi now installs NGEN?ed binaries by default >> >> ? IronPython.msi now offers a little more selection with respect to what >> you?d like to install. For example, Silverlight templates are optional >> >> ? The default installation location of IronPython.msi no longer indicates >> whether the 2.6 release is an Alpha, Beta, or a patched release. Future >> IronPython 2.6 installations will replace previous 2.6 releases which will >> be uninstalled automatically >> >> ? The -X:PreferComInteropAssembly flag has been removed. All COM interop >> is now done through normal COM dispatch >> >> You can download IronPython 2.6 Alpha 1 at: >> http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=22982 >> >> The IronPython Team >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> 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 > -- nomadlife.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From adamb at silverkeytech.com Sat Mar 28 21:37:07 2009 From: adamb at silverkeytech.com (Adam Brand) Date: Sat, 28 Mar 2009 13:37:07 -0700 Subject: [IronPython] Announcing IronPython 2.6 Alpha 1 In-Reply-To: <8cd017b80903281309m4a1e2767n9003a4034a8b0113@mail.gmail.com> References: <350E7D38B6D819428718949920EC2355572684CC14@NA-EXMSG-C102.redmond.corp.microsoft.com> <710DF26F214D2B4BB94287123FFE980A2E15A3F55E@NA-EXMSG-C104.redmond.corp.microsoft.com> <918705E903F4714CB713D89AB5F1857D884DB20530@NA-EXMSG-C116.redmond.corp.microsoft.com> <49CBEECA.2080104@resolversystems.com> <8cd017b80903281309m4a1e2767n9003a4034a8b0113@mail.gmail.com> Message-ID: <064c01c9afe4$f736d560$e5a48020$@com> Any update on the timeline for getting IronPython for ASP.Net updated? This would make a world of difference for our IronPython-based web app. Adam Adam Brand SilverKey Technologies From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dody Gunawinata Sent: Saturday, March 28, 2009 1:09 PM To: Discussion of IronPython Subject: Re: [IronPython] Announcing IronPython 2.6 Alpha 1 This is awesome. Web application can benefit from this "adaptive compilation" approach a lot - especially for low trafficked sites. On Thu, Mar 26, 2009 at 11:08 PM, Giles Thomas wrote: Dave, This is great news, congratulations to the IP team on this release! We'll do a test-port of Resolver One early next week and will reply to the list with any issues we find. Cheers, Giles Dave Fugate wrote: Hello Python Community, We're pleased to announce the release of IronPython 2.6 Alpha 1. As you might imagine, this release is all about supporting new CPython 2.6 features such as the 'bytes' and 'bytearray' types (PEP 3112), decorators for classes (PEP 3129), advanced string formatting (PEP 3101), etc. The minimum .NET version required for this release is the same as IronPython 2.0; namely .NET 2.0 Service Pack 1. Unlike the 2.0 series of IronPython, we plan to release only a couple Alphas and Betas of IronPython 2.6. As such, it's key that we get your feedback on the release(s) quickly to incorporate requested changes. Besides CPython 2.6 features, another significant change in this release is that ipy.exe now uses "adaptive compilation" by default. Adaptive compilation is a technique in which IronPython: 1. Interprets and executes Python method calls up to /N/ times for a given method. If you're only going to execute a method a few times, it's typically faster to interpret the method instead of compiling and executing it 2. Compiles and executes the Python method call on the /N+1/ invocation of the method. Compilation of a Python method is a heavyweight operation, but we can reuse the result for subsequent invocations 3. Reuses the previously compiled method for new calls to the Python method. This operation is much faster than interpreting the method call as the method was already compiled in the previous step The reason for this change is that it provides a nice performance gain for Python code containing lots of functions/methods that only get called a few times. All this said, this feature is still undergoing active development and as a consequence some Python scripts may actually run slower with it turned on. For this reason, our old default mode of running Python scripts is still available by passing the -O or -D flags to ipy.exe. Any feedback on how this new feature affects your IronPython applications performance-wise would be greatly appreciated. There's also a few minor changes since IronPython 2.0.1 that are worth calling out here: . IronPython.msi now installs NGEN'ed binaries by default . IronPython.msi now offers a little more selection with respect to what you'd like to install. For example, Silverlight templates are optional . The default installation location of IronPython.msi no longer indicates whether the 2.6 release is an Alpha, Beta, or a patched release. Future IronPython 2.6 installations will replace previous 2.6 releases which will be uninstalled automatically . The -X:PreferComInteropAssembly flag has been removed. All COM interop is now done through normal COM dispatch You can download IronPython 2.6 Alpha 1 at: http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=22982 The IronPython Team ------------------------------------------------------------------------ _______________________________________________ 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 -- nomadlife.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From adamb at silverkeytech.com Sun Mar 29 03:02:55 2009 From: adamb at silverkeytech.com (Adam Brand) Date: Sat, 28 Mar 2009 18:02:55 -0700 Subject: [IronPython] try...finally in yield Message-ID: <8bd92c0e0903281802r36fe00d0rcc587e4a1f7f989f@mail.gmail.com> I'm using IronPython for ASP.Net...have some code (not mine, http://devhawk.net/2008/05/07/Deserializing+XML+With+IronPython.aspx - Harry Pierson's) that converts an xml file into an object. It has the below function: def parse(xml): xr = XmlReader.Create(xml) while xr.Read(): xr.MoveToContent() node = XmlNode(xr) yield node if (xr.IsEmptyElement): node.nodeType = XmlNodeType.EndElement del node.attributes yield node This code is problematic as it locks the xml file it is reading. I tried a try...finally to do a .Close() and .Dispose(), but the compiler was not happy with that. Just putting .Close() and .Dispose() at the end doesn't work. In reading up, I found this: http://docs.python.org/whatsnew/2.5.html#pep-342 "The addition of the close() method has one side effect that isn?t obvious. close() is called when a generator is garbage-collected, so this means the generator?s code gets one last chance to run before the generator is destroyed. This last chance means that try...finally statements in generators can now be guaranteed to work; the finally clause will now always get a chance to run. The syntactic restriction that you couldn?t mix yield statements with a try...finally suite has therefore been removed. " I'm guessing that this isn't implemented in the version of IronPython in IP for ASP.Net. Does anyone have any ideas on a workaround for the generator for this version? Thanks, Adam -- Adam Brand -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Sun Mar 29 04:39:23 2009 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sat, 28 Mar 2009 19:39:23 -0700 Subject: [IronPython] try...finally in yield In-Reply-To: <8bd92c0e0903281802r36fe00d0rcc587e4a1f7f989f@mail.gmail.com> References: <8bd92c0e0903281802r36fe00d0rcc587e4a1f7f989f@mail.gmail.com> Message-ID: So I assume you're calling close() on the generator? A try/finally around the code in the generator can be used to catch the StopIteration exception and force the dispose. But even better, you could say "from __future__ import with_statement" at the top of your file and then say something like this: def parse(xml): with XmlReader.Create(xml) as xr while xr.Read(): [...] We automatically do the right thing when using "with" and IDisposable, so "with" effectively becomes like a C# "using" block. 2009/3/28 Adam Brand > I'm using IronPython for ASP.Net...have some code (not mine, > http://devhawk.net/2008/05/07/Deserializing+XML+With+IronPython.aspx - > Harry Pierson's) that converts an xml file into an object. It has the below > function: > > def parse(xml): > xr = XmlReader.Create(xml) > while xr.Read(): > xr.MoveToContent() > node = XmlNode(xr) > yield node > if (xr.IsEmptyElement): > node.nodeType = XmlNodeType.EndElement > del node.attributes > yield node > > This code is problematic as it locks the xml file it is reading. I tried a > try...finally to do a .Close() and .Dispose(), but the compiler was not > happy with that. Just putting .Close() and .Dispose() at the end doesn't > work. > > In reading up, I found this: > http://docs.python.org/whatsnew/2.5.html#pep-342 > > "The addition of the close() method has one side effect that isn?t obvious. > close() is called when a generator is garbage-collected, so this means the > generator?s code gets one last chance to run before the generator is > destroyed. This last chance means that try...finally statements in > generators can now be guaranteed to work; the finally clause will now always > get a chance to run. The syntactic restriction that you couldn?t mix yield > statements with a try...finally suite has therefore been removed. " > > I'm guessing that this isn't implemented in the version of IronPython in IP > for ASP.Net. > > Does anyone have any ideas on a workaround for the generator for this > version? > > Thanks, > Adam > > -- > Adam Brand > > > _______________________________________________ > 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 empirebuilder at gmail.com Sun Mar 29 21:56:50 2009 From: empirebuilder at gmail.com (Dody Gunawinata) Date: Sun, 29 Mar 2009 21:56:50 +0200 Subject: [IronPython] Announcing IronPython 2.6 Alpha 1 In-Reply-To: <064c01c9afe4$f736d560$e5a48020$@com> References: <710DF26F214D2B4BB94287123FFE980A2E15A3F55E@NA-EXMSG-C104.redmond.corp.microsoft.com> <918705E903F4714CB713D89AB5F1857D884DB20530@NA-EXMSG-C116.redmond.corp.microsoft.com> <49CBEECA.2080104@resolversystems.com> <8cd017b80903281309m4a1e2767n9003a4034a8b0113@mail.gmail.com> <064c01c9afe4$f736d560$e5a48020$@com> Message-ID: <8cd017b80903291256p7553da58xb4159c23069f7465@mail.gmail.com> I think the fact that there are more users for "Assembly for Web Pages" and "AJAX on ALGOL" than IronPython for ASP.Net contributes to the delay in updates. It's too bad for us that got addicted to the elegance of the solution in the first place. I remember a couple of months ago about updated support for intellisense in IP for ASP.Net, etc. Those are nice to have but I think an updated IP would be enough to make everybody involved ecstatic. I got a feeling intellisense is not a major blocker for iron python adoption. 2009/3/28 Adam Brand > Any update on the timeline for getting IronPython for ASP.Net updated? > This would make a world of difference for our IronPython-based web app. > > > > Adam > > > > Adam Brand > > SilverKey Technologies > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Dody Gunawinata > *Sent:* Saturday, March 28, 2009 1:09 PM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] Announcing IronPython 2.6 Alpha 1 > > > > This is awesome. Web application can benefit from this "adaptive > compilation" approach a lot - especially for low trafficked sites. > > On Thu, Mar 26, 2009 at 11:08 PM, Giles Thomas < > giles.thomas at resolversystems.com> wrote: > > Dave, > > This is great news, congratulations to the IP team on this release! We'll > do a test-port of Resolver One early next week and will reply to the list > with any issues we find. > > > Cheers, > > Giles > > > Dave Fugate wrote: > > Hello Python Community, > > We?re pleased to announce the release of IronPython 2.6 Alpha 1. As you > might imagine, this release is all about supporting new CPython 2.6 features > such as the ?bytes? and ?bytearray? types (PEP 3112), decorators for classes > (PEP 3129), advanced string formatting (PEP 3101), etc. The minimum .NET > version required for this release is the same as IronPython 2.0; namely .NET > 2.0 Service Pack 1. Unlike the 2.0 series of IronPython, we plan to release > only a couple Alphas and Betas of IronPython 2.6. As such, it?s key that we > get your feedback on the release(s) quickly to incorporate requested > changes. > > Besides CPython 2.6 features, another significant change in this release is > that ipy.exe now uses ?adaptive compilation? by default. Adaptive > compilation is a technique in which IronPython: > > 1. Interprets and executes Python method calls up to /N/ times for a given > method. If you?re only going to execute a method a few times, it?s typically > faster to interpret the method instead of compiling and executing it > > 2. Compiles and executes the Python method call on the /N+1/ invocation of > the method. Compilation of a Python method is a heavyweight operation, but > we can reuse the result for subsequent invocations > > 3. Reuses the previously compiled method for new calls to the Python > method. This operation is much faster than interpreting the method call as > the method was already compiled in the previous step > > The reason for this change is that it provides a nice performance gain for > Python code containing lots of functions/methods that only get called a few > times. All this said, this feature is still undergoing active development > and as a consequence some Python scripts may actually run slower with it > turned on. For this reason, our old default mode of running Python scripts > is still available by passing the ?O or -D flags to ipy.exe. Any feedback on > how this new feature affects your IronPython applications performance-wise > would be greatly appreciated. > > There?s also a few minor changes since IronPython 2.0.1 that are worth > calling out here: > > ? IronPython.msi now installs NGEN?ed binaries by default > > ? IronPython.msi now offers a little more selection with respect to what > you?d like to install. For example, Silverlight templates are optional > > ? The default installation location of IronPython.msi no longer indicates > whether the 2.6 release is an Alpha, Beta, or a patched release. Future > IronPython 2.6 installations will replace previous 2.6 releases which will > be uninstalled automatically > > ? The -X:PreferComInteropAssembly flag has been removed. All COM interop is > now done through normal COM dispatch > > You can download IronPython 2.6 Alpha 1 at: > http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=22982 > > The IronPython Team > > ------------------------------------------------------------------------ > > _______________________________________________ > 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 > > > > > -- > nomadlife.org > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -- nomadlife.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From Kyle.Howland-Rose at aar.com.au Mon Mar 30 00:19:33 2009 From: Kyle.Howland-Rose at aar.com.au (Howland-Rose, Kyle) Date: Mon, 30 Mar 2009 09:19:33 +1100 Subject: [IronPython] Announcing IronPython 2.6 Alpha 1 In-Reply-To: <8cd017b80903291256p7553da58xb4159c23069f7465@mail.gmail.com> References: <710DF26F214D2B4BB94287123FFE980A2E15A3F55E@NA-EXMSG-C104.redmond.corp.microsoft.com><918705E903F4714CB713D89AB5F1857D884DB20530@NA-EXMSG-C116.redmond.corp.microsoft.com><49CBEECA.2080104@resolversystems.com><8cd017b80903281309m4a1e2767n9003a4034a8b0113@mail.gmail.com><064c01c9afe4$f736d560$e5a48020$@com> <8cd017b80903291256p7553da58xb4159c23069f7465@mail.gmail.com> Message-ID: Hi Adam, About "intellisense is not a major blocker for iron python adoption". Unfortunately I think it might be. The commercial world is all about productivity. I did a survey at work about replacing a well-known development environment with eclipse and the result was "our only real requirement is intellisense". Cheers, Kyle ________________________________ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dody Gunawinata Sent: Monday, 30 March 2009 6:57 AM To: Discussion of IronPython Subject: Re: [IronPython] Announcing IronPython 2.6 Alpha 1 I think the fact that there are more users for "Assembly for Web Pages" and "AJAX on ALGOL" than IronPython for ASP.Net contributes to the delay in updates. It's too bad for us that got addicted to the elegance of the solution in the first place. I remember a couple of months ago about updated support for intellisense in IP for ASP.Net, etc. Those are nice to have but I think an updated IP would be enough to make everybody involved ecstatic. I got a feeling intellisense is not a major blocker for iron python adoption. 2009/3/28 Adam Brand Any update on the timeline for getting IronPython for ASP.Net updated? This would make a world of difference for our IronPython-based web app. Adam Adam Brand SilverKey Technologies From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dody Gunawinata Sent: Saturday, March 28, 2009 1:09 PM To: Discussion of IronPython Subject: Re: [IronPython] Announcing IronPython 2.6 Alpha 1 This is awesome. Web application can benefit from this "adaptive compilation" approach a lot - especially for low trafficked sites. On Thu, Mar 26, 2009 at 11:08 PM, Giles Thomas wrote: Dave, This is great news, congratulations to the IP team on this release! We'll do a test-port of Resolver One early next week and will reply to the list with any issues we find. Cheers, Giles Dave Fugate wrote: Hello Python Community, We're pleased to announce the release of IronPython 2.6 Alpha 1. As you might imagine, this release is all about supporting new CPython 2.6 features such as the 'bytes' and 'bytearray' types (PEP 3112), decorators for classes (PEP 3129), advanced string formatting (PEP 3101), etc. The minimum .NET version required for this release is the same as IronPython 2.0; namely .NET 2.0 Service Pack 1. Unlike the 2.0 series of IronPython, we plan to release only a couple Alphas and Betas of IronPython 2.6. As such, it's key that we get your feedback on the release(s) quickly to incorporate requested changes. Besides CPython 2.6 features, another significant change in this release is that ipy.exe now uses "adaptive compilation" by default. Adaptive compilation is a technique in which IronPython: 1. Interprets and executes Python method calls up to /N/ times for a given method. If you're only going to execute a method a few times, it's typically faster to interpret the method instead of compiling and executing it 2. Compiles and executes the Python method call on the /N+1/ invocation of the method. Compilation of a Python method is a heavyweight operation, but we can reuse the result for subsequent invocations 3. Reuses the previously compiled method for new calls to the Python method. This operation is much faster than interpreting the method call as the method was already compiled in the previous step The reason for this change is that it provides a nice performance gain for Python code containing lots of functions/methods that only get called a few times. All this said, this feature is still undergoing active development and as a consequence some Python scripts may actually run slower with it turned on. For this reason, our old default mode of running Python scripts is still available by passing the -O or -D flags to ipy.exe. Any feedback on how this new feature affects your IronPython applications performance-wise would be greatly appreciated. There's also a few minor changes since IronPython 2.0.1 that are worth calling out here: * IronPython.msi now installs NGEN'ed binaries by default * IronPython.msi now offers a little more selection with respect to what you'd like to install. For example, Silverlight templates are optional * The default installation location of IronPython.msi no longer indicates whether the 2.6 release is an Alpha, Beta, or a patched release. Future IronPython 2.6 installations will replace previous 2.6 releases which will be uninstalled automatically * The -X:PreferComInteropAssembly flag has been removed. All COM interop is now done through normal COM dispatch You can download IronPython 2.6 Alpha 1 at: http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=22 982 The IronPython Team ------------------------------------------------------------------------ _______________________________________________ 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 -- nomadlife.org _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- nomadlife.org ************************************************************************ Allens Arthur Robinson online: http://www.aar.com.au This email is confidential and may be subject to legal or other professional privilege. It is also subject to copyright. If you have received it in error, confidentiality and privilege are not waived and you must not disclose or use the information in it. Please notify the sender by return email and delete it from your system. Any personal information in this email must be handled in accordance with the Privacy Act 1988 (Cth). ************************************************************************* -------------- next part -------------- An HTML attachment was scrubbed... URL: From brian.curtin at gmail.com Mon Mar 30 00:55:27 2009 From: brian.curtin at gmail.com (curtin@acm.org) Date: Sun, 29 Mar 2009 17:55:27 -0500 Subject: [IronPython] Announcing IronPython 2.6 Alpha 1 In-Reply-To: References: <49CBEECA.2080104@resolversystems.com> <8cd017b80903281309m4a1e2767n9003a4034a8b0113@mail.gmail.com> <064c01c9afe4$f736d560$e5a48020$@com> <8cd017b80903291256p7553da58xb4159c23069f7465@mail.gmail.com> Message-ID: Intellisense is a cosmetic feature at best. It's obviously nice to have, but it can't actually be *that* important to anyone...it's not like the information isn't available via other means. 2009/3/29 Howland-Rose, Kyle > Hi Adam, > > About "intellisense is not a major blocker for iron python adoption". > > Unfortunately I think it might be. The commercial world is all about > productivity. I did a survey at work about replacing a well-known > development environment with eclipse and the result was "our only real > requirement is intellisense". > > Cheers, > Kyle > > ------------------------------ > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Dody Gunawinata > *Sent:* Monday, 30 March 2009 6:57 AM > > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] Announcing IronPython 2.6 Alpha 1 > > I think the fact that there are more users for "Assembly for Web Pages" > and "AJAX on ALGOL" than IronPython for ASP.Net contributes to the delay in > updates. It's too bad for us that got addicted to the elegance of the > solution in the first place. I remember a couple of months ago about updated > support for intellisense in IP for ASP.Net, etc. Those are nice to have but > I think an updated IP would be enough to make everybody involved ecstatic. I > got a feeling intellisense is not a major blocker for iron python adoption. > > 2009/3/28 Adam Brand > >> Any update on the timeline for getting IronPython for ASP.Net updated? >> This would make a world of difference for our IronPython-based web app. >> >> >> >> Adam >> >> >> >> Adam Brand >> >> SilverKey Technologies >> >> >> >> *From:* users-bounces at lists.ironpython.com [mailto: >> users-bounces at lists.ironpython.com] *On Behalf Of *Dody Gunawinata >> *Sent:* Saturday, March 28, 2009 1:09 PM >> *To:* Discussion of IronPython >> *Subject:* Re: [IronPython] Announcing IronPython 2.6 Alpha 1 >> >> >> >> This is awesome. Web application can benefit from this "adaptive >> compilation" approach a lot - especially for low trafficked sites. >> >> On Thu, Mar 26, 2009 at 11:08 PM, Giles Thomas < >> giles.thomas at resolversystems.com> wrote: >> >> Dave, >> >> This is great news, congratulations to the IP team on this release! We'll >> do a test-port of Resolver One early next week and will reply to the list >> with any issues we find. >> >> >> Cheers, >> >> Giles >> >> >> Dave Fugate wrote: >> >> Hello Python Community, >> >> We?re pleased to announce the release of IronPython 2.6 Alpha 1. As you >> might imagine, this release is all about supporting new CPython 2.6 features >> such as the ?bytes? and ?bytearray? types (PEP 3112), decorators for classes >> (PEP 3129), advanced string formatting (PEP 3101), etc. The minimum .NET >> version required for this release is the same as IronPython 2.0; namely .NET >> 2.0 Service Pack 1. Unlike the 2.0 series of IronPython, we plan to release >> only a couple Alphas and Betas of IronPython 2.6. As such, it?s key that we >> get your feedback on the release(s) quickly to incorporate requested >> changes. >> >> Besides CPython 2.6 features, another significant change in this release >> is that ipy.exe now uses ?adaptive compilation? by default. Adaptive >> compilation is a technique in which IronPython: >> >> 1. Interprets and executes Python method calls up to /N/ times for a given >> method. If you?re only going to execute a method a few times, it?s typically >> faster to interpret the method instead of compiling and executing it >> >> 2. Compiles and executes the Python method call on the /N+1/ invocation of >> the method. Compilation of a Python method is a heavyweight operation, but >> we can reuse the result for subsequent invocations >> >> 3. Reuses the previously compiled method for new calls to the Python >> method. This operation is much faster than interpreting the method call as >> the method was already compiled in the previous step >> >> The reason for this change is that it provides a nice performance gain for >> Python code containing lots of functions/methods that only get called a few >> times. All this said, this feature is still undergoing active development >> and as a consequence some Python scripts may actually run slower with it >> turned on. For this reason, our old default mode of running Python scripts >> is still available by passing the ?O or -D flags to ipy.exe. Any feedback on >> how this new feature affects your IronPython applications performance-wise >> would be greatly appreciated. >> >> There?s also a few minor changes since IronPython 2.0.1 that are worth >> calling out here: >> >> ? IronPython.msi now installs NGEN?ed binaries by default >> >> ? IronPython.msi now offers a little more selection with respect to what >> you?d like to install. For example, Silverlight templates are optional >> >> ? The default installation location of IronPython.msi no longer indicates >> whether the 2.6 release is an Alpha, Beta, or a patched release. Future >> IronPython 2.6 installations will replace previous 2.6 releases which will >> be uninstalled automatically >> >> ? The -X:PreferComInteropAssembly flag has been removed. All COM interop >> is now done through normal COM dispatch >> >> You can download IronPython 2.6 Alpha 1 at: >> http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=22982 >> >> The IronPython Team >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> 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 >> >> >> >> >> -- >> nomadlife.org >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > > -- > nomadlife.org > > > > ************************************************************************ > > Allens Arthur Robinson online: http://www.aar.com.au > > This email is confidential and may be subject to legal or other > professional privilege. It is also subject to copyright. If you have > received it in error, confidentiality and privilege are not waived and you > must not disclose or use the information in it. Please notify the sender by > return email and delete it from your system. Any personal information in > this email must be handled in accordance with the Privacy Act 1988 (Cth). > > ************************************************************************* > > _______________________________________________ > 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 Kyle.Howland-Rose at aar.com.au Mon Mar 30 01:50:23 2009 From: Kyle.Howland-Rose at aar.com.au (Howland-Rose, Kyle) Date: Mon, 30 Mar 2009 10:50:23 +1100 Subject: [IronPython] Announcing IronPython 2.6 Alpha 1 In-Reply-To: References: <49CBEECA.2080104@resolversystems.com><8cd017b80903281309m4a1e2767n9003a4034a8b0113@mail.gmail.com><064c01c9afe4$f736d560$e5a48020$@com><8cd017b80903291256p7553da58xb4159c23069f7465@mail.gmail.com> Message-ID: I suggest that intellisense is a productivity feature. I know that is how it is considered where I work. Is productivity cosmetic? Massively :) ________________________________ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of curtin at acm.org Sent: Monday, 30 March 2009 9:55 AM To: Discussion of IronPython Subject: Re: [IronPython] Announcing IronPython 2.6 Alpha 1 Intellisense is a cosmetic feature at best. It's obviously nice to have, but it can't actually be that important to anyone...it's not like the information isn't available via other means. 2009/3/29 Howland-Rose, Kyle Hi Adam, About "intellisense is not a major blocker for iron python adoption". Unfortunately I think it might be. The commercial world is all about productivity. I did a survey at work about replacing a well-known development environment with eclipse and the result was "our only real requirement is intellisense". Cheers, Kyle ________________________________ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dody Gunawinata Sent: Monday, 30 March 2009 6:57 AM To: Discussion of IronPython Subject: Re: [IronPython] Announcing IronPython 2.6 Alpha 1 I think the fact that there are more users for "Assembly for Web Pages" and "AJAX on ALGOL" than IronPython for ASP.Net contributes to the delay in updates. It's too bad for us that got addicted to the elegance of the solution in the first place. I remember a couple of months ago about updated support for intellisense in IP for ASP.Net, etc. Those are nice to have but I think an updated IP would be enough to make everybody involved ecstatic. I got a feeling intellisense is not a major blocker for iron python adoption. 2009/3/28 Adam Brand Any update on the timeline for getting IronPython for ASP.Net updated? This would make a world of difference for our IronPython-based web app. Adam Adam Brand SilverKey Technologies From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dody Gunawinata Sent: Saturday, March 28, 2009 1:09 PM To: Discussion of IronPython Subject: Re: [IronPython] Announcing IronPython 2.6 Alpha 1 This is awesome. Web application can benefit from this "adaptive compilation" approach a lot - especially for low trafficked sites. On Thu, Mar 26, 2009 at 11:08 PM, Giles Thomas wrote: Dave, This is great news, congratulations to the IP team on this release! We'll do a test-port of Resolver One early next week and will reply to the list with any issues we find. Cheers, Giles Dave Fugate wrote: Hello Python Community, We're pleased to announce the release of IronPython 2.6 Alpha 1. As you might imagine, this release is all about supporting new CPython 2.6 features such as the 'bytes' and 'bytearray' types (PEP 3112), decorators for classes (PEP 3129), advanced string formatting (PEP 3101), etc. The minimum .NET version required for this release is the same as IronPython 2.0; namely .NET 2.0 Service Pack 1. Unlike the 2.0 series of IronPython, we plan to release only a couple Alphas and Betas of IronPython 2.6. As such, it's key that we get your feedback on the release(s) quickly to incorporate requested changes. Besides CPython 2.6 features, another significant change in this release is that ipy.exe now uses "adaptive compilation" by default. Adaptive compilation is a technique in which IronPython: 1. Interprets and executes Python method calls up to /N/ times for a given method. If you're only going to execute a method a few times, it's typically faster to interpret the method instead of compiling and executing it 2. Compiles and executes the Python method call on the /N+1/ invocation of the method. Compilation of a Python method is a heavyweight operation, but we can reuse the result for subsequent invocations 3. Reuses the previously compiled method for new calls to the Python method. This operation is much faster than interpreting the method call as the method was already compiled in the previous step The reason for this change is that it provides a nice performance gain for Python code containing lots of functions/methods that only get called a few times. All this said, this feature is still undergoing active development and as a consequence some Python scripts may actually run slower with it turned on. For this reason, our old default mode of running Python scripts is still available by passing the -O or -D flags to ipy.exe. Any feedback on how this new feature affects your IronPython applications performance-wise would be greatly appreciated. There's also a few minor changes since IronPython 2.0.1 that are worth calling out here: * IronPython.msi now installs NGEN'ed binaries by default * IronPython.msi now offers a little more selection with respect to what you'd like to install. For example, Silverlight templates are optional * The default installation location of IronPython.msi no longer indicates whether the 2.6 release is an Alpha, Beta, or a patched release. Future IronPython 2.6 installations will replace previous 2.6 releases which will be uninstalled automatically * The -X:PreferComInteropAssembly flag has been removed. All COM interop is now done through normal COM dispatch You can download IronPython 2.6 Alpha 1 at: http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=22 982 The IronPython Team ------------------------------------------------------------------------ _______________________________________________ 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 -- nomadlife.org _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- nomadlife.org ************************************************************************ Allens Arthur Robinson online: http://www.aar.com.au This email is confidential and may be subject to legal or other professional privilege. It is also subject to copyright. If you have received it in error, confidentiality and privilege are not waived and you must not disclose or use the information in it. Please notify the sender by return email and delete it from your system. Any personal information in this email must be handled in accordance with the Privacy Act 1988 (Cth). ************************************************************************ * _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com ************************************************************************ Allens Arthur Robinson online: http://www.aar.com.au This email is confidential and may be subject to legal or other professional privilege. It is also subject to copyright. If you have received it in error, confidentiality and privilege are not waived and you must not disclose or use the information in it. Please notify the sender by return email and delete it from your system. Any personal information in this email must be handled in accordance with the Privacy Act 1988 (Cth). ************************************************************************* -------------- next part -------------- An HTML attachment was scrubbed... URL: From adamb at silverkeytech.com Mon Mar 30 02:29:31 2009 From: adamb at silverkeytech.com (Adam Brand) Date: Sun, 29 Mar 2009 17:29:31 -0700 Subject: [IronPython] Announcing IronPython 2.6 Alpha 1 In-Reply-To: References: <710DF26F214D2B4BB94287123FFE980A2E15A3F55E@NA-EXMSG-C104.redmond.corp.microsoft.com><918705E903F4714CB713D89AB5F1857D884DB20530@NA-EXMSG-C116.redmond.corp.microsoft.com><49CBEECA.2080104@resolversystems.com><8cd017b80903281309m4a1e2767n9003a4034a8b0113@mail.gmail.com><064c01c9afe4$f736d560$e5a48020$@com> <8cd017b80903291256p7553da58xb4159c23069f7465@mail.gmail.com> Message-ID: <071901c9b0ce$98fd52e0$caf7f8a0$@com> I think that was directed at Dody.but now that you mention it, I'm sure there would be more adopters if there was more momentum behind ipy for asp.net rather than just ipy with intellisense. I suspect more people are developing web apps than not. Adam Adam Brand SilverKey Technologies From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Howland-Rose, Kyle Sent: Sunday, March 29, 2009 3:20 PM To: dody at nomadlife.org; Discussion of IronPython Subject: Re: [IronPython] Announcing IronPython 2.6 Alpha 1 Hi Adam, About "intellisense is not a major blocker for iron python adoption". Unfortunately I think it might be. The commercial world is all about productivity. I did a survey at work about replacing a well-known development environment with eclipse and the result was "our only real requirement is intellisense". Cheers, Kyle _____ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dody Gunawinata Sent: Monday, 30 March 2009 6:57 AM To: Discussion of IronPython Subject: Re: [IronPython] Announcing IronPython 2.6 Alpha 1 I think the fact that there are more users for "Assembly for Web Pages" and "AJAX on ALGOL" than IronPython for ASP.Net contributes to the delay in updates. It's too bad for us that got addicted to the elegance of the solution in the first place. I remember a couple of months ago about updated support for intellisense in IP for ASP.Net, etc. Those are nice to have but I think an updated IP would be enough to make everybody involved ecstatic. I got a feeling intellisense is not a major blocker for iron python adoption. 2009/3/28 Adam Brand Any update on the timeline for getting IronPython for ASP.Net updated? This would make a world of difference for our IronPython-based web app. Adam Adam Brand SilverKey Technologies From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dody Gunawinata Sent: Saturday, March 28, 2009 1:09 PM To: Discussion of IronPython Subject: Re: [IronPython] Announcing IronPython 2.6 Alpha 1 This is awesome. Web application can benefit from this "adaptive compilation" approach a lot - especially for low trafficked sites. On Thu, Mar 26, 2009 at 11:08 PM, Giles Thomas wrote: Dave, This is great news, congratulations to the IP team on this release! We'll do a test-port of Resolver One early next week and will reply to the list with any issues we find. Cheers, Giles Dave Fugate wrote: Hello Python Community, We're pleased to announce the release of IronPython 2.6 Alpha 1. As you might imagine, this release is all about supporting new CPython 2.6 features such as the 'bytes' and 'bytearray' types (PEP 3112), decorators for classes (PEP 3129), advanced string formatting (PEP 3101), etc. The minimum .NET version required for this release is the same as IronPython 2.0; namely .NET 2.0 Service Pack 1. Unlike the 2.0 series of IronPython, we plan to release only a couple Alphas and Betas of IronPython 2.6. As such, it's key that we get your feedback on the release(s) quickly to incorporate requested changes. Besides CPython 2.6 features, another significant change in this release is that ipy.exe now uses "adaptive compilation" by default. Adaptive compilation is a technique in which IronPython: 1. Interprets and executes Python method calls up to /N/ times for a given method. If you're only going to execute a method a few times, it's typically faster to interpret the method instead of compiling and executing it 2. Compiles and executes the Python method call on the /N+1/ invocation of the method. Compilation of a Python method is a heavyweight operation, but we can reuse the result for subsequent invocations 3. Reuses the previously compiled method for new calls to the Python method. This operation is much faster than interpreting the method call as the method was already compiled in the previous step The reason for this change is that it provides a nice performance gain for Python code containing lots of functions/methods that only get called a few times. All this said, this feature is still undergoing active development and as a consequence some Python scripts may actually run slower with it turned on. For this reason, our old default mode of running Python scripts is still available by passing the -O or -D flags to ipy.exe. Any feedback on how this new feature affects your IronPython applications performance-wise would be greatly appreciated. There's also a few minor changes since IronPython 2.0.1 that are worth calling out here: . IronPython.msi now installs NGEN'ed binaries by default . IronPython.msi now offers a little more selection with respect to what you'd like to install. For example, Silverlight templates are optional . The default installation location of IronPython.msi no longer indicates whether the 2.6 release is an Alpha, Beta, or a patched release. Future IronPython 2.6 installations will replace previous 2.6 releases which will be uninstalled automatically . The -X:PreferComInteropAssembly flag has been removed. All COM interop is now done through normal COM dispatch You can download IronPython 2.6 Alpha 1 at: http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=22982 The IronPython Team ------------------------------------------------------------------------ _______________________________________________ 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 -- nomadlife.org _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- nomadlife.org ************************************************************************ Allens Arthur Robinson online: http://www.aar.com.au This email is confidential and may be subject to legal or other professional privilege. It is also subject to copyright. If you have received it in error, confidentiality and privilege are not waived and you must not disclose or use the information in it. Please notify the sender by return email and delete it from your system. Any personal information in this email must be handled in accordance with the Privacy Act 1988 (Cth). ************************************************************************* -------------- next part -------------- An HTML attachment was scrubbed... URL: From adamb at silverkeytech.com Mon Mar 30 02:35:55 2009 From: adamb at silverkeytech.com (Adam Brand) Date: Sun, 29 Mar 2009 17:35:55 -0700 Subject: [IronPython] try...finally in yield In-Reply-To: References: <8bd92c0e0903281802r36fe00d0rcc587e4a1f7f989f@mail.gmail.com> Message-ID: <072901c9b0cf$7e0893e0$7a19bba0$@com> We are using 2.0 beta I think as part of ipy for asp.net. I don't think close() is implemented in that version. Am I wrong? Harry (who made it) suggested this: def _process(xr): while xr.Read(): xr.MoveToContent() node = XmlNode(xr) yield node if xr.IsEmptyElement: node = XmlNode(xr, endElement=True) yield node def load(xml): """generates an iterator over the XmlNodes in the stream of XML represented by the xml argument""" if isinstance(xml, XmlReader): for n in _process(xml): yield n else: with XmlReader.Create(xml) as xr: for n in _process(xr): yield n Adam Brand SilverKey Technologies From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher Sent: Saturday, March 28, 2009 7:39 PM To: Discussion of IronPython Subject: Re: [IronPython] try...finally in yield So I assume you're calling close() on the generator? A try/finally around the code in the generator can be used to catch the StopIteration exception and force the dispose. But even better, you could say "from __future__ import with_statement" at the top of your file and then say something like this: def parse(xml): with XmlReader.Create(xml) as xr while xr.Read(): [...] We automatically do the right thing when using "with" and IDisposable, so "with" effectively becomes like a C# "using" block. 2009/3/28 Adam Brand I'm using IronPython for ASP.Net...have some code (not mine, http://devhawk.net/2008/05/07/Deserializing+XML+With+IronPython.aspx - Harry Pierson's) that converts an xml file into an object. It has the below function: def parse(xml): xr = XmlReader.Create(xml) while xr.Read(): xr.MoveToContent() node = XmlNode(xr) yield node if (xr.IsEmptyElement): node.nodeType = XmlNodeType.EndElement del node.attributes yield node This code is problematic as it locks the xml file it is reading. I tried a try...finally to do a .Close() and .Dispose(), but the compiler was not happy with that. Just putting .Close() and .Dispose() at the end doesn't work. In reading up, I found this: http://docs.python.org/whatsnew/2.5.html#pep-342 "The addition of the close() method has one side effect that isn't obvious. close() is called when a generator is garbage-collected, so this means the generator's code gets one last chance to run before the generator is destroyed. This last chance means that try...finally statements in generators can now be guaranteed to work; the finally clause will now always get a chance to run. The syntactic restriction that you couldn't mix yield statements with a try...finally suite has therefore been removed. " I'm guessing that this isn't implemented in the version of IronPython in IP for ASP.Net. Does anyone have any ideas on a workaround for the generator for this version? Thanks, Adam -- Adam Brand _______________________________________________ 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 curt at hagenlocher.org Mon Mar 30 03:27:27 2009 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sun, 29 Mar 2009 18:27:27 -0700 Subject: [IronPython] try...finally in yield In-Reply-To: <072901c9b0cf$7e0893e0$7a19bba0$@com> References: <8bd92c0e0903281802r36fe00d0rcc587e4a1f7f989f@mail.gmail.com> <072901c9b0cf$7e0893e0$7a19bba0$@com> Message-ID: Maybe I don't understand the problem you're having. Can you describe it with a little more detail? When exactly do you want the file to be closed? 2009/3/29 Adam Brand > We are using 2.0 beta I think as part of ipy for asp.net. I don?t think > close() is implemented in that version? Am I wrong? > > > > Harry (who made it) suggested this: > > def _process(xr): > while xr.Read(): > xr.MoveToContent() > node = XmlNode(xr) > yield node > if xr.IsEmptyElement: > node = XmlNode(xr, endElement=True) > yield node > > > > def load(xml): > """generates an iterator over the XmlNodes in the stream of XML > represented by the xml argument""" > if isinstance(xml, XmlReader): > for n in _process(xml): yield n > else: > with XmlReader.Create(xml) as xr: > for n in _process(xr): yield n > > > > > > Adam Brand > > SilverKey Technologies > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Curt Hagenlocher > *Sent:* Saturday, March 28, 2009 7:39 PM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] try...finally in yield > > > > So I assume you're calling close() on the generator? A try/finally around > the code in the generator can be used to catch the StopIteration exception > and force the dispose. But even better, you could say "from __future__ > import with_statement" at the top of your file and then say something like > this: > > def parse(xml): > with XmlReader.Create(xml) as xr > while xr.Read(): > [...] > > We automatically do the right thing when using "with" and IDisposable, so > "with" effectively becomes like a C# "using" block. > > 2009/3/28 Adam Brand > > I'm using IronPython for ASP.Net...have some code (not mine, > http://devhawk.net/2008/05/07/Deserializing+XML+With+IronPython.aspx - > Harry Pierson's) that converts an xml file into an object. It has the below > function: > > def parse(xml): > xr = XmlReader.Create(xml) > while xr.Read(): > xr.MoveToContent() > node = XmlNode(xr) > yield node > if (xr.IsEmptyElement): > node.nodeType = XmlNodeType.EndElement > del node.attributes > yield node > > This code is problematic as it locks the xml file it is reading. I tried a > try...finally to do a .Close() and .Dispose(), but the compiler was not > happy with that. Just putting .Close() and .Dispose() at the end doesn't > work. > > In reading up, I found this: > http://docs.python.org/whatsnew/2.5.html#pep-342 > > "The addition of the close() method has one side effect that isn?t obvious. > close() is called when a generator is garbage-collected, so this means the > generator?s code gets one last chance to run before the generator is > destroyed. This last chance means that try...finally statements in > generators can now be guaranteed to work; the finally clause will now always > get a chance to run. The syntactic restriction that you couldn?t mix yield > statements with a try...finally suite has therefore been removed. " > > I'm guessing that this isn't implemented in the version of IronPython in IP > for ASP.Net. > > Does anyone have any ideas on a workaround for the generator for this > version? > > Thanks, > Adam > > -- > Adam Brand > > > _______________________________________________ > 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 LHaynes at Gemcomsoftware.com Mon Mar 30 04:36:35 2009 From: LHaynes at Gemcomsoftware.com (Leighton Haynes) Date: Sun, 29 Mar 2009 19:36:35 -0700 Subject: [IronPython] Announcing IronPython 2.6 Alpha 1 In-Reply-To: References: <49CBEECA.2080104@resolversystems.com> <8cd017b80903281309m4a1e2767n9003a4034a8b0113@mail.gmail.com> <064c01c9afe4$f736d560$e5a48020$@com> <8cd017b80903291256p7553da58xb4159c23069f7465@mail.gmail.com> Message-ID: <6588DE564DC1174F8D0C48C37306D4FE013492F93DAC@MAILBOX2.gemcomsoftware.priv> I have to say - Intellisense is very high on our wishlist - we have many developers unfamiliar with Python, and Intellisense would ease the transition a lot. Cheers, Leighton Haynes Gemcom Software International From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of curtin at acm.org Sent: Monday, 30 March 2009 6:55 AM To: Discussion of IronPython Subject: Re: [IronPython] Announcing IronPython 2.6 Alpha 1 Intellisense is a cosmetic feature at best. It's obviously nice to have, but it can't actually be that important to anyone...it's not like the information isn't available via other means. 2009/3/29 Howland-Rose, Kyle > Hi Adam, About "intellisense is not a major blocker for iron python adoption". Unfortunately I think it might be. The commercial world is all about productivity. I did a survey at work about replacing a well-known development environment with eclipse and the result was "our only real requirement is intellisense". Cheers, Kyle ________________________________ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dody Gunawinata Sent: Monday, 30 March 2009 6:57 AM To: Discussion of IronPython Subject: Re: [IronPython] Announcing IronPython 2.6 Alpha 1 I think the fact that there are more users for "Assembly for Web Pages" and "AJAX on ALGOL" than IronPython for ASP.Net contributes to the delay in updates. It's too bad for us that got addicted to the elegance of the solution in the first place. I remember a couple of months ago about updated support for intellisense in IP for ASP.Net, etc. Those are nice to have but I think an updated IP would be enough to make everybody involved ecstatic. I got a feeling intellisense is not a major blocker for iron python adoption. 2009/3/28 Adam Brand > Any update on the timeline for getting IronPython for ASP.Net updated? This would make a world of difference for our IronPython-based web app. Adam Adam Brand SilverKey Technologies From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dody Gunawinata Sent: Saturday, March 28, 2009 1:09 PM To: Discussion of IronPython Subject: Re: [IronPython] Announcing IronPython 2.6 Alpha 1 This is awesome. Web application can benefit from this "adaptive compilation" approach a lot - especially for low trafficked sites. On Thu, Mar 26, 2009 at 11:08 PM, Giles Thomas > wrote: Dave, This is great news, congratulations to the IP team on this release! We'll do a test-port of Resolver One early next week and will reply to the list with any issues we find. Cheers, Giles Dave Fugate wrote: Hello Python Community, We're pleased to announce the release of IronPython 2.6 Alpha 1. As you might imagine, this release is all about supporting new CPython 2.6 features such as the 'bytes' and 'bytearray' types (PEP 3112), decorators for classes (PEP 3129), advanced string formatting (PEP 3101), etc. The minimum .NET version required for this release is the same as IronPython 2.0; namely .NET 2.0 Service Pack 1. Unlike the 2.0 series of IronPython, we plan to release only a couple Alphas and Betas of IronPython 2.6. As such, it's key that we get your feedback on the release(s) quickly to incorporate requested changes. Besides CPython 2.6 features, another significant change in this release is that ipy.exe now uses "adaptive compilation" by default. Adaptive compilation is a technique in which IronPython: 1. Interprets and executes Python method calls up to /N/ times for a given method. If you're only going to execute a method a few times, it's typically faster to interpret the method instead of compiling and executing it 2. Compiles and executes the Python method call on the /N+1/ invocation of the method. Compilation of a Python method is a heavyweight operation, but we can reuse the result for subsequent invocations 3. Reuses the previously compiled method for new calls to the Python method. This operation is much faster than interpreting the method call as the method was already compiled in the previous step The reason for this change is that it provides a nice performance gain for Python code containing lots of functions/methods that only get called a few times. All this said, this feature is still undergoing active development and as a consequence some Python scripts may actually run slower with it turned on. For this reason, our old default mode of running Python scripts is still available by passing the -O or -D flags to ipy.exe. Any feedback on how this new feature affects your IronPython applications performance-wise would be greatly appreciated. There's also a few minor changes since IronPython 2.0.1 that are worth calling out here: * IronPython.msi now installs NGEN'ed binaries by default * IronPython.msi now offers a little more selection with respect to what you'd like to install. For example, Silverlight templates are optional * The default installation location of IronPython.msi no longer indicates whether the 2.6 release is an Alpha, Beta, or a patched release. Future IronPython 2.6 installations will replace previous 2.6 releases which will be uninstalled automatically * The -X:PreferComInteropAssembly flag has been removed. All COM interop is now done through normal COM dispatch You can download IronPython 2.6 Alpha 1 at: http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=22982 The IronPython Team ------------------------------------------------------------------------ _______________________________________________ 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 -- nomadlife.org _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- nomadlife.org ************************************************************************ Allens Arthur Robinson online: http://www.aar.com.au This email is confidential and may be subject to legal or other professional privilege. It is also subject to copyright. If you have received it in error, confidentiality and privilege are not waived and you must not disclose or use the information in it. Please notify the sender by return email and delete it from your system. Any personal information in this email must be handled in accordance with the Privacy Act 1988 (Cth). ************************************************************************* _______________________________________________ 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 antont at kyperjokki.fi Mon Mar 30 07:38:18 2009 From: antont at kyperjokki.fi (Toni Alatalo) Date: Mon, 30 Mar 2009 08:38:18 +0300 Subject: [IronPython] intellisense (Re: Announcing IronPython 2.6 Alpha 1) In-Reply-To: <6588DE564DC1174F8D0C48C37306D4FE013492F93DAC@MAILBOX2.gemcomsoftware.priv> References: <49CBEECA.2080104@resolversystems.com> <8cd017b80903281309m4a1e2767n9003a4034a8b0113@mail.gmail.com> <064c01c9afe4$f736d560$e5a48020$@com> <8cd017b80903291256p7553da58xb4159c23069f7465@mail.gmail.com> <6588DE564DC1174F8D0C48C37306D4FE013492F93DAC@MAILBOX2.gemcomsoftware.priv> Message-ID: <49D05ACA.9090408@kyperjokki.fi> Leighton Haynes kirjoitti: > > I have to say ? Intellisense is very high on our wishlist ? we have > many developers unfamiliar with Python, and Intellisense would ease > the transition a lot. > Has anyone looked at implementing this yet? I haven't looked at what IronPy studio or any other ironpy tool does, just a note here based on experience elsewhere: As I guess you all know, 'tab completion' with a fully dynamic language is not at all similar to how it is in a static language like c#. A simple useless example: In [1]: def plus(a, b): ...: return a + b In [2]: plus(1, 2) Out[2]: 3 In [3]: plus("hip", "hop") Out[3]: 'hiphop' So if you are inside the 'plus' function there with intellisense: def plus(a, b): a.** #what do you expect intellisense to do here? show int or str methods, or something else? a could be of *any* type. and if you don't benefit from that functionality, you might be as well writing c# (or perhaps Boo..) AFAIK there are two approaches to this problem: a) some IDEs like Eclipse /parse/ the code in your project and track types, so that if they see a = MyClass() somewhere, the 'tab completion' there can then show members from that class when a is looked at. this seems to be limited, at least when i saw a friend using it it didn't reach inside libraries etc - just own classes in the same project - but at least is something. b) other dev envs actually *run* the Python code to have instanciated objects when editing the code, so can do introspecting normally. with IPython (I for *interactive*, the shell with in-out prompt from where I pasted the example earlier) that's easy 'cause it's not an editor but a shell so it's natural to have actual live objects at hand, and tab-completion etc. work. but ppl have done that for editors too - at least Theo de Ridder made his own editor (which uses wx as a base) work so that it in fact runs the py code up to your cursor, marks if there is a bug somewhere, and iirc has some sort of intellisense like feats via introspection. i don't actually know whether that works somehow also with the ipython integrations that ppl have recently done to many editors. perhaps there is some other good solution that i don't know about, but it's hard for me to see a simple perfect solution due to the extreme dynamicity of the lang. of course the parsing solution a) works easily for code like: a = "somestring"; a.** -- i suppose that works ok in Eclipse / PyDev already, would be already helpful, and i suppose easy enough to implement for Intellisense (i don't know anything about it). dunno if the b) approach would be useful within VS somehow too, can be quite tricky i imagine. > Leighton Haynes > ~Toni, Playsign > *From:* users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *curtin at acm.org > *Sent:* Monday, 30 March 2009 6:55 AM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] Announcing IronPython 2.6 Alpha 1 > > Intellisense is a cosmetic feature at best. It's obviously nice to > have, but it can't actually be /that/ important to anyone...it's not > like the information isn't available via other means. > > 2009/3/29 Howland-Rose, Kyle > > > Hi Adam, > > About "intellisense is not a major blocker for iron python adoption". > > Unfortunately I think it might be. The commercial world is all about > productivity. I did a survey at work about replacing a well-known > development environment with eclipse and the result was "our only real > requirement is intellisense". > > Cheers, > > Kyle > > ------------------------------------------------------------------------ > > *From:* users-bounces at lists.ironpython.com > > [mailto:users-bounces at lists.ironpython.com > ] *On Behalf Of *Dody > Gunawinata > > *Sent:* Monday, 30 March 2009 6:57 AM > > > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] Announcing IronPython 2.6 Alpha 1 > > I think the fact that there are more users for "Assembly for Web > Pages" and "AJAX on ALGOL" than IronPython for ASP.Net contributes to > the delay in updates. It's too bad for us that got addicted to the > elegance of the solution in the first place. I remember a couple of > months ago about updated support for intellisense in IP for ASP.Net, > etc. Those are nice to have but I think an updated IP would be enough > to make everybody involved ecstatic. I got a feeling intellisense is > not a major blocker for iron python adoption. > > 2009/3/28 Adam Brand > > > Any update on the timeline for getting IronPython for ASP.Net updated? > This would make a world of difference for our IronPython-based web app. > > Adam > > Adam Brand > > SilverKey Technologies > > *From:* users-bounces at lists.ironpython.com > > [mailto:users-bounces at lists.ironpython.com > ] *On Behalf Of *Dody > Gunawinata > *Sent:* Saturday, March 28, 2009 1:09 PM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] Announcing IronPython 2.6 Alpha 1 > > This is awesome. Web application can benefit from this "adaptive > compilation" approach a lot - especially for low trafficked sites. > > On Thu, Mar 26, 2009 at 11:08 PM, Giles Thomas > > wrote: > > Dave, > > This is great news, congratulations to the IP team on this release! > We'll do a test-port of Resolver One early next week and will reply to > the list with any issues we find. > > > Cheers, > > Giles > > > Dave Fugate wrote: > > Hello Python Community, > > We?re pleased to announce the release of IronPython 2.6 Alpha 1. As > you might imagine, this release is all about supporting new CPython > 2.6 features such as the ?bytes? and ?bytearray? types (PEP 3112), > decorators for classes (PEP 3129), advanced string formatting (PEP > 3101), etc. The minimum .NET version required for this release is the > same as IronPython 2.0; namely .NET 2.0 Service Pack 1. Unlike the 2.0 > series of IronPython, we plan to release only a couple Alphas and > Betas of IronPython 2.6. As such, it?s key that we get your feedback > on the release(s) quickly to incorporate requested changes. > > Besides CPython 2.6 features, another significant change in this > release is that ipy.exe now uses ?adaptive compilation? by default. > Adaptive compilation is a technique in which IronPython: > > 1. Interprets and executes Python method calls up to /N/ times for a > given method. If you?re only going to execute a method a few times, > it?s typically faster to interpret the method instead of compiling and > executing it > > 2. Compiles and executes the Python method call on the /N+1/ > invocation of the method. Compilation of a Python method is a > heavyweight operation, but we can reuse the result for subsequent > invocations > > 3. Reuses the previously compiled method for new calls to the Python > method. This operation is much faster than interpreting the method > call as the method was already compiled in the previous step > > The reason for this change is that it provides a nice performance gain > for Python code containing lots of functions/methods that only get > called a few times. All this said, this feature is still undergoing > active development and as a consequence some Python scripts may > actually run slower with it turned on. For this reason, our old > default mode of running Python scripts is still available by passing > the ?O or -D flags to ipy.exe. Any feedback on how this new feature > affects your IronPython applications performance-wise would be greatly > appreciated. > > There?s also a few minor changes since IronPython 2.0.1 that are worth > calling out here: > > ? IronPython.msi now installs NGEN?ed binaries by default > > ? IronPython.msi now offers a little more selection with respect to > what you?d like to install. For example, Silverlight templates are > optional > > ? The default installation location of IronPython.msi no longer > indicates whether the 2.6 release is an Alpha, Beta, or a patched > release. Future IronPython 2.6 installations will replace previous 2.6 > releases which will be uninstalled automatically > > ? The -X:PreferComInteropAssembly flag has been removed. All COM > interop is now done through normal COM dispatch > > You can download IronPython 2.6 Alpha 1 at: > http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=22982 > > > The IronPython Team > > ------------------------------------------------------------------------ > > _______________________________________________ > 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 > > > > > -- > nomadlife.org > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > -- > nomadlife.org > > ************************************************************************ > > Allens Arthur Robinson online: http://www.aar.com.au > > This email is confidential and may be subject to legal or other > professional privilege. It is also subject to copyright. If you have > received it in error, confidentiality and privilege are not waived and > you must not disclose or use the information in it. Please notify the > sender by return email and delete it from your system. Any personal > information in this email must be handled in accordance with the > Privacy Act 1988 (Cth). > > ************************************************************************* > > > _______________________________________________ > 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 empirebuilder at gmail.com Mon Mar 30 10:28:55 2009 From: empirebuilder at gmail.com (Dody Gunawinata) Date: Mon, 30 Mar 2009 10:28:55 +0200 Subject: [IronPython] Announcing IronPython 2.6 Alpha 1 In-Reply-To: <6588DE564DC1174F8D0C48C37306D4FE013492F93DAC@MAILBOX2.gemcomsoftware.priv> References: <49CBEECA.2080104@resolversystems.com> <8cd017b80903281309m4a1e2767n9003a4034a8b0113@mail.gmail.com> <064c01c9afe4$f736d560$e5a48020$@com> <8cd017b80903291256p7553da58xb4159c23069f7465@mail.gmail.com> <6588DE564DC1174F8D0C48C37306D4FE013492F93DAC@MAILBOX2.gemcomsoftware.priv> Message-ID: <8cd017b80903300128k1b31f5a2obda8dd6967836146@mail.gmail.com> I think Intellisense is critical for static language development - especially since we have to put up with compilation there. In dynamic language, we have REPL - now that's a productivity feature. Anyway, I wish the DynamicPageFilter module (the one powering IP ASP.Net) has the same source policy as IP or MVC for ASP.Net. This way we can patch the runtime ourselves to keep it up to date with the latest IronPython gizmos. One other way out for this is to use NWSGI.Net and build yet another web framework on top of Python that uses asp.net existing components;which should be fun but I rather build some cool applications than building a framework. Dody G. 2009/3/30 Leighton Haynes > I have to say ? Intellisense is very high on our wishlist ? we have many > developers unfamiliar with Python, and Intellisense would ease the > transition a lot. > > > > Cheers, > > Leighton Haynes > > Gemcom Software International > > > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *curtin at acm.org > *Sent:* Monday, 30 March 2009 6:55 AM > > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] Announcing IronPython 2.6 Alpha 1 > > > > Intellisense is a cosmetic feature at best. It's obviously nice to have, > but it can't actually be *that* important to anyone...it's not like the > information isn't available via other means. > > 2009/3/29 Howland-Rose, Kyle > > Hi Adam, > > > > About "intellisense is not a major blocker for iron python adoption". > > > > Unfortunately I think it might be. The commercial world is all about > productivity. I did a survey at work about replacing a well-known > development environment with eclipse and the result was "our only real > requirement is intellisense". > > > > Cheers, > > Kyle > > > ------------------------------ > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Dody Gunawinata > > *Sent:* Monday, 30 March 2009 6:57 AM > > > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] Announcing IronPython 2.6 Alpha 1 > > > > I think the fact that there are more users for "Assembly for Web Pages" and > "AJAX on ALGOL" than IronPython for ASP.Net contributes to the delay in > updates. It's too bad for us that got addicted to the elegance of the > solution in the first place. I remember a couple of months ago about updated > support for intellisense in IP for ASP.Net, etc. Those are nice to have but > I think an updated IP would be enough to make everybody involved ecstatic. I > got a feeling intellisense is not a major blocker for iron python adoption. > > > > 2009/3/28 Adam Brand > > Any update on the timeline for getting IronPython for ASP.Net updated? This > would make a world of difference for our IronPython-based web app. > > > > Adam > > > > Adam Brand > > SilverKey Technologies > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Dody Gunawinata > *Sent:* Saturday, March 28, 2009 1:09 PM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] Announcing IronPython 2.6 Alpha 1 > > > > This is awesome. Web application can benefit from this "adaptive > compilation" approach a lot - especially for low trafficked sites. > > On Thu, Mar 26, 2009 at 11:08 PM, Giles Thomas < > giles.thomas at resolversystems.com> wrote: > > Dave, > > This is great news, congratulations to the IP team on this release! We'll > do a test-port of Resolver One early next week and will reply to the list > with any issues we find. > > > Cheers, > > Giles > > > Dave Fugate wrote: > > Hello Python Community, > > We?re pleased to announce the release of IronPython 2.6 Alpha 1. As you > might imagine, this release is all about supporting new CPython 2.6 features > such as the ?bytes? and ?bytearray? types (PEP 3112), decorators for classes > (PEP 3129), advanced string formatting (PEP 3101), etc. The minimum .NET > version required for this release is the same as IronPython 2.0; namely .NET > 2.0 Service Pack 1. Unlike the 2.0 series of IronPython, we plan to release > only a couple Alphas and Betas of IronPython 2.6. As such, it?s key that we > get your feedback on the release(s) quickly to incorporate requested > changes. > > Besides CPython 2.6 features, another significant change in this release is > that ipy.exe now uses ?adaptive compilation? by default. Adaptive > compilation is a technique in which IronPython: > > 1. Interprets and executes Python method calls up to /N/ times for a given > method. If you?re only going to execute a method a few times, it?s typically > faster to interpret the method instead of compiling and executing it > > 2. Compiles and executes the Python method call on the /N+1/ invocation of > the method. Compilation of a Python method is a heavyweight operation, but > we can reuse the result for subsequent invocations > > 3. Reuses the previously compiled method for new calls to the Python > method. This operation is much faster than interpreting the method call as > the method was already compiled in the previous step > > The reason for this change is that it provides a nice performance gain for > Python code containing lots of functions/methods that only get called a few > times. All this said, this feature is still undergoing active development > and as a consequence some Python scripts may actually run slower with it > turned on. For this reason, our old default mode of running Python scripts > is still available by passing the ?O or -D flags to ipy.exe. Any feedback on > how this new feature affects your IronPython applications performance-wise > would be greatly appreciated. > > There?s also a few minor changes since IronPython 2.0.1 that are worth > calling out here: > > ? IronPython.msi now installs NGEN?ed binaries by default > > ? IronPython.msi now offers a little more selection with respect to what > you?d like to install. For example, Silverlight templates are optional > > ? The default installation location of IronPython.msi no longer indicates > whether the 2.6 release is an Alpha, Beta, or a patched release. Future > IronPython 2.6 installations will replace previous 2.6 releases which will > be uninstalled automatically > > ? The -X:PreferComInteropAssembly flag has been removed. All COM interop is > now done through normal COM dispatch > > You can download IronPython 2.6 Alpha 1 at: > http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=22982 > > The IronPython Team > > ------------------------------------------------------------------------ > > _______________________________________________ > 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 > > > > > -- > nomadlife.org > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > -- > nomadlife.org > > > > ************************************************************************ > > Allens Arthur Robinson online: http://www.aar.com.au > > This email is confidential and may be subject to legal or other > professional privilege. It is also subject to copyright. If you have > received it in error, confidentiality and privilege are not waived and you > must not disclose or use the information in it. Please notify the sender by > return email and delete it from your system. Any personal information in > this email must be handled in accordance with the Privacy Act 1988 (Cth). > > ************************************************************************* > > > _______________________________________________ > 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 > > -- nomadlife.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Mon Mar 30 15:33:09 2009 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 30 Mar 2009 06:33:09 -0700 Subject: [IronPython] IronPython Profiler Message-ID: IronPython 2.6 Alpha 1 has some experimental profiling support built into it. For a few details, please see my blog entry at http://blogs.msdn.com/curth/archive/2009/03/29/an-ironpython-profiler.aspx. Feedback is welcomed. -- Curt Hagenlocher curt at hagenlocher.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Mon Mar 30 15:33:31 2009 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 30 Mar 2009 06:33:31 -0700 Subject: [IronPython] IronPython Profiler Message-ID: IronPython 2.6 Alpha 1 has some experimental profiling support built into it. For a few details, please see my blog entry at http://blogs.msdn.com/curth/archive/2009/03/29/an-ironpython-profiler.aspx. Feedback is welcomed. -- Curt Hagenlocher curt at hagenlocher.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jimmy.Schementi at microsoft.com Tue Mar 31 01:44:49 2009 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Mon, 30 Mar 2009 23:44:49 +0000 Subject: [IronPython] Announcing IronPython 2.6 Alpha 1 In-Reply-To: <064c01c9afe4$f736d560$e5a48020$@com> References: <350E7D38B6D819428718949920EC2355572684CC14@NA-EXMSG-C102.redmond.corp.microsoft.com> <710DF26F214D2B4BB94287123FFE980A2E15A3F55E@NA-EXMSG-C104.redmond.corp.microsoft.com> <918705E903F4714CB713D89AB5F1857D884DB20530@NA-EXMSG-C116.redmond.corp.microsoft.com> <49CBEECA.2080104@resolversystems.com> <8cd017b80903281309m4a1e2767n9003a4034a8b0113@mail.gmail.com> <064c01c9afe4$f736d560$e5a48020$@com> Message-ID: A IronPython 2.6 version of the ASP.NET integration will be out shortly, I have to get time to make a build and get it sent over to the ASP.NET team. I'm working through some other things I need to get done first, but assume two weeks. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Adam Brand Sent: Saturday, March 28, 2009 1:37 PM To: 'Discussion of IronPython' Subject: Re: [IronPython] Announcing IronPython 2.6 Alpha 1 Any update on the timeline for getting IronPython for ASP.Net updated? This would make a world of difference for our IronPython-based web app. Adam Adam Brand SilverKey Technologies From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dody Gunawinata Sent: Saturday, March 28, 2009 1:09 PM To: Discussion of IronPython Subject: Re: [IronPython] Announcing IronPython 2.6 Alpha 1 This is awesome. Web application can benefit from this "adaptive compilation" approach a lot - especially for low trafficked sites. On Thu, Mar 26, 2009 at 11:08 PM, Giles Thomas > wrote: Dave, This is great news, congratulations to the IP team on this release! We'll do a test-port of Resolver One early next week and will reply to the list with any issues we find. Cheers, Giles Dave Fugate wrote: Hello Python Community, We're pleased to announce the release of IronPython 2.6 Alpha 1. As you might imagine, this release is all about supporting new CPython 2.6 features such as the 'bytes' and 'bytearray' types (PEP 3112), decorators for classes (PEP 3129), advanced string formatting (PEP 3101), etc. The minimum .NET version required for this release is the same as IronPython 2.0; namely .NET 2.0 Service Pack 1. Unlike the 2.0 series of IronPython, we plan to release only a couple Alphas and Betas of IronPython 2.6. As such, it's key that we get your feedback on the release(s) quickly to incorporate requested changes. Besides CPython 2.6 features, another significant change in this release is that ipy.exe now uses "adaptive compilation" by default. Adaptive compilation is a technique in which IronPython: 1. Interprets and executes Python method calls up to /N/ times for a given method. If you're only going to execute a method a few times, it's typically faster to interpret the method instead of compiling and executing it 2. Compiles and executes the Python method call on the /N+1/ invocation of the method. Compilation of a Python method is a heavyweight operation, but we can reuse the result for subsequent invocations 3. Reuses the previously compiled method for new calls to the Python method. This operation is much faster than interpreting the method call as the method was already compiled in the previous step The reason for this change is that it provides a nice performance gain for Python code containing lots of functions/methods that only get called a few times. All this said, this feature is still undergoing active development and as a consequence some Python scripts may actually run slower with it turned on. For this reason, our old default mode of running Python scripts is still available by passing the -O or -D flags to ipy.exe. Any feedback on how this new feature affects your IronPython applications performance-wise would be greatly appreciated. There's also a few minor changes since IronPython 2.0.1 that are worth calling out here: * IronPython.msi now installs NGEN'ed binaries by default * IronPython.msi now offers a little more selection with respect to what you'd like to install. For example, Silverlight templates are optional * The default installation location of IronPython.msi no longer indicates whether the 2.6 release is an Alpha, Beta, or a patched release. Future IronPython 2.6 installations will replace previous 2.6 releases which will be uninstalled automatically * The -X:PreferComInteropAssembly flag has been removed. All COM interop is now done through normal COM dispatch You can download IronPython 2.6 Alpha 1 at: http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=22982 The IronPython Team ------------------------------------------------------------------------ _______________________________________________ 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 -- nomadlife.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From adamb at silverkeytech.com Tue Mar 31 06:37:15 2009 From: adamb at silverkeytech.com (Adam Brand) Date: Mon, 30 Mar 2009 21:37:15 -0700 Subject: [IronPython] Announcing IronPython 2.6 Alpha 1 In-Reply-To: References: <350E7D38B6D819428718949920EC2355572684CC14@NA-EXMSG-C102.redmond.corp.microsoft.com> <710DF26F214D2B4BB94287123FFE980A2E15A3F55E@NA-EXMSG-C104.redmond.corp.microsoft.com> <918705E903F4714CB713D89AB5F1857D884DB20530@NA-EXMSG-C116.redmond.corp.microsoft.com> <49CBEECA.2080104@resolversystems.com> <8cd017b80903281309m4a1e2767n9003a4034a8b0113@mail.gmail.com> <064c01c9afe4$f736d560$e5a48020$@com> Message-ID: <08cb01c9b1ba$5f6ca980$1e45fc80$@com> Fantastic! If you need any help in testing, let us know of course J. Adam Brand SilverKey Technologies From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jimmy Schementi Sent: Monday, March 30, 2009 4:45 PM To: Discussion of IronPython Subject: Re: [IronPython] Announcing IronPython 2.6 Alpha 1 A IronPython 2.6 version of the ASP.NET integration will be out shortly, I have to get time to make a build and get it sent over to the ASP.NET team. I'm working through some other things I need to get done first, but assume two weeks. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Adam Brand Sent: Saturday, March 28, 2009 1:37 PM To: 'Discussion of IronPython' Subject: Re: [IronPython] Announcing IronPython 2.6 Alpha 1 Any update on the timeline for getting IronPython for ASP.Net updated? This would make a world of difference for our IronPython-based web app. Adam Adam Brand SilverKey Technologies From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dody Gunawinata Sent: Saturday, March 28, 2009 1:09 PM To: Discussion of IronPython Subject: Re: [IronPython] Announcing IronPython 2.6 Alpha 1 This is awesome. Web application can benefit from this "adaptive compilation" approach a lot - especially for low trafficked sites. On Thu, Mar 26, 2009 at 11:08 PM, Giles Thomas wrote: Dave, This is great news, congratulations to the IP team on this release! We'll do a test-port of Resolver One early next week and will reply to the list with any issues we find. Cheers, Giles Dave Fugate wrote: Hello Python Community, We're pleased to announce the release of IronPython 2.6 Alpha 1. As you might imagine, this release is all about supporting new CPython 2.6 features such as the 'bytes' and 'bytearray' types (PEP 3112), decorators for classes (PEP 3129), advanced string formatting (PEP 3101), etc. The minimum .NET version required for this release is the same as IronPython 2.0; namely .NET 2.0 Service Pack 1. Unlike the 2.0 series of IronPython, we plan to release only a couple Alphas and Betas of IronPython 2.6. As such, it's key that we get your feedback on the release(s) quickly to incorporate requested changes. Besides CPython 2.6 features, another significant change in this release is that ipy.exe now uses "adaptive compilation" by default. Adaptive compilation is a technique in which IronPython: 1. Interprets and executes Python method calls up to /N/ times for a given method. If you're only going to execute a method a few times, it's typically faster to interpret the method instead of compiling and executing it 2. Compiles and executes the Python method call on the /N+1/ invocation of the method. Compilation of a Python method is a heavyweight operation, but we can reuse the result for subsequent invocations 3. Reuses the previously compiled method for new calls to the Python method. This operation is much faster than interpreting the method call as the method was already compiled in the previous step The reason for this change is that it provides a nice performance gain for Python code containing lots of functions/methods that only get called a few times. All this said, this feature is still undergoing active development and as a consequence some Python scripts may actually run slower with it turned on. For this reason, our old default mode of running Python scripts is still available by passing the -O or -D flags to ipy.exe. Any feedback on how this new feature affects your IronPython applications performance-wise would be greatly appreciated. There's also a few minor changes since IronPython 2.0.1 that are worth calling out here: . IronPython.msi now installs NGEN'ed binaries by default . IronPython.msi now offers a little more selection with respect to what you'd like to install. For example, Silverlight templates are optional . The default installation location of IronPython.msi no longer indicates whether the 2.6 release is an Alpha, Beta, or a patched release. Future IronPython 2.6 installations will replace previous 2.6 releases which will be uninstalled automatically . The -X:PreferComInteropAssembly flag has been removed. All COM interop is now done through normal COM dispatch You can download IronPython 2.6 Alpha 1 at: http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=22982 The IronPython Team ------------------------------------------------------------------------ _______________________________________________ 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 -- nomadlife.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From adamb at silverkeytech.com Tue Mar 31 06:40:47 2009 From: adamb at silverkeytech.com (Adam Brand) Date: Mon, 30 Mar 2009 21:40:47 -0700 Subject: [IronPython] try...finally in yield In-Reply-To: References: <8bd92c0e0903281802r36fe00d0rcc587e4a1f7f989f@mail.gmail.com> <072901c9b0cf$7e0893e0$7a19bba0$@com> Message-ID: <08d001c9b1ba$dd63fa00$982bee00$@com> You can check out the files in question here: http://github.com/devhawk/devhawk_ipy/tree. ... those files are patched now to use the below.which uses "with" to ensure the Dispose(). So the file is closed after the lines in the file are read. Adam Adam Brand SilverKey Technologies From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher Sent: Sunday, March 29, 2009 6:27 PM To: Discussion of IronPython Subject: Re: [IronPython] try...finally in yield Maybe I don't understand the problem you're having. Can you describe it with a little more detail? When exactly do you want the file to be closed? 2009/3/29 Adam Brand We are using 2.0 beta I think as part of ipy for asp.net. I don't think close() is implemented in that version. Am I wrong? Harry (who made it) suggested this: def _process(xr): while xr.Read(): xr.MoveToContent() node = XmlNode(xr) yield node if xr.IsEmptyElement: node = XmlNode(xr, endElement=True) yield node def load(xml): """generates an iterator over the XmlNodes in the stream of XML represented by the xml argument""" if isinstance(xml, XmlReader): for n in _process(xml): yield n else: with XmlReader.Create(xml) as xr: for n in _process(xr): yield n Adam Brand SilverKey Technologies From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher Sent: Saturday, March 28, 2009 7:39 PM To: Discussion of IronPython Subject: Re: [IronPython] try...finally in yield So I assume you're calling close() on the generator? A try/finally around the code in the generator can be used to catch the StopIteration exception and force the dispose. But even better, you could say "from __future__ import with_statement" at the top of your file and then say something like this: def parse(xml): with XmlReader.Create(xml) as xr while xr.Read(): [...] We automatically do the right thing when using "with" and IDisposable, so "with" effectively becomes like a C# "using" block. 2009/3/28 Adam Brand I'm using IronPython for ASP.Net...have some code (not mine, http://devhawk.net/2008/05/07/Deserializing+XML+With+IronPython.aspx - Harry Pierson's) that converts an xml file into an object. It has the below function: def parse(xml): xr = XmlReader.Create(xml) while xr.Read(): xr.MoveToContent() node = XmlNode(xr) yield node if (xr.IsEmptyElement): node.nodeType = XmlNodeType.EndElement del node.attributes yield node This code is problematic as it locks the xml file it is reading. I tried a try...finally to do a .Close() and .Dispose(), but the compiler was not happy with that. Just putting .Close() and .Dispose() at the end doesn't work. In reading up, I found this: http://docs.python.org/whatsnew/2.5.html#pep-342 "The addition of the close() method has one side effect that isn't obvious. close() is called when a generator is garbage-collected, so this means the generator's code gets one last chance to run before the generator is destroyed. This last chance means that try...finally statements in generators can now be guaranteed to work; the finally clause will now always get a chance to run. The syntactic restriction that you couldn't mix yield statements with a try...finally suite has therefore been removed. " I'm guessing that this isn't implemented in the version of IronPython in IP for ASP.Net. Does anyone have any ideas on a workaround for the generator for this version? Thanks, Adam -- Adam Brand _______________________________________________ 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 daftspaniel at gmail.com Tue Mar 31 22:52:13 2009 From: daftspaniel at gmail.com (Davy Mitchell) Date: Tue, 31 Mar 2009 21:52:13 +0100 Subject: [IronPython] PYC and 2.6 A1 Message-ID: <20253b0c0903311352pbb35055sa9bcbbdbb0623c8e@mail.gmail.com> Hi Guys, Are there known issues with PYC and IPY 2.6 A1? When my exe compiles, I get: Unhandled Exception: Microsoft.Scripting.Runtime.UnboundNameException: name 'ThreadExceptionEventArgs' is not defined at Microsoft.Scripting.Actions.Calls.MethodTarget.Caller.Call(Object[] args, Boolean& shouldOptimize) at IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`6.Call5(CallSite site, CodeContext context, TFuncType func, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) at Microsoft.Scripting.UpdateDelegates.UpdateAndExecute7[T0,T1,T2,T3,T4,T5,T6,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) at IronPython.Runtime.Importer.Import(CodeContext context, String fullName, PythonTuple from, Int32 level) at IronPython.Runtime.Operations.PythonOps.InitializeModule(Assembly precompiled, String main, String[] references) at PythonMain.Main() Works fine in 2.01. Thanks, Davy Mitchell -------------- next part -------------- An HTML attachment was scrubbed... URL: