From jimmy at schementi.com Fri Apr 1 03:05:51 2011 From: jimmy at schementi.com (Jimmy Schementi) Date: Thu, 31 Mar 2011 21:05:51 -0400 Subject: [IronPython] [Code Review] Custom PAL fixes Message-ID: Just checked in some small fixes to make the Importer use a custom Platform Adaptation Layer. I also started to tweak clr.CompileModules a bit, but backed those changes out, so just ignore those. Take a look at the recent commits to https://github.com/jschementi/iron. If there are no objections, I'll push them to main. By the way, is it about time to split this list into a development and users list, or you all don't mind seeing these type of mails? ~Jimmy -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Fri Apr 1 03:16:32 2011 From: dinov at microsoft.com (Dino Viehland) Date: Fri, 1 Apr 2011 01:16:32 +0000 Subject: [IronPython] [Code Review] Custom PAL fixes In-Reply-To: References: Message-ID: <6C7ABA8B4E309440B857D74348836F2E1502BF17@TK5EX14MBXC133.redmond.corp.microsoft.com> LGTM. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jimmy Schementi Sent: Thursday, March 31, 2011 6:06 PM To: Discussion of IronPython Subject: [IronPython] [Code Review] Custom PAL fixes Just checked in some small fixes to make the Importer use a custom Platform Adaptation Layer. I also started to tweak clr.CompileModules a bit, but backed those changes out, so just ignore those. Take a look at the recent commits to https://github.com/jschementi/iron. If there are no objections, I'll push them to main. By the way, is it about time to split this list into a development and users list, or you all don't mind seeing these type of mails? ~Jimmy -------------- next part -------------- An HTML attachment was scrubbed... URL: From haniti.grk at gmail.com Fri Apr 1 03:44:22 2011 From: haniti.grk at gmail.com (haniti grk) Date: Thu, 31 Mar 2011 20:44:22 -0500 Subject: [IronPython] [Code Review] Custom PAL fixes In-Reply-To: <6C7ABA8B4E309440B857D74348836F2E1502BF17@TK5EX14MBXC133.redmond.corp.microsoft.com> References: <6C7ABA8B4E309440B857D74348836F2E1502BF17@TK5EX14MBXC133.redmond.corp.microsoft.com> Message-ID: Please continue using this mailing list. Knowing the innards of IronPython does not hurt at all. Besides the traffic here is not too much. On Mar 31, 2011 8:16 PM, "Dino Viehland" wrote: > > LGTM. > > > > From: users-bounces at lists.ironpython.com [mailto: users-bounces at lists.ironpython.com] On Behalf Of Jimmy Schementi > Sent: Thursday, March 31, 2011 6:06 PM > To: Discussion of IronPython > Subject: [IronPython] [Code Review] Custom PAL fixes > > > > Just checked in some small fixes to make the Importer use a custom Platform Adaptation Layer. I also started to tweak clr.CompileModules a bit, but backed those changes out, so just ignore those. > > > > Take a look at the recent commits to https://github.com/jschementi/iron. If there are no objections, I'll push them to main. > > > > By the way, is it about time to split this list into a development and users list, or you all don't mind seeing these type of mails? > > > ~Jimmy > > > _______________________________________________ > 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 Fri Apr 1 04:04:00 2011 From: bruce.bromberek at gmail.com (Bruce Bromberek) Date: Thu, 31 Mar 2011 21:04:00 -0500 Subject: [IronPython] [Code Review] Custom PAL fixes In-Reply-To: References: Message-ID: As a non developer user I like all of the detailed discussions. It helps me understand what is going on behind the scenes. And gives me better C# search terms. On 3/31/11, Jimmy Schementi wrote: > Just checked in some small fixes to make the Importer use a custom Platform > Adaptation Layer. I also started to tweak clr.CompileModules a bit, but > backed those changes out, so just ignore those. > > Take a look at the recent commits to https://github.com/jschementi/iron. If > there are no objections, I'll push them to main. > > By the way, is it about time to split this list into a development and users > list, or you all don't mind seeing these type of mails? > > ~Jimmy > -- Sent from my mobile device From davew252 at tx.rr.com Fri Apr 1 06:58:57 2011 From: davew252 at tx.rr.com (Dave Wald) Date: Thu, 31 Mar 2011 23:58:57 -0500 Subject: [IronPython] [Code Review] Custom PAL fixes In-Reply-To: References: Message-ID: <4D955B91.2020109@tx.rr.com> I don't mind a bit. I like having a sense of what's going on. On 3/31/2011 8:05 PM, Jimmy Schementi wrote: > Just checked in some small fixes to make the Importer use a custom > Platform Adaptation Layer. I also started to tweak clr.CompileModules > a bit, but backed those changes out, so just ignore those. > > Take a look at the recent commits to > https://github.com/jschementi/iron. If there are no objections, I'll > push them to main. > > By the way, is it about time to split this list into a development and > users list, or you all don't mind seeing these type of mails? > > ~Jimmy > > > _______________________________________________ > 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 m.schaber at 3s-software.com Fri Apr 1 08:40:18 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Fri, 1 Apr 2011 08:40:18 +0200 Subject: [IronPython] Creating Symbolic Links via IronPython In-Reply-To: <4D94D956.4010905@duber.cz> References: <7737799D90E55E4BB9C9F7E40D161E1108D491B1E4@VA3DIAXVS461.RED001.local> <6C7ABA8B4E309440B857D74348836F2E15029BC5@TK5EX14MBXC133.redmond.corp.microsoft.com> <4D94D956.4010905@duber.cz> Message-ID: Hi, Either you create a c# wrapper dll that exposes this function, and reference that DLL from Ironpython. Or you use the clrtype class (which can be found at http://ironpython.codeplex.com/wikipage?title=Samples) - this allows you to assign c# Attributes to python methods, so you can define the DLLImport method.) Best regards Markus Schaber ___________________________ We software Automation. 3S-Smart Software Solutions GmbH Markus Schaber | Developer Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax +49-831-54031-50 Email: m.schaber at 3s-software.com | Web: http://www.3s-software.com CoDeSys internet forum: http://forum.3s-software.com Download CoDeSys sample projects: http://www.3s-software.com/index.shtml?sample_projects Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 > -----Urspr?ngliche Nachricht----- > Von: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] Im Auftrag von Luk?? Dubeda > Gesendet: Donnerstag, 31. M?rz 2011 21:43 > An: Discussion of IronPython > Betreff: [IronPython] Creating Symbolic Links via IronPython > > Hi there everyone, > > I've been trying to find a solution for creating Symbolic Links via > IronPython scripting, but it seems there is not a direct way of doing this > via .NET and since I don't know C#, I have hard times "translating" C# > snippets I've found on the net to IronPython. For example: > > [Interop.DllImport("kernel32.dll", EntryPoint="CreateSymbolicLinkW", > CharSet=Interop.CharSet.Unicode)] public static extern int > CreateSymbolicLink(string lpSymlinkFileName, string lpTargetFileName, int > dwFlags); > > So, I thought asking here would probably be the best place for the best > advice (i.e. what to avoid using etc...). > > Any advice on this topic would be much appretiated! > > Thanks a lot in advance, cheers, > > Luk?? Dub?da > Director > [T] +420 602 444 164 > > duber studio(tm) > [M] info at duber.cz > [W] http://www.duber.cz > > [A] R.A.Dvorsk?ho 601, Praha 10 > [A] 10900, Czech Republic, Europe > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From s.j.dower at gmail.com Fri Apr 1 08:58:41 2011 From: s.j.dower at gmail.com (Steve Dower) Date: Fri, 1 Apr 2011 17:58:41 +1100 Subject: [IronPython] Creating Symbolic Links via IronPython In-Reply-To: References: <7737799D90E55E4BB9C9F7E40D161E1108D491B1E4@VA3DIAXVS461.RED001.local> <6C7ABA8B4E309440B857D74348836F2E15029BC5@TK5EX14MBXC133.redmond.corp.microsoft.com> <4D94D956.4010905@duber.cz> Message-ID: You should be able to use ctypes for this. For example, the following works fine from CPython (I don't have IronPython handy on this computer): from ctypes import windll windll.kernel32.CreateSymbolicLinkA("c:\\py.exe", "c:\\python27\\python.exe", 0) The only difference may be calling CreateSymbolicLinkW instead of *A - the return value should be non-zero if it succeeds. Also, if you're running ipy64.exe you may need to override CreateSymbolicLinkW.argtypes with suitable values - otherwise it will assume and it sometimes assumes wrong. On Fri, Apr 1, 2011 at 17:40, Markus Schaber wrote: > Hi, > > Either you create a c# wrapper dll that exposes this function, and reference that DLL from Ironpython. > > Or you use the clrtype class (which can be found at http://ironpython.codeplex.com/wikipage?title=Samples) - this allows you to assign c# Attributes to python methods, so you can define the DLLImport method.) > > Best regards > > Markus Schaber > > ___________________________ > We software Automation. > > 3S-Smart Software Solutions GmbH > Markus Schaber | Developer > Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax +49-831-54031-50 > > Email: m.schaber at 3s-software.com | Web: http://www.3s-software.com > CoDeSys internet forum: http://forum.3s-software.com > Download CoDeSys sample projects: http://www.3s-software.com/index.shtml?sample_projects > > Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 > >> -----Urspr?ngliche Nachricht----- >> Von: users-bounces at lists.ironpython.com [mailto:users- >> bounces at lists.ironpython.com] Im Auftrag von Luk?? Dubeda >> Gesendet: Donnerstag, 31. M?rz 2011 21:43 >> An: Discussion of IronPython >> Betreff: [IronPython] Creating Symbolic Links via IronPython >> >> Hi there everyone, >> >> I've been trying to find a solution for creating Symbolic Links via >> IronPython scripting, but it seems there is not a direct way of doing this >> via .NET and since I don't know C#, I have hard times "translating" C# >> snippets I've found on the net to IronPython. For example: >> >> [Interop.DllImport("kernel32.dll", EntryPoint="CreateSymbolicLinkW", >> CharSet=Interop.CharSet.Unicode)] public static extern int >> CreateSymbolicLink(string lpSymlinkFileName, string lpTargetFileName, int >> dwFlags); >> >> So, I thought asking here would probably be the best place for the best >> advice (i.e. what to avoid using etc...). >> >> Any advice on this topic would be much appretiated! >> >> Thanks a lot in advance, cheers, >> >> Luk?? Dub?da >> Director >> [T] +420 602 444 164 >> >> duber studio(tm) >> [M] info at duber.cz >> [W] http://www.duber.cz >> >> [A] R.A.Dvorsk?ho 601, Praha 10 >> [A] 10900, Czech Republic, Europe >> _______________________________________________ >> 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 loocas at duber.cz Fri Apr 1 11:33:23 2011 From: loocas at duber.cz (=?UTF-8?B?THVrw6HFoSBEdWLEm2Rh?=) Date: Fri, 01 Apr 2011 11:33:23 +0200 Subject: [IronPython] Creating Symbolic Links via IronPython In-Reply-To: References: <7737799D90E55E4BB9C9F7E40D161E1108D491B1E4@VA3DIAXVS461.RED001.local> <6C7ABA8B4E309440B857D74348836F2E15029BC5@TK5EX14MBXC133.redmond.corp.microsoft.com> <4D94D956.4010905@duber.cz> Message-ID: <4D959BE3.90508@duber.cz> Interesting! Thank you, I'll try that. Also thanks Markus Schaber, another thing to look at. :) Cheers, Luk?? Dub?da Director [T] +420 602 444 164 duber studio(tm) [M] info at duber.cz [W] http://www.duber.cz [A] R.A.Dvorsk?ho 601, Praha 10 [A] 10900, Czech Republic, Europe On 1.4.2011 8:58, Steve Dower wrote: > You should be able to use ctypes for this. For example, the following > works fine from CPython (I don't have IronPython handy on this > computer): > > from ctypes import windll > windll.kernel32.CreateSymbolicLinkA("c:\\py.exe", "c:\\python27\\python.exe", 0) > > The only difference may be calling CreateSymbolicLinkW instead of *A - > the return value should be non-zero if it succeeds. Also, if you're > running ipy64.exe you may need to override > CreateSymbolicLinkW.argtypes with suitable values - otherwise it will > assume and it sometimes assumes wrong. > > On Fri, Apr 1, 2011 at 17:40, Markus Schaber wrote: >> Hi, >> >> Either you create a c# wrapper dll that exposes this function, and reference that DLL from Ironpython. >> >> Or you use the clrtype class (which can be found at http://ironpython.codeplex.com/wikipage?title=Samples) - this allows you to assign c# Attributes to python methods, so you can define the DLLImport method.) >> >> Best regards >> >> Markus Schaber >> >> ___________________________ >> We software Automation. >> >> 3S-Smart Software Solutions GmbH >> Markus Schaber | Developer >> Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax +49-831-54031-50 >> >> Email: m.schaber at 3s-software.com | Web: http://www.3s-software.com >> CoDeSys internet forum: http://forum.3s-software.com >> Download CoDeSys sample projects: http://www.3s-software.com/index.shtml?sample_projects >> >> Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 >> >>> -----Urspr?ngliche Nachricht----- >>> Von: users-bounces at lists.ironpython.com [mailto:users- >>> bounces at lists.ironpython.com] Im Auftrag von Luk?? Dubeda >>> Gesendet: Donnerstag, 31. M?rz 2011 21:43 >>> An: Discussion of IronPython >>> Betreff: [IronPython] Creating Symbolic Links via IronPython >>> >>> Hi there everyone, >>> >>> I've been trying to find a solution for creating Symbolic Links via >>> IronPython scripting, but it seems there is not a direct way of doing this >>> via .NET and since I don't know C#, I have hard times "translating" C# >>> snippets I've found on the net to IronPython. For example: >>> >>> [Interop.DllImport("kernel32.dll", EntryPoint="CreateSymbolicLinkW", >>> CharSet=Interop.CharSet.Unicode)] public static extern int >>> CreateSymbolicLink(string lpSymlinkFileName, string lpTargetFileName, int >>> dwFlags); >>> >>> So, I thought asking here would probably be the best place for the best >>> advice (i.e. what to avoid using etc...). >>> >>> Any advice on this topic would be much appretiated! >>> >>> Thanks a lot in advance, cheers, >>> >>> Luk?? Dub?da >>> Director >>> [T] +420 602 444 164 >>> >>> duber studio(tm) >>> [M] info at duber.cz >>> [W] http://www.duber.cz >>> >>> [A] R.A.Dvorsk?ho 601, Praha 10 >>> [A] 10900, Czech Republic, Europe >>> _______________________________________________ >>> 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 doug.blank at gmail.com Fri Apr 1 13:54:49 2011 From: doug.blank at gmail.com (Doug Blank) Date: Fri, 1 Apr 2011 07:54:49 -0400 Subject: [IronPython] [Code Review] Custom PAL fixes In-Reply-To: References: Message-ID: On Thu, Mar 31, 2011 at 9:05 PM, Jimmy Schementi wrote: > By the way, is it about time to split this list into a development and users > list, or you all don't mind seeing these type of mails? Many of the people subscribed want to get any insight into the DLR languages as they can. But I have noticed that there are some user-type questions that get no responses here. It is easy to join two mailing lists, and if splitting would allow user-questions to get more attention, then that would be a good thing. -Doug > ~Jimmy From m.schaber at 3s-software.com Fri Apr 1 15:54:06 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Fri, 1 Apr 2011 15:54:06 +0200 Subject: [IronPython] IronPython use case: CoDeSys Message-ID: Hi, For all those collecting information about usages of IronPython: The "Controller Development System" CoDeSys is the industry leading development tool (IDE and runtime system) for programming PLCs using the standardized IEC 61131-3 language. The current release V3.4 SP3 includes an IronPython 2.6.2 based scripting plugin that allows to automate and control established CoDeSys functionality like importing applications written in the PLCOpenXML standard, compiling and downloading applications to the device, or runtime monitoring of variables, both from within the IDE and from command line. The script writers can also utilize the power of the python standard library which is included, this allows for advanced task like sending monitored variable values via E-Mail. Best regards Markus Schaber ___________________________ We software Automation. 3S-Smart Software Solutions GmbH Markus Schaber | Developer Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax +49-831-54031-50 Email: m.schaber at 3s-software.com | Web: http://www.3s-software.com CoDeSys internet forum: http://forum.3s-software.com Download CoDeSys sample projects: http://www.3s-software.com/index.shtml?sample_projects Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.schaber at 3s-software.com Fri Apr 1 16:25:10 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Fri, 1 Apr 2011 16:25:10 +0200 Subject: [IronPython] Migration warnings to python 3 Message-ID: Hello, The current estimate for IronPython to implement python 3 was "not before fall". So applications hosting IronPython must think about paving a good migration path for their users. AFAIR, the cPython implementation can spit out a bunch of warnings for Code incompatible with cPython 3. Is this mechanism supported by hosted IronPython? Gr??e, Markus -------------- next part -------------- An HTML attachment was scrubbed... URL: From jmccampbell at enthought.com Fri Apr 1 16:28:57 2011 From: jmccampbell at enthought.com (Jason McCampbell) Date: Fri, 1 Apr 2011 09:28:57 -0500 Subject: [IronPython] numpy / IronClad? In-Reply-To: <31262168.post@talk.nabble.com> References: <6451C9079312284DA83CCE202D0E903B270C76B6@NL0230MBX09N1.DIR.slb.com> <31196654.post@talk.nabble.com> <31262168.post@talk.nabble.com> Message-ID: Hi Felix, That's a good question, but unfortunately I don't know the answer. I haven't used IronPython in the interactive mode under VS2010, just running from a command prompt. Jason On Mon, Mar 28, 2011 at 3:50 PM, Felice80 wrote: > > Hi Jason, > > thanks for getting back to me! As I pointed out in the resonse to my own > post, I finally managed to install it. So from the command prompt, > everything works out perfectly. > > However: How can I import numpy/scipy from within Visual Studio 2010 (e.g. > IronPython Interactive)? I don't know how to run the "-X:Frames" argument > there. > > thanks, > Felix > > > Jason McCampbell wrote: > > > > Hi Felix, > > > > Sorry, was traveling this week and got behind. We don't have > > documentation > > on it yet, though it's similar to 'enpkg' for Python. You are welcome to > > email me with specific questions. > > > > In general, the file is a self-installing Python file that creates the > > small > > ironpkg module. This just manages the 'egg' files (essentially ZIP > files) > > stored on our repository (others could be added) and will take care of > > download the eggs and extracting them. > > > > Regards, > > Jason > > > > On Mon, Mar 21, 2011 at 2:40 AM, Felice80 wrote: > > > >> > >> Jason, > >> > >> is there somewhere a more detailed user guide on how to perform step 3 > of > >> the installation (ironpkg)? I'm kind of lost. > >> > >> thank very much!! > >> Felix > >> > >> > >> > >> Jason McCampbell wrote: > >> > > >> > Hi Chad, > >> > > >> > Sorry for the delayed response, we were busy getting the beta release > >> of > >> > NumPy and SciPy together. Microsoft announced the availability of > >> NumPy > >> > and > >> > SciPy for IronPython / .NET at PyCon the end of last week. > >> > > >> > You can find the install instructions here for the pre-built binaries: > >> > http://www.enthought.com/repo/.iron/ > >> > > >> > Alternately you can grab the > >> source > >> > code from the following repositories: > >> > https://github.com/numpy/numpy-refactor > >> > https://github.com/jasonmccampbell/scipy-refactor > >> > > >> > One note we don't have documented right now is that SciPy requires the > >> > Python stack frames access, which IronPython doesn't enable by > default. > >> > To > >> > run SciPy you need to use the "-X:Frames" argument: > >> > ipy.exe -X:Frames -c "import scipy" > >> > > >> > Regards, > >> > Jason > >> > > >> > > >> > On Tue, Mar 1, 2011 at 4:32 PM, Chad Brockman wrote: > >> > > >> >> Anyone know if the effort to port numpy to IronPython is still > alive? > >> >> Enthought / MS announced it last year? > >> >> http://www.enthought.com/media/SciPyNumPyDotNet.pdf > >> >> > >> >> > >> >> > >> >> Anyone know if IronClad is still being developed? > >> >> > >> >> > >> >> > >> >> Thanks, Chad > >> >> > >> >> _______________________________________________ > >> >> Users mailing list > >> >> Users at lists.ironpython.com > >> >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > >> >> > >> >> > >> > > >> > > >> > -- > >> > *Jason McCampbell* > >> > Enthought, Inc. > >> > 512.850.6069 > >> > jmccampbell at enthought.com > >> > > >> > _______________________________________________ > >> > Users mailing list > >> > Users at lists.ironpython.com > >> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > >> > > >> > > >> > >> -- > >> View this message in context: > >> http://old.nabble.com/numpy---IronClad--tp31044998p31196654.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 > >> > > > > > > > > -- > > *Jason McCampbell* > > Enthought, Inc. > > 512.850.6069 > > jmccampbell at enthought.com > > > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > -- > View this message in context: > http://old.nabble.com/numpy---IronClad--tp31044998p31262168.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 > -- *Jason McCampbell* Enthought, Inc. 512.850.6069 jmccampbell at enthought.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdhardy at gmail.com Fri Apr 1 16:38:11 2011 From: jdhardy at gmail.com (Jeff Hardy) Date: Fri, 1 Apr 2011 08:38:11 -0600 Subject: [IronPython] [Code Review] Custom PAL fixes In-Reply-To: References: Message-ID: On Thu, Mar 31, 2011 at 7:05 PM, Jimmy Schementi wrote: > Just checked in some small fixes to make the Importer use a custom Platform > Adaptation Layer. I also started to tweak clr.CompileModules a bit, but > backed those changes out, so just ignore those. > Take a look at the recent commits to https://github.com/jschementi/iron. If > there are no objections, I'll push them to main. If Dino's happy, that's good enough for me. Should these changes be in the 2.7 branch as well, or just master (3.0)? It doesn't look like there are any API changes, so applying it to 2.7 should be fine. - Jeff From m.schaber at 3s-software.com Fri Apr 1 16:58:01 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Fri, 1 Apr 2011 16:58:01 +0200 Subject: [IronPython] [Code Review] Custom PAL fixes In-Reply-To: References: Message-ID: Hi, Jimmy, > Von: Jeff Hardy > On Thu, Mar 31, 2011 at 7:05 PM, Jimmy Schementi > wrote: > > Just checked in some small fixes to make the Importer use a custom > > Platform Adaptation Layer. I also started to tweak clr.CompileModules > > a bit, but backed those changes out, so just ignore those. > > Take a look at the recent commits to > > https://github.com/jschementi/iron. If there are no objections, I'll > push them to main. > > If Dino's happy, that's good enough for me. > > Should these changes be in the 2.7 branch as well, or just master (3.0)? > It doesn't look like there are any API changes, so applying it to 2.7 > should be fine. I'd like to see those changes and fixes in version 2.7, for all those people who cannot yet migrate to .NET 4.0. Thanks, Markus From dinov at microsoft.com Fri Apr 1 18:35:44 2011 From: dinov at microsoft.com (Dino Viehland) Date: Fri, 1 Apr 2011 16:35:44 +0000 Subject: [IronPython] Migration warnings to python 3 In-Reply-To: References: Message-ID: <6C7ABA8B4E309440B857D74348836F2E1502CE68@TK5EX14MBXC133.redmond.corp.microsoft.com> We do support the -3 option which turns those warnings on but I don't think we have as many warnings as CPython did. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Markus Schaber Sent: Friday, April 01, 2011 7:25 AM To: Discussion of IronPython Subject: [IronPython] Migration warnings to python 3 Hello, The current estimate for IronPython to implement python 3 was "not before fall". So applications hosting IronPython must think about paving a good migration path for their users. AFAIR, the cPython implementation can spit out a bunch of warnings for Code incompatible with cPython 3. Is this mechanism supported by hosted IronPython? Gr??e, Markus -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Sat Apr 2 03:32:08 2011 From: vernondcole at gmail.com (Vernon Cole) Date: Fri, 1 Apr 2011 19:32:08 -0600 Subject: [IronPython] Creating Symbolic Links via IronPython In-Reply-To: <4D959BE3.90508@duber.cz> References: <7737799D90E55E4BB9C9F7E40D161E1108D491B1E4@VA3DIAXVS461.RED001.local> <6C7ABA8B4E309440B857D74348836F2E15029BC5@TK5EX14MBXC133.redmond.corp.microsoft.com> <4D94D956.4010905@duber.cz> <4D959BE3.90508@duber.cz> Message-ID: Just to make sure we are all on the same page here, the original post said: >>>> >>>> I've been trying to find a solution for creating Symbolic Links via >>>> IronPython scripting, [...snip...] >>>> [Interop.DllImport("kernel32.dll", EntryPoint="CreateSymbolicLinkW", >>>> CharSet=Interop.CharSet.Unicode)] public static extern int >>>> CreateSymbolicLink(string lpSymlinkFileName, string lpTargetFileName, >>>> int >>>> dwFlags); >>>> Are we talking about making a Windows version of the standard library routine: >os.symlink(source, link_name) >Create a symbolic link pointing to source named link_name. > >Availability: Unix. ? And, if so, should we (can we) put in in the standard library? -- Vernon From brian.curtin at gmail.com Sat Apr 2 03:45:26 2011 From: brian.curtin at gmail.com (Brian Curtin) Date: Fri, 1 Apr 2011 20:45:26 -0500 Subject: [IronPython] Creating Symbolic Links via IronPython In-Reply-To: References: <7737799D90E55E4BB9C9F7E40D161E1108D491B1E4@VA3DIAXVS461.RED001.local> <6C7ABA8B4E309440B857D74348836F2E15029BC5@TK5EX14MBXC133.redmond.corp.microsoft.com> <4D94D956.4010905@duber.cz> <4D959BE3.90508@duber.cz> Message-ID: On Fri, Apr 1, 2011 at 20:32, Vernon Cole wrote: > Just to make sure we are all on the same page here, the original post said: > >>>> > >>>> I've been trying to find a solution for creating Symbolic Links via > >>>> IronPython scripting, [...snip...] > >>>> [Interop.DllImport("kernel32.dll", EntryPoint="CreateSymbolicLinkW", > >>>> CharSet=Interop.CharSet.Unicode)] public static extern int > >>>> CreateSymbolicLink(string lpSymlinkFileName, string lpTargetFileName, > >>>> int > >>>> dwFlags); > >>>> > Are we talking about making a Windows version of the standard library > routine: > >os.symlink(source, link_name) > >Create a symbolic link pointing to source named link_name. > > > >Availability: Unix. > ? > > And, if so, should we (can we) put in in the standard library? The standard library includes Windows support for os.symlink as of 3.2. -------------- next part -------------- An HTML attachment was scrubbed... URL: From phatfish at gmail.com Sat Apr 2 19:20:22 2011 From: phatfish at gmail.com (Chris) Date: Sat, 2 Apr 2011 18:20:22 +0100 Subject: [IronPython] No module named wpf - VS2010 Message-ID: Hi all, I get this Exception when trying to run a "Hello World" application from the base WPF Template in VS2010 with IronPython Tools: Exception: IronPython.Runtime.Exceptions.ImportException: No module named wpf I guess the search paths for modules need modifying, but im not sure how to do that. Seems a bit weird as i would expect basic template code to run without tweaking, so maybe i messed something up with the install. Any suggestions welcome. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From davew252 at tx.rr.com Sat Apr 2 20:58:29 2011 From: davew252 at tx.rr.com (Dave Wald) Date: Sat, 02 Apr 2011 13:58:29 -0500 Subject: [IronPython] No module named wpf - VS2010 In-Reply-To: References: Message-ID: <4D9771D5.1010302@tx.rr.com> Hi Chris, See what happens if you just set the Interpreter Path explicitly in the project properties page. That's all I've been doing. In Solution Explorer, right click the project file and select "Properties" to open the properties page. Set the "Interpreter Path" field to the actual path of your ipy.exe or ipyw.exe. E.g., mine is set to "c:/IronPython 2.7/ipy.exe", without quotes. (I don't like using "Program Files..." folders - ACL issues.) Also, it sounds you are still using the "old" tools. (Not that it matters in this case, but if you have haven't switched to the "new" tools yet, I highly recommend it.) http://pytools.codeplex.com/ Caveat: You WILL have to uninstall IronPython 2.7 and re-install it WITHOUT the bundled tools, and THEN install the new tools. They cannot be installed sxs. But I think the effort is well worth it. And there is a really good walkthrough for it. (In the new tools, you also have Tools>Options>Python Tools with several settings tabs for more options.) I just finished converting my IPyScratchPad app (gen-purpose utility UI) to WPF from WinForms and switched to the new tools mid-stream, just for extra fun. But I've had no trouble with it. BTW, did I mention the new tools ARE GREAT!. Thanks, y'all. Dave On 4/2/2011 12:20 PM, Chris wrote: > Hi all, > > I get this Exception when trying to run a "Hello World" application > from the base WPF Template in VS2010 with IronPython Tools: > > Exception: IronPython.Runtime.Exceptions.ImportException: No module > named wpf > > I guess the search paths for modules need modifying, but im not sure > how to do that. > > Seems a bit weird as i would expect basic template code to run without > tweaking, so maybe i messed something up with the install. > > Any suggestions welcome. > > Thanks > > > _______________________________________________ > 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 phatfish at gmail.com Sat Apr 2 23:51:23 2011 From: phatfish at gmail.com (Chris) Date: Sat, 2 Apr 2011 22:51:23 +0100 Subject: [IronPython] No module named wpf - VS2010 In-Reply-To: <4D9771D5.1010302@tx.rr.com> References: <4D9771D5.1010302@tx.rr.com> Message-ID: Hey thanks Dave, I installed the new beta tools and this solved the import problem. The template code now runs fine from the interactive interpreter. I will check out the walk throughs too. On 2 April 2011 19:58, Dave Wald wrote: > Hi Chris, > See what happens if you just set the Interpreter Path explicitly in the > project properties page. > That's all I've been doing. > In Solution Explorer, right click the project file and select "Properties" > to open the properties page. > Set the "Interpreter Path" field to the actual path of your ipy.exe or > ipyw.exe. > E.g., mine is set to "c:/IronPython 2.7/ipy.exe", without quotes. (I > don't like using "Program Files..." folders - ACL issues.) > > Also, it sounds you are still using the "old" tools. (Not that it matters > in this case, but if you have haven't switched to the "new" tools yet, I > highly recommend it.) > http://pytools.codeplex.com/ > Caveat: You WILL have to uninstall IronPython 2.7 and re-install it WITHOUT > the bundled tools, and THEN install the new tools. They cannot be installed > sxs. But I think the effort is well worth it. > And there is a really good walkthrough for it. > (In the new tools, you also have Tools>Options>Python Tools with several > settings tabs for more options.) > > I just finished converting my IPyScratchPad app (gen-purpose utility UI) to > WPF from WinForms and switched to the new tools mid-stream, just for extra > fun. > But I've had no trouble with it. > > BTW, did I mention the new tools ARE GREAT!. Thanks, y'all. > > Dave > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chadbr at slb.com Sun Apr 3 18:27:12 2011 From: chadbr at slb.com (Chad Brockman) Date: Sun, 3 Apr 2011 16:27:12 +0000 Subject: [IronPython] Debug CompiledCode / ScriptScope in the "new tools" Message-ID: <6451C9079312284DA83CCE202D0E903B343EBFA3@NL0230MBX09N1.DIR.slb.com> I may be missing something obvious... I have a C# 4.0 (wpf & Silverlight) app that has lots of scripts stored in a database and executed via CompiledCode / ScriptScope objects. Is there a way to step through these python scripts with the debugger in the new VS2010 tools (or any debugging tools for that matter)? Thanks - Chad Chad Brockman Production Solutions Architect chadbr at slb.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.schaber at 3s-software.com Mon Apr 4 08:16:57 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Mon, 4 Apr 2011 08:16:57 +0200 Subject: [IronPython] Migration warnings to python 3 Message-ID: Hi, Dino, I guess this is okay, some things like string / Unicode semantics are actually already like in Python 3. I'll skim the hosting API to find out how I can get those warnings in hosted environment. Regards, Markus Von: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] Im Auftrag von Dino Viehland > We do support the -3 option which turns those warnings on but I don't think we have as many warnings as CPython did. ? >> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Markus Schaber >> Hello, >> The current estimate for IronPython to implement python 3 was "not before fall". So applications hosting IronPython must think about paving a good migration path for their users. >> AFAIR, the cPython implementation can spit out a bunch of warnings for Code incompatible with cPython 3. >> Is this mechanism supported by hosted IronPython? ? Gr??e, Markus ? From m.schaber at 3s-software.com Mon Apr 4 10:29:59 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Mon, 4 Apr 2011 10:29:59 +0200 Subject: [IronPython] Migration warnings to python 3 Message-ID: Hi, It seems that the default behaviour of printing them to sys.stderr may fit our needs. Regards, Markus > -----Urspr?ngliche Nachricht----- > Von: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] Im Auftrag von Markus Schaber > Gesendet: Montag, 4. April 2011 08:17 > An: Discussion of IronPython > Betreff: Re: [IronPython] Migration warnings to python 3 > > Hi, Dino, > > I guess this is okay, some things like string / Unicode semantics are > actually already like in Python 3. > > I'll skim the hosting API to find out how I can get those warnings in > hosted environment. > > Regards, > Markus > > Von: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] Im Auftrag von Dino Viehland > > > We do support the -3 option which turns those warnings on but I don't > think we have as many warnings as CPython did. > > >> From: users-bounces at lists.ironpython.com > >> [mailto:users-bounces at lists.ironpython.com] On Behalf Of Markus > >> Schaber Hello, The current estimate for IronPython to implement python > 3 was "not before fall". So applications hosting IronPython must think > about paving a good migration path for their users. > >> AFAIR, the cPython implementation can spit out a bunch of warnings for > Code incompatible with cPython 3. > >> Is this mechanism supported by hosted IronPython? > > Gr??e, > Markus > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From doug.blank at gmail.com Mon Apr 4 17:24:38 2011 From: doug.blank at gmail.com (Doug Blank) Date: Mon, 4 Apr 2011 11:24:38 -0400 Subject: [IronPython] Writing cross-language libraries that appear native Message-ID: I'm working on writing C# libraries which can be imported by a variety of .NET languages, DLR and otherwise, which appear native to the language importing them. For example, writing a C# function that can be used naturally in IronPython as if it were written in Python, IronRuby as if it were written in Ruby, and F# as if it were written in F#, etc. I've encountered some gotchas that I thought I'd share, and looking for any other points of advice in writing cross-language libraries. 1. IronRuby strings aren't really strings, so you need to pass them in as an object, and call .ToString(). public static string expects_string(object val) { return val.ToString(); } 2. F# 2.0 doesn't seem to automatically convert a type to the associated nullable type, so avoid nullable types as parameters. // AVOID: public static double? expects_nullable(double? var1=null) { return var1; } // BETTER: public static double? expects_nullable() { return null; } public static double expects_nullable(double var1) { return var1; } 3. IronPython and IronRuby lists and dictionaries implement IList and IDictionary, so no problem with those. public static IDictionary make_dict(object val) { if (val as IDictionary != null) { return ((IDictionary)val); } else throw new System.ArgumentException("object is not a dictionary"); } public static IList make_list(object val) { if (val as IList != null) { return ((IList)val); } else throw new System.ArgumentException("object is not a list"); } Any other suggestions? -Doug From Tomas.Matousek at microsoft.com Mon Apr 4 17:52:53 2011 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Mon, 4 Apr 2011 15:52:53 +0000 Subject: [IronPython] Writing cross-language libraries that appear native In-Reply-To: References: Message-ID: <9597F4A19BFDB342B6E90963100C3308053686@SN2PRD0302MB113.namprd03.prod.outlook.com> Re: 1. MutableString is convertible to String, so why would you need an object parameter? Tomas -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Doug Blank Sent: Monday, April 04, 2011 8:25 AM To: Discussion of IronPython Subject: [IronPython] Writing cross-language libraries that appear native I'm working on writing C# libraries which can be imported by a variety of .NET languages, DLR and otherwise, which appear native to the language importing them. For example, writing a C# function that can be used naturally in IronPython as if it were written in Python, IronRuby as if it were written in Ruby, and F# as if it were written in F#, etc. I've encountered some gotchas that I thought I'd share, and looking for any other points of advice in writing cross-language libraries. 1. IronRuby strings aren't really strings, so you need to pass them in as an object, and call .ToString(). public static string expects_string(object val) { return val.ToString(); } 2. F# 2.0 doesn't seem to automatically convert a type to the associated nullable type, so avoid nullable types as parameters. // AVOID: public static double? expects_nullable(double? var1=null) { return var1; } // BETTER: public static double? expects_nullable() { return null; } public static double expects_nullable(double var1) { return var1; } 3. IronPython and IronRuby lists and dictionaries implement IList and IDictionary, so no problem with those. public static IDictionary make_dict(object val) { if (val as IDictionary != null) { return ((IDictionary)val); } else throw new System.ArgumentException("object is not a dictionary"); } public static IList make_list(object val) { if (val as IList != null) { return ((IList)val); } else throw new System.ArgumentException("object is not a list"); } Any other suggestions? -Doug _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From doug.blank at gmail.com Mon Apr 4 18:21:26 2011 From: doug.blank at gmail.com (Doug Blank) Date: Mon, 4 Apr 2011 12:21:26 -0400 Subject: [IronPython] Writing cross-language libraries that appear native In-Reply-To: <9597F4A19BFDB342B6E90963100C3308053686@SN2PRD0302MB113.namprd03.prod.outlook.com> References: <9597F4A19BFDB342B6E90963100C3308053686@SN2PRD0302MB113.namprd03.prod.outlook.com> Message-ID: On Mon, Apr 4, 2011 at 11:52 AM, Tomas Matousek wrote: > Re: 1. > > MutableString is convertible to String, so why would you need an object parameter? Do you mean that one could write: ? ?public static string expects_string(MutableString val) { ? ? ? ?return (val as String); ? ?} I wrote: ? ?public static string expects_string(object val) { ? ? ? ?return val.ToString(); ? ?} because that would work for all languages, and you could pass in an IronPython or F# string it it would work just as well. Or did you mean something else? -Doug > Tomas > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Doug Blank > Sent: Monday, April 04, 2011 8:25 AM > To: Discussion of IronPython > Subject: [IronPython] Writing cross-language libraries that appear native > > I'm working on writing C# libraries which can be imported by a variety of .NET languages, DLR and otherwise, which appear native to the language importing them. > > For example, writing a C# function that can be used naturally in IronPython as if it were written in Python, IronRuby as if it were written in Ruby, and F# as if it were written in F#, etc. > > I've encountered some gotchas that I thought I'd share, and looking for any other points of advice in writing cross-language libraries. > > 1. IronRuby strings aren't really strings, so you need to pass them in as an object, and call .ToString(). > > ? ?public static string expects_string(object val) { > ? ? ? ?return val.ToString(); > ? ?} > > 2. F# 2.0 doesn't seem to automatically convert a type to the associated nullable type, so avoid nullable types as parameters. > > ? ?// AVOID: > ? ?public static double? expects_nullable(double? var1=null) { > ? ? ? ?return var1; > ? ?} > > ? ?// BETTER: > ? ?public static double? expects_nullable() { > ? ? ? ?return null; > ? ?} > ? ?public static double expects_nullable(double var1) { > ? ? ? ?return var1; > ? ?} > > 3. IronPython and IronRuby lists and dictionaries implement IList and IDictionary, so no problem with those. > > ? ?public static IDictionary make_dict(object val) { > ? ? ? ?if (val as IDictionary != null) { > ? ? ? ? ? ?return ((IDictionary)val); > ? ? ? ?} else > ? ? ? ? ? ?throw new System.ArgumentException("object is not a dictionary"); > ? ?} > > ? ?public static IList make_list(object val) { > ? ? ? ?if (val as IList != null) { > ? ? ? ? ? ?return ((IList)val); > ? ? ? ?} else > ? ? ? ? ? ?throw new System.ArgumentException("object is not a list"); > ? ?} > > Any other suggestions? > > -Doug > _______________________________________________ > 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 jschementi at gmail.com Mon Apr 4 18:54:30 2011 From: jschementi at gmail.com (Jimmy Schementi) Date: Mon, 4 Apr 2011 12:54:30 -0400 Subject: [IronPython] Writing cross-language libraries that appear native In-Reply-To: References: <9597F4A19BFDB342B6E90963100C3308053686@SN2PRD0302MB113.namprd03.prod.outlook.com> Message-ID: Tomas means you can write this: > public static string ExpectsString(string val) { > return val; > } And call it from Ruby with a Ruby string: expects_string "Foo" ~Jimmy On Apr 4, 2011, at 12:21 PM, Doug Blank wrote: > On Mon, Apr 4, 2011 at 11:52 AM, Tomas Matousek > wrote: >> Re: 1. >> >> MutableString is convertible to String, so why would you need an object parameter? > > Do you mean that one could write: > > public static string expects_string(MutableString val) { > return (val as String); > } > > I wrote: > > public static string expects_string(object val) { > return val.ToString(); > } > > because that would work for all languages, and you could pass in an > IronPython or F# string it it would work just as well. Or did you mean > something else? > > -Doug > >> Tomas >> >> -----Original Message----- >> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Doug Blank >> Sent: Monday, April 04, 2011 8:25 AM >> To: Discussion of IronPython >> Subject: [IronPython] Writing cross-language libraries that appear native >> >> I'm working on writing C# libraries which can be imported by a variety of .NET languages, DLR and otherwise, which appear native to the language importing them. >> >> For example, writing a C# function that can be used naturally in IronPython as if it were written in Python, IronRuby as if it were written in Ruby, and F# as if it were written in F#, etc. >> >> I've encountered some gotchas that I thought I'd share, and looking for any other points of advice in writing cross-language libraries. >> >> 1. IronRuby strings aren't really strings, so you need to pass them in as an object, and call .ToString(). >> >> public static string expects_string(object val) { >> return val.ToString(); >> } >> >> 2. F# 2.0 doesn't seem to automatically convert a type to the associated nullable type, so avoid nullable types as parameters. >> >> // AVOID: >> public static double? expects_nullable(double? var1=null) { >> return var1; >> } >> >> // BETTER: >> public static double? expects_nullable() { >> return null; >> } >> public static double expects_nullable(double var1) { >> return var1; >> } >> >> 3. IronPython and IronRuby lists and dictionaries implement IList and IDictionary, so no problem with those. >> >> public static IDictionary make_dict(object val) { >> if (val as IDictionary != null) { >> return ((IDictionary)val); >> } else >> throw new System.ArgumentException("object is not a dictionary"); >> } >> >> public static IList make_list(object val) { >> if (val as IList != null) { >> return ((IList)val); >> } else >> throw new System.ArgumentException("object is not a list"); >> } >> >> Any other suggestions? >> >> -Doug >> _______________________________________________ >> 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 doug.blank at gmail.com Mon Apr 4 19:13:45 2011 From: doug.blank at gmail.com (Doug Blank) Date: Mon, 4 Apr 2011 13:13:45 -0400 Subject: [IronPython] Writing cross-language libraries that appear native In-Reply-To: References: <9597F4A19BFDB342B6E90963100C3308053686@SN2PRD0302MB113.namprd03.prod.outlook.com> Message-ID: On Mon, Apr 4, 2011 at 12:54 PM, Jimmy Schementi wrote: > Tomas means you can write this: > >> public static string ExpectsString(string val) { >> ? ? ? ?return val; >> } > > > And call it from Ruby with a Ruby string: > > expects_string "Foo" Yes, indeed, that works fine. Thanks! So, the DLR languages all behave properly with all types, even with nullable and default values ---if you name your classes correctly. Another point I discovered was that I had to name my outer class with upper case letters, or else IronRuby couldn't access it. Any other gotchas or time savers for non-DLR languages? (I wish the DLR group could help the F# group... they don't even have an eval, except for running the entire fsi.exe in a subprocess... wouldn't that be nice if they used a DLR environment...) -Doug > ~Jimmy > > > On Apr 4, 2011, at 12:21 PM, Doug Blank wrote: > >> On Mon, Apr 4, 2011 at 11:52 AM, Tomas Matousek >> wrote: >>> Re: 1. >>> >>> MutableString is convertible to String, so why would you need an object parameter? >> >> Do you mean that one could write: >> >> ? ?public static string expects_string(MutableString val) { >> ? ? ? ?return (val as String); >> ? ?} >> >> I wrote: >> >> ? ?public static string expects_string(object val) { >> ? ? ? ?return val.ToString(); >> ? ?} >> >> because that would work for all languages, and you could pass in an >> IronPython or F# string it it would work just as well. Or did you mean >> something else? >> >> -Doug >> >>> Tomas >>> >>> -----Original Message----- >>> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Doug Blank >>> Sent: Monday, April 04, 2011 8:25 AM >>> To: Discussion of IronPython >>> Subject: [IronPython] Writing cross-language libraries that appear native >>> >>> I'm working on writing C# libraries which can be imported by a variety of .NET languages, DLR and otherwise, which appear native to the language importing them. >>> >>> For example, writing a C# function that can be used naturally in IronPython as if it were written in Python, IronRuby as if it were written in Ruby, and F# as if it were written in F#, etc. >>> >>> I've encountered some gotchas that I thought I'd share, and looking for any other points of advice in writing cross-language libraries. >>> >>> 1. IronRuby strings aren't really strings, so you need to pass them in as an object, and call .ToString(). >>> >>> ? ?public static string expects_string(object val) { >>> ? ? ? ?return val.ToString(); >>> ? ?} >>> >>> 2. F# 2.0 doesn't seem to automatically convert a type to the associated nullable type, so avoid nullable types as parameters. >>> >>> ? ?// AVOID: >>> ? ?public static double? expects_nullable(double? var1=null) { >>> ? ? ? ?return var1; >>> ? ?} >>> >>> ? ?// BETTER: >>> ? ?public static double? expects_nullable() { >>> ? ? ? ?return null; >>> ? ?} >>> ? ?public static double expects_nullable(double var1) { >>> ? ? ? ?return var1; >>> ? ?} >>> >>> 3. IronPython and IronRuby lists and dictionaries implement IList and IDictionary, so no problem with those. >>> >>> ? ?public static IDictionary make_dict(object val) { >>> ? ? ? ?if (val as IDictionary != null) { >>> ? ? ? ? ? ?return ((IDictionary)val); >>> ? ? ? ?} else >>> ? ? ? ? ? ?throw new System.ArgumentException("object is not a dictionary"); >>> ? ?} >>> >>> ? ?public static IList make_list(object val) { >>> ? ? ? ?if (val as IList != null) { >>> ? ? ? ? ? ?return ((IList)val); >>> ? ? ? ?} else >>> ? ? ? ? ? ?throw new System.ArgumentException("object is not a list"); >>> ? ?} >>> >>> Any other suggestions? >>> >>> -Doug >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >>> >>> >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From jschementi at gmail.com Mon Apr 4 19:15:40 2011 From: jschementi at gmail.com (Jimmy Schementi) Date: Mon, 4 Apr 2011 13:15:40 -0400 Subject: [IronPython] Writing cross-language libraries that appear native In-Reply-To: References: Message-ID: <514AEF62-B31B-42FC-828E-FA70F999E771@gmail.com> For #3, you can avoid using an object argument and casting by typing the argument as the the non-generic IList and IDictionary. I think you're correct with #2 as F# doesn't support Nullable syntactically, but it doesn't mean F# can't consume code using Nullable. ~Jimmy On Apr 4, 2011, at 11:24 AM, Doug Blank wrote: > I'm working on writing C# libraries which can be imported by a variety > of .NET languages, DLR and otherwise, which appear native to the > language importing them. > > For example, writing a C# function that can be used naturally in > IronPython as if it were written in Python, IronRuby as if it were > written in Ruby, and F# as if it were written in F#, etc. > > I've encountered some gotchas that I thought I'd share, and looking > for any other points of advice in writing cross-language libraries. > > 1. IronRuby strings aren't really strings, so you need to pass them in > as an object, and call .ToString(). > > public static string expects_string(object val) { > return val.ToString(); > } > > 2. F# 2.0 doesn't seem to automatically convert a type to the > associated nullable type, so avoid nullable types as parameters. > > // AVOID: > public static double? expects_nullable(double? var1=null) { > return var1; > } > > // BETTER: > public static double? expects_nullable() { > return null; > } > public static double expects_nullable(double var1) { > return var1; > } > > 3. IronPython and IronRuby lists and dictionaries implement IList and > IDictionary, so no problem with those. > > public static IDictionary make_dict(object val) { > if (val as IDictionary != null) { > return ((IDictionary)val); > } else > throw new System.ArgumentException("object is not a dictionary"); > } > > public static IList make_list(object val) { > if (val as IList != null) { > return ((IList)val); > } else > throw new System.ArgumentException("object is not a list"); > } > > Any other suggestions? > > -Doug > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From m.schaber at 3s-software.com Tue Apr 5 09:05:14 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Tue, 5 Apr 2011 09:05:14 +0200 Subject: [IronPython] Writing cross-language libraries that appear native In-Reply-To: References: Message-ID: Hi, Doug, I it won't be possible to make it "feel naturally" with every language, simply because the languages have very different naming conventions (C# mandates CamelCase, Python prefers words_with_underscores, ...) and programming paradigms. But on the other hand, you should keep in mind that .NET was designed as a multi-paradigm environment, and that all those Languages were implemented with this in mind. Most of the dynamic languages have very clever parameter resolution and automatic casting mechanisms implemented, as they offer easy access to the whole .NET standard library - this will automatically apply to your interface, too. E. G. any python list and tuple can be passed to a function taking a IEnumerable, python will create an auto-casting enumerator, and will throw when the sequence contains elements not compatible to Foo. Nevertheless, my concrete points of advice are: - I think the most important thing is that you make a simple, clearly structured API. - Be generous but exact in what you accept. For example if you need a sequence of Foo as parameter, accept IEnumerable. * No need to use IEnumerable and cast yourself - more Code to type, the dynamic language binding will auto-cast for you, and the statically typed languages like C# and F# profit from the stricter declaration. * Accepting IList or ICollection is too strict for the main method, but if your algorithm can profit from indexing or knowing the size, you may provide them as optimized overloads. - Adhere to the coding standards / naming conventions in the language you use to implement. - Take care that all your functionality is exposed in CLS conformant ways. (IMHO, it is okay to provide optimized non-CLS conformant alternative ways of access. One example is that you should provide access methods for all overloaded operators. Browse the Web and MSDN for CLS conformance, you'll find lots of guidelines.) - After drafting your interface (or implementing the first alpha), ask users of the target languages for their advice, or implement a test application in all of the languages. (I personally don't have any experience with IronRuby, and simply assumed that they use similar mechanisms like IronPython, so take my advice with a grain of salt.) Regards, Markus > -----Urspr?ngliche Nachricht----- > Von: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] Im Auftrag von Doug Blank > Gesendet: Montag, 4. April 2011 17:25 > An: Discussion of IronPython > Betreff: [IronPython] Writing cross-language libraries that appear native > > I'm working on writing C# libraries which can be imported by a variety of > .NET languages, DLR and otherwise, which appear native to the language > importing them. > > For example, writing a C# function that can be used naturally in > IronPython as if it were written in Python, IronRuby as if it were written > in Ruby, and F# as if it were written in F#, etc. > > I've encountered some gotchas that I thought I'd share, and looking for > any other points of advice in writing cross-language libraries. > > 1. IronRuby strings aren't really strings, so you need to pass them in as > an object, and call .ToString(). > > public static string expects_string(object val) { > return val.ToString(); > } > > 2. F# 2.0 doesn't seem to automatically convert a type to the associated > nullable type, so avoid nullable types as parameters. > > // AVOID: > public static double? expects_nullable(double? var1=null) { > return var1; > } > > // BETTER: > public static double? expects_nullable() { > return null; > } > public static double expects_nullable(double var1) { > return var1; > } > > 3. IronPython and IronRuby lists and dictionaries implement IList and > IDictionary, so no problem with those. > > public static IDictionary make_dict(object val) { > if (val as IDictionary != null) { > return ((IDictionary)val); > } else > throw new System.ArgumentException("object is not a > dictionary"); > } > > public static IList make_list(object val) { > if (val as IList != null) { > return ((IList)val); > } else > throw new System.ArgumentException("object is not a list"); > } > > Any other suggestions? > > -Doug > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From doug.blank at gmail.com Tue Apr 5 15:48:11 2011 From: doug.blank at gmail.com (Doug Blank) Date: Tue, 5 Apr 2011 09:48:11 -0400 Subject: [IronPython] Writing cross-language libraries that appear native In-Reply-To: References: Message-ID: On Tue, Apr 5, 2011 at 3:05 AM, Markus Schaber wrote: > Hi, Doug, > > I it won't be possible to make it "feel naturally" with every language, simply because the languages have very different naming conventions (C# mandates CamelCase, Python prefers words_with_underscores, ...) and programming paradigms. It is true that each language has conventions, and also true that some languages have multiple conventions (for example, there are CamelCase and underscore Python programmers). But there are some options that just aren't possible. For example, it was not even possible to access a lowercased class name from IronRuby (at least when I tried a while back). My goal was to document that kind of issue. Also, the naming convention isn't so important (to us) as is a natural way of passing parameters and getting back results. > But on the other hand, you should keep in mind that .NET was designed as a multi-paradigm environment, and that all those Languages were implemented with this in mind. Well, not all .NET languages are implemented by Microsoft, and many follow their own conventions. I'm trying to come up with some guidelines for writing good libraries that work across a wide spectrum (from Boo to F#). > Most of the dynamic languages have very clever parameter resolution and automatic casting mechanisms implemented, as they offer easy access to the whole .NET standard library - this will automatically apply to your interface, too. E. G. any python list and tuple can be passed to a function taking a IEnumerable, python will create an auto-casting enumerator, and will throw when the sequence contains elements not compatible to Foo. Yes, the Iron* languages are excellent in this regard. I'm hoping that more languages will adopt that autocasting code, if not more of the DLR. > Nevertheless, my concrete points of advice are: > > - I think the most important thing is that you make a simple, clearly structured API. > > - Be generous but exact in what you accept. For example if you need a sequence of Foo as parameter, accept IEnumerable. > ?* No need to use IEnumerable and cast yourself - more Code to type, the dynamic language binding will auto-cast for you, and the statically typed languages like C# and F# profit from the stricter declaration. > ?* Accepting IList or ICollection is too strict for the main method, but if your algorithm can profit from indexing or knowing the size, you may provide them as optimized overloads. > > - Adhere to the coding standards / naming conventions in the language you use to implement. > > - Take care that all your functionality is exposed in CLS conformant ways. (IMHO, it is okay to provide optimized non-CLS conformant alternative ways of access. One example is that you should provide access methods for all overloaded operators. Browse the Web and MSDN for CLS conformance, you'll find lots of guidelines.) If you could give an example guideline url, that would be useful... maybe I'm using bad search terms. > - After drafting your interface (or implementing the first alpha), ask users of the target languages for their advice, or implement a test application in all of the languages. Yes, I'm writing examples in all of the .NET languages and libraries that we [1] support [2]. > (I personally don't have any experience with IronRuby, and simply assumed that they use similar mechanisms like IronPython, so take my advice with a grain of salt.) IronRuby does some cleaver things such as renaming CamelCase items to camel_case. But most languages don't. I'll eventually document all this on a website (can I use your suggestions?) This may be beyond the scope of the IronPython website, though. -Doug [1] http://pyjamaproject.org/ [2] http://svn.cs.brynmawr.edu/viewvc/Pyjama/trunk/examples/ > Regards, > Markus > > >> -----Urspr?ngliche Nachricht----- >> Von: users-bounces at lists.ironpython.com [mailto:users- >> bounces at lists.ironpython.com] Im Auftrag von Doug Blank >> Gesendet: Montag, 4. April 2011 17:25 >> An: Discussion of IronPython >> Betreff: [IronPython] Writing cross-language libraries that appear native >> >> I'm working on writing C# libraries which can be imported by a variety of >> .NET languages, DLR and otherwise, which appear native to the language >> importing them. >> >> For example, writing a C# function that can be used naturally in >> IronPython as if it were written in Python, IronRuby as if it were written >> in Ruby, and F# as if it were written in F#, etc. >> >> I've encountered some gotchas that I thought I'd share, and looking for >> any other points of advice in writing cross-language libraries. >> >> 1. IronRuby strings aren't really strings, so you need to pass them in as >> an object, and call .ToString(). >> >> ? ? public static string expects_string(object val) { >> ? ? ? ? return val.ToString(); >> ? ? } >> >> 2. F# 2.0 doesn't seem to automatically convert a type to the associated >> nullable type, so avoid nullable types as parameters. >> >> ? ? // AVOID: >> ? ? public static double? expects_nullable(double? var1=null) { >> ? ? ? ? return var1; >> ? ? } >> >> ? ? // BETTER: >> ? ? public static double? expects_nullable() { >> ? ? ? ? return null; >> ? ? } >> ? ? public static double expects_nullable(double var1) { >> ? ? ? ? return var1; >> ? ? } >> >> 3. IronPython and IronRuby lists and dictionaries implement IList and >> IDictionary, so no problem with those. >> >> ? ? public static IDictionary make_dict(object val) { >> ? ? ? ? if (val as IDictionary != null) { >> ? ? ? ? ? ? return ((IDictionary)val); >> ? ? ? ? } else >> ? ? ? ? ? ? throw new System.ArgumentException("object is not a >> dictionary"); >> ? ? } >> >> ? ? public static IList make_list(object val) { >> ? ? ? ? if (val as IList != null) { >> ? ? ? ? ? ? return ((IList)val); >> ? ? ? ? } else >> ? ? ? ? ? ? throw new System.ArgumentException("object is not a list"); >> ? ? } >> >> Any other suggestions? >> >> -Doug >> _______________________________________________ >> 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 mdriscoll at co.marshall.ia.us Tue Apr 5 22:59:45 2011 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Tue, 05 Apr 2011 15:59:45 -0500 Subject: [IronPython] Stubbing out a MAPI DLL Message-ID: <4D9B82C1.1020304@co.marshall.ia.us> Hi, I received a request recently to create a Python application that can be set as a default email client so that we can use the "Send To Mail Recipient" functionality found in MS Office, Adobe products, etc to send the mail to our Zimbra web client. After much research, I think I need to stub out some kind of MAPI implementation and make it into a DLL. Does anyone have any knowledge of how to do that? I thought I might be able to use IronPython for this since I couldn't find a good way to do it with normal Python. Thanks a lot! - Mike From dvdotsenko at gmail.com Wed Apr 6 02:45:55 2011 From: dvdotsenko at gmail.com (Daniel D.) Date: Tue, 5 Apr 2011 17:45:55 -0700 Subject: [IronPython] Stubbing out a MAPI DLL In-Reply-To: <4D9B82C1.1020304@co.marshall.ia.us> References: <4D9B82C1.1020304@co.marshall.ia.us> Message-ID: There are very few good MAPI libraries. The only one that worked more or less reliably for me is this Redemption (http://www.dimastr.com/redemption/). Because it's so difficult to find a MAPI lib for your language, it's easier to wrap Redemption into into a .Net app and wrap IronPython scripting into that on the other side. Trial version of Redemption prepends "UNREGISTERED" to subject lines on email objects it creates and nags you every time you start Outlook / MAPI client. Yet, it's a good place to start if it will work for you. Daniel. On Tue, Apr 5, 2011 at 13:59, Mike Driscoll wrote: > Hi, > > I received a request recently to create a Python application that can be set > as a default email client so that we can use the "Send To Mail Recipient" > functionality found in MS Office, Adobe products, etc to send the mail to > our Zimbra web client. > > After much research, I think I need to stub out some kind of MAPI > implementation and make it into a DLL. Does anyone have any knowledge of how > to do that? I thought I might be able to use IronPython for this since I > couldn't find a good way to do it with normal Python. Thanks a lot! > > - Mike > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From dvdotsenko at gmail.com Wed Apr 6 02:51:29 2011 From: dvdotsenko at gmail.com (Daniel D.) Date: Tue, 5 Apr 2011 17:51:29 -0700 Subject: [IronPython] Stubbing out a MAPI DLL In-Reply-To: References: <4D9B82C1.1020304@co.marshall.ia.us> Message-ID: You could also wrap COM objects (Redemption is a COM object) into cPython through it's Windows api. I wrapped other COMs into cPy on windows before, just never Redemption. Yet, this way you may end up making it work with cPython. -- Daniel. On Tue, Apr 5, 2011 at 17:45, Daniel D. wrote: > There are very few good MAPI libraries. The only one that worked more > or less reliably for me is this Redemption > (http://www.dimastr.com/redemption/). Because it's so difficult to > find a MAPI lib for your language, it's easier to wrap Redemption into > into a .Net app and wrap IronPython scripting into that on the other > side. > > Trial version of Redemption prepends "UNREGISTERED" to subject lines > on email objects it creates and nags you every time you start Outlook > / MAPI client. Yet, it's a good place to start if it will work for > you. > > Daniel. > > > On Tue, Apr 5, 2011 at 13:59, Mike Driscoll wrote: >> Hi, >> >> I received a request recently to create a Python application that can be set >> as a default email client so that we can use the "Send To Mail Recipient" >> functionality found in MS Office, Adobe products, etc to send the mail to >> our Zimbra web client. >> >> After much research, I think I need to stub out some kind of MAPI >> implementation and make it into a DLL. Does anyone have any knowledge of how >> to do that? I thought I might be able to use IronPython for this since I >> couldn't find a good way to do it with normal Python. Thanks a lot! >> >> - Mike >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > From m.schaber at 3s-software.com Wed Apr 6 10:38:10 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Wed, 6 Apr 2011 10:38:10 +0200 Subject: [IronPython] IronPython and XML Parsing Message-ID: Hi, Currently, none of the XML parsers of the Python standard library seem to work with IronPython, as they all depend on expat. According to http://devhawk.net/2008/05/06/Stream+Processing+XML+In+IronPython.aspx, the FePy project contains a drop in replacement based on System.XML: https://fepy.svn.sourceforge.net/svnroot/fepy/trunk/lib/pyexpat.py. Has anyone successfully tried this implementation? What about including it into the IronPython distribution? PS: Is FePy still alive at all? The last commit seems to be from July 2009... Regards, Markus From jdhardy at gmail.com Wed Apr 6 16:32:02 2011 From: jdhardy at gmail.com (Jeff Hardy) Date: Wed, 6 Apr 2011 08:32:02 -0600 Subject: [IronPython] IronPython and XML Parsing In-Reply-To: References: Message-ID: On Wed, Apr 6, 2011 at 2:38 AM, Markus Schaber wrote: > Has anyone successfully tried this implementation? What about including > it into the IronPython distribution? The fepy version is incomplete, but it mostly works. I haven't run the tests in a while, though, so I'm not sure how incomplete it is. I'm also unsure if we can get 100% compatibility using System.Xml; much like sqlite, it may have to p/invoke the C expat lib for perfect combatibility. pyexpat is one of the last builtin modules not included (I should be able to land _ast this weekend and unicodedata "soon"). If anyone sends a pull request with the majority of the tests passing, I'd be very happy to include it. > PS: Is FePy still alive at all? The last commit seems to be from July > 2009... I don't think so. - Jeff From rome at Wintellect.com Wed Apr 6 17:38:52 2011 From: rome at Wintellect.com (Keith Rome) Date: Wed, 6 Apr 2011 08:38:52 -0700 Subject: [IronPython] Debugging hosted python scripts In-Reply-To: References: Message-ID: <7737799D90E55E4BB9C9F7E40D161E1108D49EE7D0@VA3DIAXVS461.RED001.local> Just to follow up on this topic since I think it probably interests more than just myself - but so far the nested dispatcher frame system (WPF does not have Application.DoEvents()) seems to be working. To solve the problem of each breakpoint creating a new dispatcher frame which never terminates if you "Stop" this simple debugger, I am tracking the nesting of those frames internally and using a custom exception to unwind all of them when necessary. I think this will work well as long as the number of breakpoints / steps is kept to a reasonable level. My main worry is that stepping through repeatedly will eventually reach some nesting limit or the managed stack will deplete. Where that exhaustion point may be found I am not exactly sure yet - but since these are typically short "scriptlets" used to drive things like calculated fields and validations, I believe it will be OK. If there are any obvious flaws with this approach that I am failing to account for, then please point them out to me. I am hopeful this continues to work out as the other alternatives suggested seem to have a significantly higher implementation cost. Keith Rome Senior Consultant and Architect MCPD-EAD, MCSD, MCDBA, MCTS-WPF, MCTS-TFS, MCTS-WSS Wintellect | 770.617.4016 | krome at wintellect.com www.wintellect.com From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Markus Schaber Sent: Thursday, March 31, 2011 3:49 AM To: Discussion of IronPython Subject: Re: [IronPython] Debugging hosted python scripts Hi, If you are sure that you can control the potentially arising reentrancy problems (best by avoiding reentrancy completely, e. G. by disabling the parent windows), then Application.DoEvents inside the trace handler may help. Gr??e, Markus Von: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] Im Auftrag von Keith Rome Gesendet: Donnerstag, 31. M?rz 2011 04:52 An: users at lists.ironpython.com Betreff: [IronPython] Debugging hosted python scripts I am hoping someone can point me in the right direction here. If there are no examples out there to review, then perhaps a hint or two about where I can look in the IronPython hosting API to achieve what I want... We currently have a line of business application, written entirely in C#, that embeds the IronPython runtime. We offer a GUI script editing environment (using the SyntaxEditor control from Actipro Software, which works great for this). This script editor exists as just another dialog window in our application where the user can extend the business objects behind the application in various ways. The scripts are stored in a database, not in files on the local file system. We have great support for syntax highlighting, compiler error "squiggles", even Intelliprompt functionality. I am now building live debugging support into our script editor GUI, which is where I have run into some difficulty. I have been going down the path of using ScriptEngine.SetTrace() and inspecting frames in the callback. This works fine if I am not doing anything interactive. For example, dumping some information to Debug.WriteLine(). However what I really need (I think?) is to be able to suspend the script execution during a trace callback. I don't see a clear way to do this though. The script runtime simply continues execution when my callback returns. I have done some work around running the debugged script on a background thread, and then blocking it during "breakpoint" callbacks - but these scripts are normally run within the UI thread because they interact with data structures that are often databound to UI controls, and running them from a background thread is becoming a minefield of cross-thread violations. I cannot simply run the script in the UI thread, because blocking in the trace callback would make the application unresponsive. It seems like there should be some way to suspend/stop the script while in a trace callback (preserving all python stack and scope information), and then (optionally) later resume that execution frame by frame as the user "steps" through code. The only thing I see that might do what I want is possibly get an AST first and kick it through CallTracing() after hooking my trace callback? Is that what I should be doing? I have spent some time digging through the IronPython Tools assemblies to see how this kind of thing was achieved when integrating with Visual Studio's debugger experience. I don't see it using SetTrace(), and so I assume this is taking an entirely different approach and not sure there is anything there that really provides what I need. One last thing to mention is that our application is compiled against both WPF and Silverlight targets, so any solution needs to work in both environments. Not looking for hand-holding here - just a nudge in the right direction. Even some examples of something along these lines as implemented in pure Python might be enough for me to figure out the rest. Many thanks in advance, Keith Keith Rome Senior Consultant and Architect MCPD-EAD, MCSD, MCDBA, MCTS-WPF, MCTS-TFS, MCTS-WSS Wintellect | 770.617.4016 | krome at wintellect.com www.wintellect.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Wed Apr 6 19:07:38 2011 From: vernondcole at gmail.com (Vernon Cole) Date: Wed, 6 Apr 2011 11:07:38 -0600 Subject: [IronPython] IronPython and XML Parsing In-Reply-To: References: Message-ID: I have sent several emails to Seo asking him about the status of fepy, and received no response. I think this would be a great place to build a "fatter" distribution of IronPython, with more modules attached, and a set of Linux binaries. (Besides, I hate having my name associated with a dead project - Mike Foord and Jeff too, I would suppose.) It is possible to get sourceforge to add new administrators to a project like this when the administrator of record drops out of site. That is how I ended up with adodbapi. Should I / we / one-of-us apply to take over the project? -- Vernon Cole On Wed, Apr 6, 2011 at 8:32 AM, Jeff Hardy wrote: > On Wed, Apr 6, 2011 at 2:38 AM, Markus Schaber > wrote: >> Has anyone successfully tried this implementation? What about including >> it into the IronPython distribution? > > The fepy version is incomplete, but it mostly works. I haven't run the > tests in a while, though, so I'm not sure how incomplete it is. I'm > also unsure if we can get 100% compatibility using System.Xml; much > like sqlite, it may have to p/invoke the C expat lib for perfect > combatibility. > > pyexpat is one of the last builtin modules not included (I should be > able to land _ast this weekend and unicodedata "soon"). If anyone > sends a pull request with the majority of the tests passing, I'd be > very happy to include it. > >> PS: Is FePy still alive at all? The last commit seems to be from July >> 2009... > > I don't think so. > > - Jeff > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From jdhardy at gmail.com Wed Apr 6 19:20:21 2011 From: jdhardy at gmail.com (Jeff Hardy) Date: Wed, 6 Apr 2011 11:20:21 -0600 Subject: [IronPython] IronPython and XML Parsing In-Reply-To: References: Message-ID: On Wed, Apr 6, 2011 at 11:07 AM, Vernon Cole wrote: > I have sent several emails to Seo asking him about the status of fepy, > and received no response. ?I think this would be a great place to > build a "fatter" distribution of IronPython, with more modules > attached, and a set of Linux binaries. ?(Besides, I hate having my > name associated with a dead project - Mike Foord and Jeff too, I would > suppose.) Linux-specific binaries shouldn't be needed anymore - they should work out of the box on Mono (although if you want to maintain the .NET 2.0/IronPython 2.7 builds, that might be useful). As for libraries, I would like to see the packaging tools like pip working on IronPython so you could just do `ipip install fepy` and get the bonus modules. - Jeff From vernondcole at gmail.com Wed Apr 6 19:58:13 2011 From: vernondcole at gmail.com (Vernon Cole) Date: Wed, 6 Apr 2011 11:58:13 -0600 Subject: [IronPython] IronPython and XML Parsing In-Reply-To: References: Message-ID: I was thinking of an actual .deb file, which will put everything in the right place, hook up menus and whatnot, like the Windows installer does. I thought I'd try that after I finally manage to create a .NET 2.0 build which works. [I re-built my Ubuntu box last weekend so that I can start over. My earlier efforts resulted in killing my old Ubuntu installation, and the openSUSE I replaced it with was an interesting experiment, but not something I can use on a day-by-day basis.] I want the next guy to have less trouble than me. I was thinking of using fepy to perhaps collect lots of optional modules -- like the db-api modules which are already there -- in one place so they are easy to find and load. PyPi has lots of modules, but how many of them will run on IronPython? The only one I am sure about is the one I support myself. I think a modest core of extra (non-standard-library) modules would be nice. I definitely do want to have the packaging tools working, too, but I would like to not have to go hunting and experimenting. My first thought was to package everything EXCEPT the Python installer, just use the distro installer (on Linux) or the .msi installer, and then add the extras from fepy. But I started to change my mind at the announcement that there would not be a .NET 2.0 release of IPy 2.7. Perhaps not having a 2.7 which runs on my distro is making me a bit crazy? -- Vernon On Wed, Apr 6, 2011 at 11:20 AM, Jeff Hardy wrote: > On Wed, Apr 6, 2011 at 11:07 AM, Vernon Cole wrote: >> I have sent several emails to Seo asking him about the status of fepy, >> and received no response. ?I think this would be a great place to >> build a "fatter" distribution of IronPython, with more modules >> attached, and a set of Linux binaries. ?(Besides, I hate having my >> name associated with a dead project - Mike Foord and Jeff too, I would >> suppose.) > > Linux-specific binaries shouldn't be needed anymore - they should work > out of the box on Mono (although if you want to maintain the .NET > 2.0/IronPython 2.7 builds, that might be useful). As for libraries, I > would like to see the packaging tools like pip working on IronPython > so you could just do `ipip install fepy` and get the bonus modules. > > - Jeff > From doug.blank at gmail.com Wed Apr 6 20:14:18 2011 From: doug.blank at gmail.com (Doug Blank) Date: Wed, 6 Apr 2011 14:14:18 -0400 Subject: [IronPython] IronPython and XML Parsing In-Reply-To: References: Message-ID: As the the original issue, I couldn't get the FePy XML parser to work (nor any variation), so gave up, and went with a stand-alone XMPP dll that does it all. It would be most excellent to get a expat module working. To Vernon's point: On Wed, Apr 6, 2011 at 1:58 PM, Vernon Cole wrote: > I was thinking of an actual .deb file, which will put everything in > the right place, hook up menus and whatnot, like the Windows installer > does. I thought I'd try that after I finally manage to create a .NET > 2.0 build which works. [I re-built my Ubuntu box last weekend so that > I can start over. My earlier efforts resulted in killing my old Ubuntu > installation, and the openSUSE I replaced it with was an interesting > experiment, but not something I can use on a day-by-day basis.] ?I > want the next guy to have less trouble than me. > ?I was thinking of using fepy to perhaps collect lots of optional > modules -- like the db-api modules which are already there -- in one > place so they are easy to find and load. ?PyPi has lots of modules, > but how many of them will run on IronPython? The only one I am sure > about is the one I support myself. ?I think a modest core of extra > (non-standard-library) modules would be nice. I definitely do want to > have the packaging tools working, too, but I would like to not have to > go hunting and experimenting. I'd rather have all of the old FePy-like support here. I don't see a reason we need to divide Windows IronPython from Linux etc IronPython, right? > ?My first thought was to package everything EXCEPT the Python > installer, just use the distro installer (on Linux) or the .msi > installer, and then add the extras from fepy. ?But I started to change > my mind at the announcement that there would not be a .NET 2.0 release > of IPy 2.7. > ?Perhaps not having a 2.7 which runs on my distro is making me a bit crazy? Why can't we have a IPy 2.7 for .NET 2.0? It builds nicely, now, and should be fine as a drop-in replacement for what ubuntu (and others) were packaging before. -Doug > -- > Vernon > > On Wed, Apr 6, 2011 at 11:20 AM, Jeff Hardy wrote: >> On Wed, Apr 6, 2011 at 11:07 AM, Vernon Cole wrote: >>> I have sent several emails to Seo asking him about the status of fepy, >>> and received no response. ?I think this would be a great place to >>> build a "fatter" distribution of IronPython, with more modules >>> attached, and a set of Linux binaries. ?(Besides, I hate having my >>> name associated with a dead project - Mike Foord and Jeff too, I would >>> suppose.) >> >> Linux-specific binaries shouldn't be needed anymore - they should work >> out of the box on Mono (although if you want to maintain the .NET >> 2.0/IronPython 2.7 builds, that might be useful). As for libraries, I >> would like to see the packaging tools like pip working on IronPython >> so you could just do `ipip install fepy` and get the bonus modules. >> >> - Jeff >> > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From jdhardy at gmail.com Wed Apr 6 20:27:17 2011 From: jdhardy at gmail.com (Jeff Hardy) Date: Wed, 6 Apr 2011 12:27:17 -0600 Subject: [IronPython] IronPython and XML Parsing In-Reply-To: References: Message-ID: On Wed, Apr 6, 2011 at 12:14 PM, Doug Blank wrote: > Why can't we have a IPy 2.7 for .NET 2.0? It builds nicely, now, and > should be fine as a drop-in replacement for what ubuntu (and others) > were packaging before. Someone else will have to volunteer to maintain it. I'm hoping to make some changes to the CI server (which does 2.0 builds now as well, to make sure that it still compiles) to properly generate nightly zip builds; would that be enough? - Jeff From sumitb at microsoft.com Wed Apr 6 20:52:07 2011 From: sumitb at microsoft.com (Sumit Basu) Date: Wed, 6 Apr 2011 18:52:07 +0000 Subject: [IronPython] Stubbing out a MAPI DLL In-Reply-To: References: <4D9B82C1.1020304@co.marshall.ia.us> Message-ID: I'd suggest using Exchange Web Services instead of MAPI - in my experience, I've found MAPI to be very tricky to use*, and small errors from an independent program using MAPI can cause painful problems (such as Outlook no longer working!). I've used EWS from IronPython/Sho before and found it to be quite a smooth experience. You'll have to use wsdl.exe to generate the stub library from your exchange server, then once you do, you can follow the many EWS C# examples on the web and easily translate them to IronPython. -Sumit *Disclaimer - I'm not a COM expert, so if I knew what I was doing, perhaps I wouldn't have run into those problems :) -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Daniel D. Sent: Tuesday, April 05, 2011 5:51 PM To: Discussion of IronPython Subject: Re: [IronPython] Stubbing out a MAPI DLL You could also wrap COM objects (Redemption is a COM object) into cPython through it's Windows api. I wrapped other COMs into cPy on windows before, just never Redemption. Yet, this way you may end up making it work with cPython. -- Daniel. On Tue, Apr 5, 2011 at 17:45, Daniel D. wrote: > There are very few good MAPI libraries. The only one that worked more > or less reliably for me is this Redemption > (http://www.dimastr.com/redemption/). Because it's so difficult to > find a MAPI lib for your language, it's easier to wrap Redemption into > into a .Net app and wrap IronPython scripting into that on the other > side. > > Trial version of Redemption prepends "UNREGISTERED" to subject lines > on email objects it creates and nags you every time you start Outlook > / MAPI client. Yet, it's a good place to start if it will work for > you. > > Daniel. > > > On Tue, Apr 5, 2011 at 13:59, Mike Driscoll wrote: >> Hi, >> >> I received a request recently to create a Python application that can >> be set as a default email client so that we can use the "Send To Mail Recipient" >> functionality found in MS Office, Adobe products, etc to send the >> mail to our Zimbra web client. >> >> After much research, I think I need to stub out some kind of MAPI >> implementation and make it into a DLL. Does anyone have any knowledge >> of how to do that? I thought I might be able to use IronPython for >> this since I couldn't find a good way to do it with normal Python. Thanks a lot! >> >> - Mike >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From vernondcole at gmail.com Wed Apr 6 21:08:05 2011 From: vernondcole at gmail.com (Vernon Cole) Date: Wed, 6 Apr 2011 13:08:05 -0600 Subject: [IronPython] IronPython and XML Parsing In-Reply-To: References: Message-ID: I sent a message to the Ubuntu group to see what they need in order to get an IPy 2.7 official release package into the distro support. I think that is the first step -- to make it accessible for "normal" users. Then we need the nightly stuff for developers, to get expat, etc, working. Depending on when Debian/Ubuntu upgrade to Mono 2.10, which may be a year or more away, continued support for .NET 2 may be a good idea for IronPython for a little while yet. Perhaps even for the first 3.n release. -- Vernon On Wed, Apr 6, 2011 at 12:27 PM, Jeff Hardy wrote: > On Wed, Apr 6, 2011 at 12:14 PM, Doug Blank wrote: >> Why can't we have a IPy 2.7 for .NET 2.0? It builds nicely, now, and >> should be fine as a drop-in replacement for what ubuntu (and others) >> were packaging before. > > Someone else will have to volunteer to maintain it. I'm hoping to make > some changes to the CI server (which does 2.0 builds now as well, to > make sure that it still compiles) to properly generate nightly zip > builds; would that be enough? > > - Jeff > From mdriscoll at co.marshall.ia.us Wed Apr 6 21:31:21 2011 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Wed, 06 Apr 2011 14:31:21 -0500 Subject: [IronPython] MAPI & IronPython In-Reply-To: <5D89E1EA57432748ADF38D772438489201CFC38E@SANxchg01.etc.lan> References: <5D89E1EA57432748ADF38D772438489201CFC38E@SANxchg01.etc.lan> Message-ID: <4D9CBF89.4060804@co.marshall.ia.us> The problem is that I don't know MAPI at all, so I don't know where to begin. We do not use Outlook at all. What I am attempting to do is create some way to set my little script as a default email client so I can redirect the file to our web client, which happens to be Zimbra Web mail, an open source project. Thunderbird registers itself as a default email client and it appears to stick some kind of mapi dll file in the registry. I don't have one of those, so I just tried sticking an exe of my own in there that I had created that doesn't do anything except generate a log file. Office just complains that I don't have a proper email client and cancels the request. - Mike On 4/6/2011 11:08 AM, Perez, Justin wrote: > > Hi Mike, I am no programmer ( I don't know what stub means; > definition-yes, practical appliance-no). Please post your finished > work on the mailing list or email me. I am using the mapi and cdo > api's from microsoft to automate emails for MS Outlook using CPython, > if I can help in any way on that. > > http://msdn.microsoft.com/en-us/library/ms527491%28EXCHG.10%29.aspx > > I have plenty of code which goes through inboxes and this sort of > thing. Good luck and I hope to see some IronPython code targeting the > MAPI! > > */Justin Perez /* > > Energy Transfer > > Houston > > Pipeline Integrity GIS > > 281.714.2382 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dvdotsenko at gmail.com Thu Apr 7 00:52:10 2011 From: dvdotsenko at gmail.com (Daniel D.) Date: Wed, 6 Apr 2011 15:52:10 -0700 Subject: [IronPython] MAPI & IronPython In-Reply-To: <4D9CBF89.4060804@co.marshall.ia.us> References: <5D89E1EA57432748ADF38D772438489201CFC38E@SANxchg01.etc.lan> <4D9CBF89.4060804@co.marshall.ia.us> Message-ID: Somehow I think you meant to say IMAP, not MAPI. Thunderbird cannot talk MAPI. It must be IMAP. In that case, it's easer, but you still need a lib that talks IMAP. Python has imaplib modue that even supports SSLed connections. On Wed, Apr 6, 2011 at 12:31, Mike Driscoll wrote: > The problem is that I don't know MAPI at all, so I don't know where to > begin. We do not use Outlook at all. What I am attempting to do is create > some way to set my little script as a default email client so I can redirect > the file to our web client, which happens to be Zimbra Web mail, an open > source project. > > Thunderbird registers itself as a default email client and it appears to > stick some kind of mapi dll file in the registry. I don't have one of those, > so I just tried sticking an exe of my own in there that? I had created that > doesn't do anything except generate a log file. Office just complains that I > don't have a proper email client and cancels the request. > > - Mike > > > On 4/6/2011 11:08 AM, Perez, Justin wrote: > > Hi Mike, I am no programmer ( I don't know what stub means; definition-yes, > practical appliance-no).? Please post your finished work on the mailing list > or email me.? I am using the mapi and cdo api's from microsoft to automate > emails for MS Outlook using CPython, if I can help in any way on that. > > > > http://msdn.microsoft.com/en-us/library/ms527491%28EXCHG.10%29.aspx > > > > I have plenty of code which goes through inboxes and this sort of thing. > Good luck and I hope to see some IronPython code targeting the MAPI! > > > > Justin Perez > > Energy Transfer > > Houston > > Pipeline Integrity GIS > > 281.714.2382 > > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > From doug.blank at gmail.com Thu Apr 7 14:09:17 2011 From: doug.blank at gmail.com (Doug Blank) Date: Thu, 7 Apr 2011 08:09:17 -0400 Subject: [IronPython] Building IronPython/IronRuby for Mono? Yes! In-Reply-To: References: <9597F4A19BFDB342B6E90963100C3308042302@SN2PRD0302MB113.namprd03.prod.outlook.com> <9597F4A19BFDB342B6E90963100C330804265F@SN2PRD0302MB113.namprd03.prod.outlook.com> <9597F4A19BFDB342B6E90963100C3308042709@SN2PRD0302MB113.namprd03.prod.outlook.com> <9597F4A19BFDB342B6E90963100C3308042A36@SN2PRD0302MB113.namprd03.prod.outlook.com> <9597F4A19BFDB342B6E90963100C3308042ABF@SN2PRD0302MB113.namprd03.prod.outlook.com> <9597F4A19BFDB342B6E90963100C3308043256@SN2PRD0302MB113.namprd03.prod.outlook.com> Message-ID: On Fri, Mar 25, 2011 at 3:02 PM, Jeff Hardy wrote: > On Fri, Mar 25, 2011 at 12:46 PM, Doug Blank wrote: >> Excellent! IronPython 3.0 (trunk) with .NET framework 2.0 *builds* and >> *runs* great under Mono 2.10. And it seems to *run* great under Mono >> 2.6.7 as well! It does NOT build under Mono 2.6.7, but I suspect that >> many mono build issues between 2.6.7 and 2.10 have been fixed. > > When I get a chance I'll cherry-pick those changes onto the > ipy-2.7-maint branch as well. There's not much difference now, but > they will diverge quite a bit in the future. Thanks! BTW, IronRuby also builds under Mono 2.10 with the 2.0 framework and so runs under Mono 2.6.7, so we have a complete DLR set for Mono. xbuild Solutions/Ruby.sln /p:Configuration="v2Release" I've also been updating the wiki to keep it up to date: http://ironpython.codeplex.com/wikipage?title=IronPython%20on%20Mono Let me know if you have suggestions, or corrections. -Doug > - Jeff > From mdriscoll at co.marshall.ia.us Thu Apr 7 22:42:15 2011 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Thu, 07 Apr 2011 15:42:15 -0500 Subject: [IronPython] MAPI & IronPython In-Reply-To: References: Message-ID: <4D9E21A7.4020703@co.marshall.ia.us> On 4/7/2011 3:23 PM, users-request at lists.ironpython.com wrote: > Message: 1 > Date: Wed, 6 Apr 2011 15:52:10 -0700 > From: "Daniel D." > To: Discussion of IronPython > Subject: Re: [IronPython] MAPI& IronPython > Message-ID: > Content-Type: text/plain; charset=UTF-8 > > Somehow I think you meant to say IMAP, not MAPI. > > Thunderbird cannot talk MAPI. It must be IMAP. In that case, it's > easer, but you still need a lib that talks IMAP. Python has imaplib > modue that even supports SSLed connections. I don't think so. If you go to HKLM\Software\Clients\Mail\Mozilla Thunderbird and look at their DLL key, you'll see something like this: C:\Program Files\Mozilla Thunderbird\mozMapi32_InUse.dll To me, that says they include some implementation of Mapi to be compatible with Office, Adobe and whoever else uses the Send to Email menu option. IMAP has nothing to do with it. I suspect that I can have Thunderbird set up to SMTP and POP and it will behave the same way because it needs MAPI for the Send To. - Mike From jdhardy at gmail.com Fri Apr 8 00:18:58 2011 From: jdhardy at gmail.com (Jeff Hardy) Date: Thu, 7 Apr 2011 16:18:58 -0600 Subject: [IronPython] Google Summer of Code Message-ID: Hi, If anyone is still interested in doing an IronPython, IronRuby, or any other DLR-related project for GSoC, feel free to submit them to either the Mono project (IronPython/IronRuby/DLR) or the Python Software Foundation (IronPython). The deadline is tomorrow (Friday, April 8 at 19:00 UTC), so you'll have to act quickly. - Jeff From dvdotsenko at gmail.com Fri Apr 8 02:40:07 2011 From: dvdotsenko at gmail.com (Daniel D.) Date: Thu, 7 Apr 2011 17:40:07 -0700 Subject: [IronPython] MAPI & IronPython In-Reply-To: <4D9E21A7.4020703@co.marshall.ia.us> References: <4D9E21A7.4020703@co.marshall.ia.us> Message-ID: We probably digressed on the subject of Thunderbird. It can't talk MAPI to server - i meant. It supports MAPI as way to allow windows to route the emails through it. More here: http://kb.mozillazine.org/MAPI_Support Back to your issue: Python + Zimbra. Zimbra can speak both MAPI and IMAP. For what you need (email client) - IMAP is sufficient. if you can convince the admin t share with you IMAP set up for Zimbra, your problem is solved. If MAPI is all the server can talk, and it's not actual Exchange, use a MAPI client to talk to it. You don't need Outlook to talk to MAPI server. You can get barebones MAPI libs on a windows machine and have Redemption to talk to it. Either way, MAPI to server is a pain. Better try to get IMAP settings exposed to you to the Zimbra server, then use the flavor of Python you want with standard IMAPlib module. On Thu, Apr 7, 2011 at 13:42, Mike Driscoll wrote: > On 4/7/2011 3:23 PM, users-request at lists.ironpython.com wrote: >> >> Message: 1 >> Date: Wed, 6 Apr 2011 15:52:10 -0700 >> From: "Daniel D." >> To: Discussion of IronPython >> Subject: Re: [IronPython] MAPI& ?IronPython >> Message-ID: >> Content-Type: text/plain; charset=UTF-8 >> >> Somehow I think you meant to say IMAP, not MAPI. >> >> Thunderbird cannot talk MAPI. It must be IMAP. In that case, it's >> easer, but you still need a lib that talks IMAP. Python has imaplib >> modue that even supports SSLed connections. > > I don't think so. If you go to HKLM\Software\Clients\Mail\Mozilla > Thunderbird and look at their DLL key, you'll see something like this: > C:\Program Files\Mozilla Thunderbird\mozMapi32_InUse.dll > > To me, that says they include some implementation of Mapi to be compatible > with Office, Adobe and whoever else uses the Send to Email menu option. IMAP > has nothing to do with it. I suspect that I can have Thunderbird set up to > SMTP and POP and it will behave the same way because it needs MAPI for the > Send To. > > - Mike > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From vernondcole at gmail.com Fri Apr 8 03:26:07 2011 From: vernondcole at gmail.com (Vernon Cole) Date: Thu, 7 Apr 2011 19:26:07 -0600 Subject: [IronPython] Fwd: IronPython and Mono are very old. How can we get an update? In-Reply-To: References: <1300613989.31768.71.camel@Ed> <1300670645.9390.97.camel@Ed> Message-ID: I have been shuttling ideas back and forth between the IronPython and Ubuntu development groups. This is the latest exchange. I have added comments... -- Vernon ---------- Forwarded message ---------- > From: Christopher James Halse Rogers > Date: Thu, Apr 7, 2011 at 5:37 PM > Subject: Re: IronPython and Mono are very old. How can we get an update? > To: Vernon Cole > Cc: ubuntu-devel-discuss at lists.ubuntu.com > > > On Fri, Apr 8, 2011 at 2:31 AM, Vernon Cole wrote: > > On Thu, Apr 7, 2011 at 6:26 AM, chalserogers at gmail.com > > wrote: > > [...] > >> Mono's upstream 2.10 release page suggests that they're shipping both > >> IronPython and IronRuby in the main mono distribution, but looking at > >> the source I can't find it, so I'm not sure what's happening there. > > > > IronPython and IronRuby are now building from the same source. > > https://github.com/IronLanguages/main > > > >> Regardless, Mono 2.10.1 is now available in Debian experimental, and > >> so will be available early on in the Oneiric (what will become Ubuntu > >> 11.10) development cycle. Since we're very close to the end of the > >> Natty cycle upgrading to 2.10.1 presents too big a regression risk to > >> pull it in this time. > >> > >> What needs to be done is to update the dlr-languages? source package. > >> This is maintained by the pkg-cli-libs team in Debian, and we sync it > >> across from there. As we're well after Natty feature freeze, updating > >> in Natty would require a Feature Freeze exception?. As there seems to > >> be only one package with a(n optional) dependency on IronPython in the > >> archive it *might* be possible to get an FFe and have the new package > >> in the Natty release, it would be more reasonable to aim for Oneiric. > > > > One can RUN IronPython 2.7 on Mono 2.6.7, but not BUILD it, > > http://ironpython.codeplex.com/wikipage?title=IronPython%20on%20Mono > > So I'm not sure how well an FFe would work. > > Oh. Yeah, that's not going to work then! > > > I'm assuming that the > > build engine runs on the same Mono version as the release? > > Yes. The policy is that everything in the archive has to be built by > tools in the archive. > > > > > Perhaps we will need to maintain a .NET 2.0 compatible binary of IPy > > on the IronPython site until well after Debian releases with Mono 2.10 > > under the hood. > > > > Debian stable is going to have Mono 2.6.7 until the next release, > which is likely to be about 2 years away. There's likely to be a > backport done, though, so it should (eventually) be reasonably easy > for Debian users to have Mono 2.10. Ubuntu 11.10 will have Mono 2.10, > Ubuntu 11.04 won't - but, again, is likely to get *some* sort of > backport, even through a PPA. Whether that makes it worth maintaining > a 2.0-compatible IPy is up to you :). > > So, it sounds like Doug's offer make a .deb package will be a really good thing for two more years. -- VC > >> If you'd like help in the mechanical process of updating the package, > >> the Ubuntu packaging guide? has a good rundown, or feel free to ask - > >> IRC #debian-cli on oftc.net is friendly and generally active. Since > >> it looks like dlr-languages is one of the more complex things to > >> package, I could probably find the time to update it in the next month > >> or so if you're not comfortable with the process. > >> > > ?: https://wiki.ubuntu.com/FreezeExceptionProcess > > ?: > http://git.debian.org/?p=pkg-cli-libs/packages/dlr-languages.git;a=summary > > ?: https://wiki.ubuntu.com/PackagingGuide > > > > Okay, I just looked at the link, and would require a month or so for > > me to figure out how to do it. I have been a bit hesitant about > > changing things I don't understand, ever since I crashed the Internet > > in several neighboring states by incorrectly updating a gateway > > router. (Long story, and the Internet was much smaller then.) So, yes, > > please make those changes when you can. :-) > > Well, we'd be reviewing and sponsoring your changes, so if you *did* > break the Internet again it'd be our fault :). > > > > > Make sure that the source is coming from github, not codeplex. > > I'll see that the build patches get into a new tarball, They are now > > in the git trunk but not backported to the 2.7 maintenance branch yet. > Jeff has corrected my error here, and both the 2.7 branch and the tarball are up to date. -- VC > > How often do you fetch a new tarball? > > As often as the maintainer feels like it. For well maintained > packages (here's where you can come in ?) that's generally once per > upstream release, unless there's some problem - like it not being > buildable against Mono 2.6.7 :). > > There's a certain amount of impedance mismatch between Debian and > predominantly-Windows upstreams like Iron*, but that's something that > can largely be worked around. The biggest problem is probably the > different IronPython/IronRuby release schedules which mean we can't > have IronPython 2.7 and IronRuby 1.0 unless we have two different > source packages, and even then there's the problem of the shared DLR > component. > This may still be a sticky spot. The tarball does contain IronRuby, but what version? There must be a version identifier somewhere, but it is not obvious. The only Ruby version number I found when hunting around this afternoon was in an .html file, and the version number was 0.1! I'm pretty sure that is wrong. Perhaps the README file at the IronLanguages root should be edited to document the versions of the contents, or maybe a NEWS file could be added. And, why does Rogers say "unless we have two different source packages"? Methinks another round of mail exchanges may be needed here. -- Vernon -------------- next part -------------- An HTML attachment was scrubbed... URL: From phatfish at gmail.com Fri Apr 8 16:26:41 2011 From: phatfish at gmail.com (Chris) Date: Fri, 8 Apr 2011 15:26:41 +0100 Subject: [IronPython] Python Tools Beta Pluing - No Toolbox Items Message-ID: Hi all, I have installed the Python Tools for Visual Studio beta 1, and im having trouble getting any tools in the WPF designer. This has worked OK, but with the tools packaged with the IronPython install. I actually did a fresh install on another box recently and only ever installed the beta Tools. When i create a new WPF project and drop into designer mode all the toolbox icons are greyed out. Does anyone else have this issue, or know how to fix? Thanks, Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdhardy at gmail.com Fri Apr 8 17:07:17 2011 From: jdhardy at gmail.com (Jeff Hardy) Date: Fri, 8 Apr 2011 09:07:17 -0600 Subject: [IronPython] Fwd: IronPython and Mono are very old. How can we get an update? In-Reply-To: References: <1300613989.31768.71.camel@Ed> <1300670645.9390.97.camel@Ed> Message-ID: Vernon, thank you very much for handling this! On Thu, Apr 7, 2011 at 7:26 PM, Vernon Cole wrote: > This may still be a sticky spot.? The tarball does contain IronRuby, but > what version? Should be 1.1.3. > There must be a version identifier somewhere, but it is not obvious. The > only Ruby version number I found when hunting around this afternoon was in > an .html file, and the version number was 0.1!?? I'm pretty sure that is > wrong. Look for "IronRubyInformationalVersion" in Languages\Ruby\Ruby\Runtime\RubyContext.cs. But yes, it should be in the README (and the README should be fleshed out quite a bit, given that github shows it on the first page). - Jeff From dinov at microsoft.com Fri Apr 8 18:14:57 2011 From: dinov at microsoft.com (Dino Viehland) Date: Fri, 8 Apr 2011 16:14:57 +0000 Subject: [IronPython] Python Tools Beta Pluing - No Toolbox Items In-Reply-To: References: Message-ID: <6C7ABA8B4E309440B857D74348836F2E15041B71@TK5EX14MBXC133.redmond.corp.microsoft.com> I ran into that too and it's fixed for the next release (along w/ IronPython Silverlight debugging which was also broken). The fix is checked in so if you can build from source you can download the current sources and do that. Otherwise the next release should be happening in the next few days so you can probably just wait. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Chris Sent: Friday, April 08, 2011 7:27 AM To: Discussion of IronPython Subject: [IronPython] Python Tools Beta Pluing - No Toolbox Items Hi all, I have installed the Python Tools for Visual Studio beta 1, and im having trouble getting any tools in the WPF designer. This has worked OK, but with the tools packaged with the IronPython install. I actually did a fresh install on another box recently and only ever installed the beta Tools. When i create a new WPF project and drop into designer mode all the toolbox icons are greyed out. Does anyone else have this issue, or know how to fix? Thanks, Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: From phatfish at gmail.com Fri Apr 8 19:09:10 2011 From: phatfish at gmail.com (Chris) Date: Fri, 8 Apr 2011 18:09:10 +0100 Subject: [IronPython] Python Tools Beta Pluing - No Toolbox Items In-Reply-To: <6C7ABA8B4E309440B857D74348836F2E15041B71@TK5EX14MBXC133.redmond.corp.microsoft.com> References: <6C7ABA8B4E309440B857D74348836F2E15041B71@TK5EX14MBXC133.redmond.corp.microsoft.com> Message-ID: Great thanks for the heads up. Ill wait on the new beta i think. Chris On 8 April 2011 17:14, Dino Viehland wrote: > I ran into that too and it?s fixed for the next release (along w/ > IronPython Silverlight debugging which was also broken). The fix is checked > in so if you can build from source you can download the current sources and > do that. Otherwise the next release should be happening in the next few > days so you can probably just wait. > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Chris > *Sent:* Friday, April 08, 2011 7:27 AM > *To:* Discussion of IronPython > *Subject:* [IronPython] Python Tools Beta Pluing - No Toolbox Items > > > > Hi all, > > I have installed the Python Tools for Visual Studio beta 1, and im having > trouble getting any tools in the WPF designer. > > This has worked OK, but with the tools packaged with the IronPython > install. > > I actually did a fresh install on another box recently and only ever > installed the beta Tools. When i create a new WPF project and drop into > designer mode all the toolbox icons are greyed out. > > Does anyone else have this issue, or know how to fix? > > Thanks, > Chris > > _______________________________________________ > 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 davew252 at tx.rr.com Sat Apr 9 04:06:02 2011 From: davew252 at tx.rr.com (Dave Wald) Date: Fri, 08 Apr 2011 21:06:02 -0500 Subject: [IronPython] Python Tools Beta Pluing - No Toolbox Items In-Reply-To: References: Message-ID: <4D9FBF0A.6060702@tx.rr.com> Chris, Lest you think I gave you a bum steer the other day, here's what happened: By the time I switched over to the new tools, I already had all my layout done in the designer, and was just working in XAML and code. I never realized the toolbox wasn't working! But thanks for the heads up. I would've been somewhat consternated... ;-) Dave On 4/8/2011 9:26 AM, Chris wrote: > Hi all, > > I have installed the Python Tools for Visual Studio beta 1, and im > having trouble getting any tools in the WPF designer. > > This has worked OK, but with the tools packaged with the IronPython > install. > > I actually did a fresh install on another box recently and only ever > installed the beta Tools. When i create a new WPF project and drop > into designer mode all the toolbox icons are greyed out. > > Does anyone else have this issue, or know how to fix? > > Thanks, > Chris > > > _______________________________________________ > 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 davew252 at tx.rr.com Sat Apr 9 05:04:37 2011 From: davew252 at tx.rr.com (Dave Wald) Date: Fri, 08 Apr 2011 22:04:37 -0500 Subject: [IronPython] New clr.ImportExtensions (LINQ) Syntax Message-ID: <4D9FCCC5.40006@tx.rr.com> Hi all - I've been experimenting with with the new extension method import facility and so far it is working well, more or less as I expected, except that I'm getting an error message when I try to chain Linq method calls. I don't know whether this should be considered a bug or not. It seems the dynamic code cannot pass the intermediate enumerable (iterator/generator?) object between method calls. I have to wrap it in a list(...) call for it to work. And I would have thought .ToList() would work, but it blows too. I don't know enough about the internals to judge whether it's even possible for the DLR to do this. The exception seems to be coming from DLR code. Would be nice if the chained syntax could be made to work, tho. But even as it is, it still allows much cleaner code style than my homebrew module did. Ideas? Enlightenment? Thanks Here's the code: import clr clr.AddReference("System.Core") import System from System import Linq clr.ImportExtensions(Linq) class Product(object): def __init__(self, cat, id, qtyOnHand ): self.Cat = cat self.ID = id self.QtyOnHand = qtyOnHand self.Q = self.QtyOnHand def runit(): products = [Product(prod[0], prod[1], prod[2]) for prod in ('DrillRod', 'DR123', 45), ('Flange', 'F423', 12), ('Gizmo', 'G9872', 214), ('Sprocket', 'S534', 42)] # pd = products.Where(lambda prod: prod.Q < 40).Select(lambda prod: (prod.Cat, prod.ID) ) # blows: "Type System.Collections.Generic.IEnumerable`1[TSource] contains generic parameters" # pd = products.Where(lambda prod: prod.Q < 40).AsEnumerable().Select(lambda prod: (prod.Cat, prod.ID) ) #blows, same exception pd = products.Where(lambda prod: prod.Q < 40) #ok for prod in pd: print prod.Cat, prod.ID, prod.Q #==> Flange F423 12 # pd2 = pd.Select(lambda prod: (prod.Cat, prod.ID) ) #blows, same exception - note source (pd) is not a list at this point - it's a ...+WhereEnumerator... object pd2 = products.Select(lambda prod: (prod.Cat, prod.ID) ) #ok for prod in pd2: print "Cat: {0}, ID: {1}".format(prod[0], prod[1]) #==> Cat: DrillRod, ID: DR123 ... pd2 = list(pd).Select(lambda prod: (prod.Cat, prod.ID) ) #ok Wrapping it in a list for prod in pd2: print "Cat: {0}, ID: {1}".format(prod[0], prod[1]) #==> Cat: Flange, ID: F423 # pd = products.Where(lambda prod: prod.Q < 30).ToList() #blows, same exception pd = list( products.Where(lambda prod: prod.Q < 30) ) #ok for prod in pd2: print "Cat: {0}, ID: {1}".format(prod[0], prod[1]) #==> Cat: Flange, ID: F423 # ok pd = list( products.Where(lambda prod: prod.Q < 40) ).Select(lambda prod: "Cat: {0}, ID: {1}, Qty: {2}".format(prod.Cat, prod.ID, prod.Q)) for prod in pd: print prod #==> Cat: Flange, ID: F423, Qty: 12 # ok pd = ( list(products.Where(lambda prod: prod.Q < 40)) .Select(lambda prod: "Cat: {0}, ID: {1}, Qty: {2}".format(prod.Cat, prod.ID, prod.Q)) ) for prod in pd: print prod #==> Cat: Flange, ID: F423, Qty: 12 if __name__ == "__main__": runit() ------------------------------------------------------------------------------------------------------------------------- Here's the barf: System.ArgumentException was unhandled by user code Message=Type System.Collections.Generic.IEnumerable`1[TSource] contains generic parameters Source=System.Core StackTrace: at System.Dynamic.Utils.TypeUtils.ValidateType(Type type) at System.Linq.Expressions.Expression.Convert(Expression expression, Type type, MethodInfo method) at Microsoft.Scripting.Ast.Utils.Convert(Expression expression, Type type) at IronPython.Runtime.Binding.MetaBuiltinFunction.GetInstance(Expression instance, Type testType) at IronPython.Runtime.Binding.MetaBuiltinFunction.MakeSelfCall(DynamicMetaObjectBinder call, Expression codeContext, DynamicMetaObject[] args) at IronPython.Runtime.Binding.MetaBuiltinFunction.InvokeWorker(DynamicMetaObjectBinder call, Expression codeContext, DynamicMetaObject[] args) at IronPython.Runtime.Binding.MetaBuiltinFunction.Invoke(PythonInvokeBinder pythonInvoke, Expression codeContext, DynamicMetaObject target, DynamicMetaObject[] args) at IronPython.Runtime.Binding.PythonInvokeBinder.BindWorker(DynamicMetaObject context, DynamicMetaObject target, DynamicMetaObject[] args) at IronPython.Runtime.Binding.PythonInvokeBinder.Bind(DynamicMetaObject target, DynamicMetaObject[] args) at Microsoft.Scripting.Utils.DynamicUtils.GenericInterpretedBinder`1.Bind(DynamicMetaObjectBinder binder, Int32 compilationThreshold, Object[] args) at Microsoft.Scripting.Utils.DynamicUtils.LightBind[T](DynamicMetaObjectBinder binder, Object[] args, Int32 compilationThreshold) at IronPython.Runtime.Types.BuiltinFunction.IronPython.Runtime.Binding.IFastInvokable.MakeInvokeBinding[T](CallSite`1 site, PythonInvokeBinder binder, CodeContext state, Object[] args) at IronPython.Runtime.Binding.PythonInvokeBinder.BindDelegate[T](CallSite`1 site, Object[] args) at System.Runtime.CompilerServices.CallSiteBinder.BindCore[T](CallSite`1 site, Object[] args) at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2) at Test_CLR_ImportExtensions$2.runit$80(PythonFunction $function) in C:\IPy27_Projects\IPy_LINQ1\IPy_LINQ1\Test_CLR_ImportExtensions.py:line 131 at IronPython.Runtime.PythonFunction.FunctionCaller.Call0(CallSite site, CodeContext context, Object func) at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) at __main__$1.__main__(FunctionCode $functionCode) in C:\IPy27_Projects\IPy_LINQ1\IPy_LINQ1\Main.py:line 21 at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope) at IronPython.Compiler.RuntimeScriptCode.Run(Scope scope) at IronPython.Hosting.PythonCommandLine.RunFileWorker(String fileName) at IronPython.Hosting.PythonCommandLine.RunFile(String fileName) InnerException: (nothing after this) -------------- next part -------------- An HTML attachment was scrubbed... URL: From davew252 at tx.rr.com Sun Apr 10 03:26:12 2011 From: davew252 at tx.rr.com (Dave Wald) Date: Sat, 09 Apr 2011 20:26:12 -0500 Subject: [IronPython] New clr.ImportExtensions (LINQ) Syntax In-Reply-To: <4D9FCCC5.40006@tx.rr.com> References: <4D9FCCC5.40006@tx.rr.com> Message-ID: <4DA10734.3000509@tx.rr.com> Okay. Never mind. There's already an open bug for this I just found. http://ironpython.codeplex.com/workitem/30379 From babygguy at gmail.com Sun Apr 10 06:47:00 2011 From: babygguy at gmail.com (Matthew Green) Date: Sun, 10 Apr 2011 14:47:00 +1000 Subject: [IronPython] BeginInvoke from C# to IronPython Message-ID: Hi everyone, I came across a simple C# httplistener (http://www.paraesthesia.com/archive/2008/07/16/simplest-embedded-web-server-ever-with-httplistener.aspx). I decided to have a quick play with it and leave the listener in C# and make the client calls and callback in IronPython. After multiple attempts I failed to get C#'s BeginInvoke call to callback to IronPython. That catch shows a "The object must be a runtime Reflection object." error. I implemented this short example which failed to callback to the Python function and hits the catch after trying to BeginInvoke - ---------- C#: using System; using System.Globalization; using System.Net; using System.Threading; namespace test { public class Class1 { public event EventHandler IncomingRequest = null; public void testInvoke() { SomeEventArgs e = new SomeEventArgs(1); try { if (this.IncomingRequest != null) { this.IncomingRequest.BeginInvoke(this, e, null, null); } } catch { //failed } } } } public class SomeEventArgs : EventArgs { public int RequestContext; public SomeEventArgs(int anarg) { this.RequestContext = anarg; } } Python: import clr clr.AddReference("test") from test import * def testcallback(foo, bar): pass thing = Class1() thing.IncomingRequest += testcallback thing.testInvoke() ---------- I get the feeling I'm missing some basic knowledge about how IronPython functions are added as events. But I feel like I'm getting distracted and looking at all the wrong things. Thanks for your help!!! From rome at Wintellect.com Sun Apr 10 07:40:33 2011 From: rome at Wintellect.com (Keith Rome) Date: Sat, 9 Apr 2011 22:40:33 -0700 Subject: [IronPython] BeginInvoke from C# to IronPython In-Reply-To: References: Message-ID: <7737799D90E55E4BB9C9F7E40D161E1108D4A94FAD@VA3DIAXVS461.RED001.local> Not sure if you are aware, but calling a delegate like that via BeginInvoke() is really just the same thing as using ThreadPool.QueueUserWorkItem(). You might save yourself a lot of hassle by omitting the Class1 and event handler funny business, and just pass your callback directly to QUWI: import clr clr.AddReference("System") from System import Threading def testCallback(foo): # print might not be safe here due to threading... but Debug.WriteLine() is thread-safe from System import Diagnostics Diagnostics.Debug.WriteLine(foo) # test using sync call testCallback("sync") # test using async call cb = Threading.WaitCallback(testCallback) Threading.ThreadPool.QueueUserWorkItem(cb, "async") Keith Rome Senior Consultant and Architect MCPD-EAD, MCSD, MCDBA, MCTS-WPF, MCTS-TFS, MCTS-WSS Wintellect | 770.617.4016 | krome at wintellect.com www.wintellect.com -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Matthew Green Sent: Sunday, April 10, 2011 12:47 AM To: users at lists.ironpython.com Subject: [IronPython] BeginInvoke from C# to IronPython Hi everyone, I came across a simple C# httplistener (http://www.paraesthesia.com/archive/2008/07/16/simplest-embedded-web-server-ever-with-httplistener.aspx). I decided to have a quick play with it and leave the listener in C# and make the client calls and callback in IronPython. After multiple attempts I failed to get C#'s BeginInvoke call to callback to IronPython. That catch shows a "The object must be a runtime Reflection object." error. I implemented this short example which failed to callback to the Python function and hits the catch after trying to BeginInvoke - ---------- C#: using System; using System.Globalization; using System.Net; using System.Threading; namespace test { public class Class1 { public event EventHandler IncomingRequest = null; public void testInvoke() { SomeEventArgs e = new SomeEventArgs(1); try { if (this.IncomingRequest != null) { this.IncomingRequest.BeginInvoke(this, e, null, null); } } catch { //failed } } } } public class SomeEventArgs : EventArgs { public int RequestContext; public SomeEventArgs(int anarg) { this.RequestContext = anarg; } } Python: import clr clr.AddReference("test") from test import * def testcallback(foo, bar): pass thing = Class1() thing.IncomingRequest += testcallback thing.testInvoke() ---------- I get the feeling I'm missing some basic knowledge about how IronPython functions are added as events. But I feel like I'm getting distracted and looking at all the wrong things. Thanks for your help!!! _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From babygguy at gmail.com Sun Apr 10 13:29:35 2011 From: babygguy at gmail.com (Matthew Green) Date: Sun, 10 Apr 2011 21:29:35 +1000 Subject: [IronPython] BeginInvoke from C# to IronPython In-Reply-To: <7737799D90E55E4BB9C9F7E40D161E1108D4A94FAD@VA3DIAXVS461.RED001.local> References: <7737799D90E55E4BB9C9F7E40D161E1108D4A94FAD@VA3DIAXVS461.RED001.local> Message-ID: Thank you! This is a way better way of doing it! On Sun, Apr 10, 2011 at 3:40 PM, Keith Rome wrote: > Not sure if you are aware, but calling a delegate like that via BeginInvoke() is really just the same thing as using ThreadPool.QueueUserWorkItem(). You might save yourself a lot of hassle by omitting the Class1 and event handler funny business, and just pass your callback directly to QUWI: > > import clr > clr.AddReference("System") > from System import Threading > > def testCallback(foo): > ?# print might not be safe here due to threading... but Debug.WriteLine() is thread-safe > ?from System import Diagnostics > ?Diagnostics.Debug.WriteLine(foo) > > # test using sync call > testCallback("sync") > > # test using async call > cb = Threading.WaitCallback(testCallback) > Threading.ThreadPool.QueueUserWorkItem(cb, "async") > > > Keith Rome > Senior Consultant and Architect > MCPD-EAD, MCSD, MCDBA, MCTS-WPF, MCTS-TFS, MCTS-WSS > Wintellect | 770.617.4016 | krome at wintellect.com > www.wintellect.com > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Matthew Green > Sent: Sunday, April 10, 2011 12:47 AM > To: users at lists.ironpython.com > Subject: [IronPython] BeginInvoke from C# to IronPython > > Hi everyone, > > I came across a simple C# httplistener > (http://www.paraesthesia.com/archive/2008/07/16/simplest-embedded-web-server-ever-with-httplistener.aspx). > I decided to have a quick play with it and leave the listener in C# and make the client calls and callback in IronPython. After multiple attempts I failed to get C#'s BeginInvoke call to callback to IronPython. That catch shows a "The object must be a runtime Reflection object." error. > > I implemented this short example which failed to callback to the Python function and hits the catch after trying to BeginInvoke - > ---------- > C#: > using System; > using System.Globalization; > using System.Net; > using System.Threading; > > namespace test > { > ? ?public class Class1 > ? ?{ > ? ? ? ?public event EventHandler IncomingRequest = null; > > ? ? ? ?public void testInvoke() > ? ? ? ?{ > ? ? ? ? ? ?SomeEventArgs e = new SomeEventArgs(1); > ? ? ? ? ? ?try > ? ? ? ? ? ?{ > ? ? ? ? ? ? ? ?if (this.IncomingRequest != null) > ? ? ? ? ? ? ? ?{ > ? ? ? ? ? ? ? ? ? ?this.IncomingRequest.BeginInvoke(this, e, null, null); > ? ? ? ? ? ? ? ?} > ? ? ? ? ? ?} > ? ? ? ? ? ?catch > ? ? ? ? ? ?{ > ? ? ? ? ? ? ? ?//failed > ? ? ? ? ? ?} > ? ? ? ?} > ? ?} > } > > public class SomeEventArgs : EventArgs > { > ? ?public int RequestContext; > > ? ?public SomeEventArgs(int anarg) > ? ?{ > ? ? ? ?this.RequestContext = anarg; > ? ?} > } > > Python: > import clr > clr.AddReference("test") > from test import * > > def testcallback(foo, bar): > ? ?pass > > thing = Class1() > thing.IncomingRequest += testcallback > thing.testInvoke() > ---------- > > I get the feeling I'm missing some basic knowledge about how IronPython functions are added as events. But I feel like I'm getting distracted and looking at all the wrong things. Thanks for your help!!! > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From dinov at microsoft.com Mon Apr 11 20:53:04 2011 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 11 Apr 2011 18:53:04 +0000 Subject: [IronPython] Python Tools Beta Pluing - No Toolbox Items In-Reply-To: <4D9FBF0A.6060702@tx.rr.com> References: <4D9FBF0A.6060702@tx.rr.com> Message-ID: <6C7ABA8B4E309440B857D74348836F2E15045B61@TK5EX14MBXC133.redmond.corp.microsoft.com> Beta 2 is now out w/ the fix for this - http://pytools.codeplex.com/releases/view/63597 It also fixes Silverlight debugging which was broken in Beta 1. It should now be back at parity w/ IronPython Tools for pure IronPython development not to mention all the other improvements over IronPython Tools that have been made. So please give it a try and let us know if you run into any additional issues. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dave Wald Sent: Friday, April 08, 2011 7:06 PM To: Discussion of IronPython Subject: Re: [IronPython] Python Tools Beta Pluing - No Toolbox Items Chris, Lest you think I gave you a bum steer the other day, here's what happened: By the time I switched over to the new tools, I already had all my layout done in the designer, and was just working in XAML and code. I never realized the toolbox wasn't working! But thanks for the heads up. I would've been somewhat consternated... ;-) Dave On 4/8/2011 9:26 AM, Chris wrote: Hi all, I have installed the Python Tools for Visual Studio beta 1, and im having trouble getting any tools in the WPF designer. This has worked OK, but with the tools packaged with the IronPython install. I actually did a fresh install on another box recently and only ever installed the beta Tools. When i create a new WPF project and drop into designer mode all the toolbox icons are greyed out. Does anyone else have this issue, or know how to fix? Thanks, Chris _______________________________________________ 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 davew252 at tx.rr.com Tue Apr 12 01:29:17 2011 From: davew252 at tx.rr.com (Dave Wald) Date: Mon, 11 Apr 2011 18:29:17 -0500 Subject: [IronPython] Python Tools Beta Pluing - No Toolbox Items In-Reply-To: <6C7ABA8B4E309440B857D74348836F2E15045B61@TK5EX14MBXC133.redmond.corp.microsoft.com> References: <4D9FBF0A.6060702@tx.rr.com> <6C7ABA8B4E309440B857D74348836F2E15045B61@TK5EX14MBXC133.redmond.corp.microsoft.com> Message-ID: <4DA38ECD.1090503@tx.rr.com> Looks good. Thanks, Dino On 4/11/2011 1:53 PM, Dino Viehland wrote: > > Beta 2 is now out w/ the fix for this - > http://pytools.codeplex.com/releases/view/63597 It also fixes > Silverlight debugging which was broken in Beta 1. It should now be > back at parity w/ IronPython Tools for pure IronPython development not > to mention all the other improvements over IronPython Tools that have > been made. So please give it a try and let us know if you run into > any additional issues. > > *From:*users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Dave Wald > *Sent:* Friday, April 08, 2011 7:06 PM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] Python Tools Beta Pluing - No Toolbox Items > > Chris, > Lest you think I gave you a bum steer the other day, here's what happened: > By the time I switched over to the new tools, I already had all my > layout done in the designer, and was just working in XAML and code. > I never realized the toolbox wasn't working! > But thanks for the heads up. I would've been somewhat consternated... > ;-) > > Dave > > On 4/8/2011 9:26 AM, Chris wrote: > > Hi all, > > I have installed the Python Tools for Visual Studio beta 1, and im > having trouble getting any tools in the WPF designer. > > This has worked OK, but with the tools packaged with the IronPython > install. > > I actually did a fresh install on another box recently and only ever > installed the beta Tools. When i create a new WPF project and drop > into designer mode all the toolbox icons are greyed out. > > Does anyone else have this issue, or know how to fix? > > Thanks, > Chris > > > > _______________________________________________ > 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 Apr 12 04:25:53 2011 From: dinov at microsoft.com (Dino Viehland) Date: Tue, 12 Apr 2011 02:25:53 +0000 Subject: [IronPython] New clr.ImportExtensions (LINQ) Syntax In-Reply-To: <4DA10734.3000509@tx.rr.com> References: <4D9FCCC5.40006@tx.rr.com> <4DA10734.3000509@tx.rr.com> Message-ID: <6C7ABA8B4E309440B857D74348836F2E15047CE4@TK5EX14MBXC133.redmond.corp.microsoft.com> Dave wrote: > Okay. Never mind. There's already an open bug for this I just found. > > http://ironpython.codeplex.com/workitem/30379 I've assigned this bug to myself. I'll take a look and fix it, my guess is there's something wrong with extension method support on generic classes (e.g. class Foo : IEnumerable) that needs to be fixed in our type inferer. From m.schaber at 3s-software.com Tue Apr 12 10:11:33 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Tue, 12 Apr 2011 10:11:33 +0200 Subject: [IronPython] Old print syntax as option on IronPython 3 Message-ID: Hi, I just saw that Boo supports both print as a function and as a statement. So I had the Idea of adding an language option to IronPython which allows both syntaxes (and probably emitting a warning when using the old one). This could help in the transition of old scripts to IronPython 3. I know that the cPython parser does not allow that (using the same word as keyword and identifier), but maybe the IronPython parser is flexible enough to allow both usages? Just a weird, heretical suggestion, feel free to ignore my mail. J Regards, Markus -------------- next part -------------- An HTML attachment was scrubbed... URL: From davew252 at tx.rr.com Tue Apr 12 14:07:09 2011 From: davew252 at tx.rr.com (Dave Wald) Date: Tue, 12 Apr 2011 07:07:09 -0500 Subject: [IronPython] New clr.ImportExtensions (LINQ) Syntax In-Reply-To: <6C7ABA8B4E309440B857D74348836F2E15047CE4@TK5EX14MBXC133.redmond.corp.microsoft.com> References: <4D9FCCC5.40006@tx.rr.com> <4DA10734.3000509@tx.rr.com> <6C7ABA8B4E309440B857D74348836F2E15047CE4@TK5EX14MBXC133.redmond.corp.microsoft.com> Message-ID: <4DA4406D.60309@tx.rr.com> Very good. Thanks so much Dino! On 4/11/2011 9:25 PM, Dino Viehland wrote: > Dave wrote: >> Okay. Never mind. There's already an open bug for this I just found. >> >> http://ironpython.codeplex.com/workitem/30379 > I've assigned this bug to myself. I'll take a look and fix it, my guess is > there's something wrong with extension method support on generic > classes (e.g. class Foo : IEnumerable) that needs to be fixed in our > type inferer. > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From dinov at microsoft.com Tue Apr 12 18:54:57 2011 From: dinov at microsoft.com (Dino Viehland) Date: Tue, 12 Apr 2011 16:54:57 +0000 Subject: [IronPython] Old print syntax as option on IronPython 3 In-Reply-To: References: Message-ID: <6C7ABA8B4E309440B857D74348836F2E150498D3@TK5EX14MBXC133.redmond.corp.microsoft.com> This already exists in 2.x because you can do from __future__ import print_function (which gives you the 2.x behavior on 3.x). The tokenizer just stops yielding out print as a keyword when that's used and instead always returns a name token. I would guess that CPython does something similar in their 2.x branch. Personally I would suggest first getting this change into CPython 3.x if you really thought it was valuable (maybe a from past import print_statement). I don't think it would be that helpful in translating scripts if IronPython was the only one to have it. Plus print as a function is probably one of the easiest things to move over to and I'm guessing 2to3 translates it w/o any issues. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Markus Schaber Sent: Tuesday, April 12, 2011 1:12 AM To: users at lists.ironpython.com Subject: [IronPython] Old print syntax as option on IronPython 3 Hi, I just saw that Boo supports both print as a function and as a statement. So I had the Idea of adding an language option to IronPython which allows both syntaxes (and probably emitting a warning when using the old one). This could help in the transition of old scripts to IronPython 3. I know that the cPython parser does not allow that (using the same word as keyword and identifier), but maybe the IronPython parser is flexible enough to allow both usages? Just a weird, heretical suggestion, feel free to ignore my mail. :) Regards, Markus -------------- next part -------------- An HTML attachment was scrubbed... URL: From loocas at duber.cz Tue Apr 12 19:28:27 2011 From: loocas at duber.cz (=?UTF-8?B?THVrw6HFoSBEdWLEm2Rh?=) Date: Tue, 12 Apr 2011 19:28:27 +0200 Subject: [IronPython] VS 2010 Integrated Shell question Message-ID: <4DA48BBB.4000708@duber.cz> Hi there everyone, I have a, perhaps lame, question. I downloaded the VS 2010 Integrated Shell and installed the IronPython tools for it. However, does the VS 2010 IS have a WPF and WinForms designer? I can't seem to get it working. :( Also, the IPy tools are available only for the Integrated Shell and actual commercial versions of Visual Studio, is that right? I'm asking because I get both WPF and WinForms designers in the Visual Studio 2010 C# Express, but it's a pain to design my GUI in one package and write IPy code for it in another. Is there any solution for this? Thank you very much in advance, cheers, -- Luk?? Dub?da Director [T] +420 602 444 164 duber studio(tm) [M] info at duber.cz [W] http://www.duber.cz [A] R.A.Dvorsk?ho 601, Praha 10 [A] 10900, Czech Republic, Europe From m.schaber at 3s-software.com Wed Apr 13 09:41:13 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Wed, 13 Apr 2011 09:41:13 +0200 Subject: [IronPython] VS 2010 Integrated Shell question In-Reply-To: <4DA48BBB.4000708@duber.cz> References: <4DA48BBB.4000708@duber.cz> Message-ID: Hi, Luk??, The restriction here is not within IronPython tools, but within Visual Studio Express. Microsoft released the free (as in "free beer") express editions with artificial restrictions. (My personal guess is that one reason is to prevent other free IDEs from gaining enough momentum that they can start rivaling the commercial editions, and another one is that their marketers can argument "there are powerful free development tools for .NET", so students etc. don't go to Java (Eclipse, Netbeans), or Linux.). One of those restrictions is that they only support one language (one cannot edit C# and VB projects in the same running instance, even when both editions are installed), another one is that no plugins are allowed. Those restrictions are meant to motivate "power users" (or any serious user) to buy the commercial versions. The "integrated Shell" is the unrestricted, but barebone framework / environment without any languages and plugins, they release it for free to 3rd party vendors (like IronPython tools, or Delphi Prism), to bind them to their framework and platform. Regards, Markus > -----Urspr?ngliche Nachricht----- > Von: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] Im Auftrag von Luk?? Dubeda > Gesendet: Dienstag, 12. April 2011 19:28 > An: Discussion of IronPython > Betreff: [IronPython] VS 2010 Integrated Shell question > > Hi there everyone, > > I have a, perhaps lame, question. > > I downloaded the VS 2010 Integrated Shell and installed the IronPython > tools for it. > > However, does the VS 2010 IS have a WPF and WinForms designer? I can't > seem to get it working. :( > > Also, the IPy tools are available only for the Integrated Shell and actual > commercial versions of Visual Studio, is that right? > > I'm asking because I get both WPF and WinForms designers in the Visual > Studio 2010 C# Express, but it's a pain to design my GUI in one package > and write IPy code for it in another. > > Is there any solution for this? > > Thank you very much in advance, cheers, > > -- > Luk?? Dub?da > Director > [T] +420 602 444 164 > > duber studio(tm) > [M] info at duber.cz > [W] http://www.duber.cz > > [A] R.A.Dvorsk?ho 601, Praha 10 > [A] 10900, Czech Republic, Europe > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From numerodix at gmail.com Wed Apr 13 18:23:37 2011 From: numerodix at gmail.com (Martin Matusiak) Date: Wed, 13 Apr 2011 18:23:37 +0200 Subject: [IronPython] How to make a gtk event? Message-ID: Hey guys, I'm writing a program using using gtk# and I have a custom widget that I want to make an event for. Here is what an event looks like: >>> print self.mainwindow.Shown So I seem to need to instantiate this type with my event name and trigger function somehow as parameters, but I don't know how. Any ideas? Martin From dinov at microsoft.com Wed Apr 13 18:34:16 2011 From: dinov at microsoft.com (Dino Viehland) Date: Wed, 13 Apr 2011 16:34:16 +0000 Subject: [IronPython] How to make a gtk event? In-Reply-To: References: Message-ID: <6C7ABA8B4E309440B857D74348836F2E1504B85E@TK5EX14MBXC133.redmond.corp.microsoft.com> Martin wrote: > Hey guys, > > I'm writing a program using using gtk# and I have a custom widget that I want > to make an event for. Here is what an event looks like: > > >>> print self.mainwindow.Shown > 0x000000000000002B > [IronPython.Runtime.Types.ReflectedEvent+BoundEvent]> > > So I seem to need to instantiate this type with my event name and trigger > function somehow as parameters, but I don't know how. Any ideas? The BoundEvent object supports in place addition and subtraction for adding/removing the events and it'll accept any callable object on the right hand side. So you should just do += on shown, such as: def handler(sender, args): print('hello') self.mainwindow.shown += handler From numerodix at gmail.com Wed Apr 13 18:41:15 2011 From: numerodix at gmail.com (Martin Matusiak) Date: Wed, 13 Apr 2011 18:41:15 +0200 Subject: [IronPython] How to make a gtk event? In-Reply-To: <6C7ABA8B4E309440B857D74348836F2E1504B85E@TK5EX14MBXC133.redmond.corp.microsoft.com> References: <6C7ABA8B4E309440B857D74348836F2E1504B85E@TK5EX14MBXC133.redmond.corp.microsoft.com> Message-ID: I'm not talking about the handler, I'm talking about creating a new event for this widget. As in: mywidget.SomethingHappened += some_handler 2011/4/13 Dino Viehland : > Martin wrote: >> Hey guys, >> >> I'm writing a program using using gtk# and I have a custom widget that I want >> to make an event for. Here is what an event looks like: >> >> >>> print self.mainwindow.Shown >> > 0x000000000000002B >> [IronPython.Runtime.Types.ReflectedEvent+BoundEvent]> >> >> So I seem to need to instantiate this type with my event name and trigger >> function somehow as parameters, but I don't know how. Any ideas? > > The BoundEvent object supports in place addition and subtraction for adding/removing > the events and it'll accept any callable object on the right hand side. ?So you should just do > += on shown, such as: > > def handler(sender, args): > ? ?print('hello') > > self.mainwindow.shown += handler > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From dinov at microsoft.com Wed Apr 13 18:45:47 2011 From: dinov at microsoft.com (Dino Viehland) Date: Wed, 13 Apr 2011 16:45:47 +0000 Subject: [IronPython] How to make a gtk event? In-Reply-To: References: <6C7ABA8B4E309440B857D74348836F2E1504B85E@TK5EX14MBXC133.redmond.corp.microsoft.com> Message-ID: <6C7ABA8B4E309440B857D74348836F2E1504B913@TK5EX14MBXC133.redmond.corp.microsoft.com> Oh, reading comprehension fail... as long as you don't want it statically declared (e.g. it's only ever accessed from Python) then there's a sample pyevent.py in the Tutorial which does this. It's just an object with __iadd__ / __isub__ and a list of handlers to dispatch to. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Martin Matusiak > Sent: Wednesday, April 13, 2011 9:41 AM > To: Discussion of IronPython > Subject: Re: [IronPython] How to make a gtk event? > > I'm not talking about the handler, I'm talking about creating a new event for > this widget. As in: > > mywidget.SomethingHappened += some_handler > > 2011/4/13 Dino Viehland : > > Martin wrote: > >> Hey guys, > >> > >> I'm writing a program using using gtk# and I have a custom widget > >> that I want to make an event for. Here is what an event looks like: > >> > >> >>> print self.mainwindow.Shown > >> >> 0x000000000000002B > >> [IronPython.Runtime.Types.ReflectedEvent+BoundEvent]> > >> > >> So I seem to need to instantiate this type with my event name and > >> trigger function somehow as parameters, but I don't know how. Any > ideas? > > > > The BoundEvent object supports in place addition and subtraction for > > adding/removing the events and it'll accept any callable object on the > > right hand side. ?So you should just do > > += on shown, such as: > > > > def handler(sender, args): > > ? ?print('hello') > > > > self.mainwindow.shown += handler > > _______________________________________________ > > 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 loocas at duber.cz Wed Apr 13 18:59:18 2011 From: loocas at duber.cz (=?UTF-8?B?THVrw6HFoSBEdWLEm2Rh?=) Date: Wed, 13 Apr 2011 18:59:18 +0200 Subject: [IronPython] VS 2010 Integrated Shell question In-Reply-To: References: <4DA48BBB.4000708@duber.cz> Message-ID: <4DA5D666.4060201@duber.cz> Thanks Markus, for the explanation. So, basically, if I buy the VS 2010 Professional, I'll get both, the IronPython tools support as well as the ability to design WPF or WinForms applications? Thanks again, much appretiated, Luk?? Dub?da Director [T] +420 602 444 164 duber studio(tm) [M] info at duber.cz [W] http://www.duber.cz [A] R.A.Dvorsk?ho 601, Praha 10 [A] 10900, Czech Republic, Europe On 13.4.2011 9:41, Markus Schaber wrote: > Hi, Luk??, > > The restriction here is not within IronPython tools, but within Visual Studio Express. > > Microsoft released the free (as in "free beer") express editions with artificial restrictions. (My personal guess is that one reason is to prevent other free IDEs from gaining enough momentum that they can start rivaling the commercial editions, and another one is that their marketers can argument "there are powerful free development tools for .NET", so students etc. don't go to Java (Eclipse, Netbeans), or Linux.). > > One of those restrictions is that they only support one language (one cannot edit C# and VB projects in the same running instance, even when both editions are installed), another one is that no plugins are allowed. > > Those restrictions are meant to motivate "power users" (or any serious user) to buy the commercial versions. > > The "integrated Shell" is the unrestricted, but barebone framework / environment without any languages and plugins, they release it for free to 3rd party vendors (like IronPython tools, or Delphi Prism), to bind them to their framework and platform. > > Regards, > Markus >> -----Urspr?ngliche Nachricht----- >> Von: users-bounces at lists.ironpython.com [mailto:users- >> bounces at lists.ironpython.com] Im Auftrag von Luk?? Dubeda >> Gesendet: Dienstag, 12. April 2011 19:28 >> An: Discussion of IronPython >> Betreff: [IronPython] VS 2010 Integrated Shell question >> >> Hi there everyone, >> >> I have a, perhaps lame, question. >> >> I downloaded the VS 2010 Integrated Shell and installed the IronPython >> tools for it. >> >> However, does the VS 2010 IS have a WPF and WinForms designer? I can't >> seem to get it working. :( >> >> Also, the IPy tools are available only for the Integrated Shell and actual >> commercial versions of Visual Studio, is that right? >> >> I'm asking because I get both WPF and WinForms designers in the Visual >> Studio 2010 C# Express, but it's a pain to design my GUI in one package >> and write IPy code for it in another. >> >> Is there any solution for this? >> >> Thank you very much in advance, cheers, >> >> -- >> Luk?? Dub?da >> Director >> [T] +420 602 444 164 >> >> duber studio(tm) >> [M] info at duber.cz >> [W] http://www.duber.cz >> >> [A] R.A.Dvorsk?ho 601, Praha 10 >> [A] 10900, Czech Republic, Europe >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at microsoft.com Wed Apr 13 20:00:56 2011 From: dinov at microsoft.com (Dino Viehland) Date: Wed, 13 Apr 2011 18:00:56 +0000 Subject: [IronPython] VS 2010 Integrated Shell question In-Reply-To: <4DA5D666.4060201@duber.cz> References: <4DA48BBB.4000708@duber.cz> <4DA5D666.4060201@duber.cz> Message-ID: <6C7ABA8B4E309440B857D74348836F2E1504BB6E@TK5EX14MBXC133.redmond.corp.microsoft.com> Luk?? wrote: > Thanks Markus, for the explanation. > > So, basically, if I buy the VS 2010 Professional, I'll get both, the IronPython > tools support as well as the ability to design WPF or WinForms applications? There is no WinForm designer support in Python tools - we just have a simple template for creating a WinForms app but you'll have to write all of the UI code by hand. This is because the WinForms designer is actually very heavily built around round-tripping statically typed code to generate the UI. We did do this w/ IronPython 1.x in IronPythonStudio and someone could port this forward to IpyTools if they really wanted to - but it was very ugly and involved lots of decorators and other gunk to keep VS happy. I just tried the WPF support in the integrated shell and that does work - here's the screen shot to prove it: http://i.imgur.com/AWE62.png WPF is awesome in contrast to WinForms because everything's in the XAML and therefore we just need to add a little bit of integration to make the XAML load nicely in Python. There was the bug in Beta 1 of PTVS where the toolbox was broken in the WPF designer but this should just work with Beta 2 or if the original IpyTools. But either way VS Pro won't buy you much in terms of UI designer support. From loocas at duber.cz Wed Apr 13 20:42:16 2011 From: loocas at duber.cz (=?UTF-8?B?THVrw6HFoSBEdWLEm2Rh?=) Date: Wed, 13 Apr 2011 20:42:16 +0200 Subject: [IronPython] VS 2010 Integrated Shell question In-Reply-To: <6C7ABA8B4E309440B857D74348836F2E1504BB6E@TK5EX14MBXC133.redmond.corp.microsoft.com> References: <4DA48BBB.4000708@duber.cz> <4DA5D666.4060201@duber.cz> <6C7ABA8B4E309440B857D74348836F2E1504BB6E@TK5EX14MBXC133.redmond.corp.microsoft.com> Message-ID: <4DA5EE88.7070603@duber.cz> Hi Dino, thanks for the info. Now, I'm wondering, how did you get the WPF designer to work in the Integrated Shell version of VS? I don't seem to be able to get it working (basically after choosing the WPF IPy template to start with, nothing shows up). :( Thanks a lot in advance! Luk?? Dub?da Director [T] +420 602 444 164 duber studio(tm) [M] info at duber.cz [W] http://www.duber.cz [A] R.A.Dvorsk?ho 601, Praha 10 [A] 10900, Czech Republic, Europe On 13.4.2011 20:00, Dino Viehland wrote: > Luk?? wrote: >> Thanks Markus, for the explanation. >> >> So, basically, if I buy the VS 2010 Professional, I'll get both, the IronPython >> tools support as well as the ability to design WPF or WinForms applications? > > There is no WinForm designer support in Python tools - we just have a simple > template for creating a WinForms app but you'll have to write all of the UI code > by hand. This is because the WinForms designer is actually very heavily built > around round-tripping statically typed code to generate the UI. We did do this > w/ IronPython 1.x in IronPythonStudio and someone could port this forward to > IpyTools if they really wanted to - but it was very ugly and involved lots of > decorators and other gunk to keep VS happy. > > I just tried the WPF support in the integrated shell and that does work - here's > the screen shot to prove it: http://i.imgur.com/AWE62.png WPF is awesome in > contrast to WinForms because everything's in the XAML and therefore we just > need to add a little bit of integration to make the XAML load nicely in Python. > > There was the bug in Beta 1 of PTVS where the toolbox was broken in the WPF > designer but this should just work with Beta 2 or if the original IpyTools. But > either way VS Pro won't buy you much in terms of UI designer support. > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at microsoft.com Wed Apr 13 22:43:03 2011 From: dinov at microsoft.com (Dino Viehland) Date: Wed, 13 Apr 2011 20:43:03 +0000 Subject: [IronPython] VS 2010 Integrated Shell question In-Reply-To: <4DA5EE88.7070603@duber.cz> References: <4DA48BBB.4000708@duber.cz> <4DA5D666.4060201@duber.cz> <6C7ABA8B4E309440B857D74348836F2E1504BB6E@TK5EX14MBXC133.redmond.corp.microsoft.com> <4DA5EE88.7070603@duber.cz> Message-ID: <6C7ABA8B4E309440B857D74348836F2E1504BF82@TK5EX14MBXC133.redmond.corp.microsoft.com> Luk?? wrote: > Now, I'm wondering, how did you get the WPF designer to work in the > Integrated Shell version of VS? I don't seem to be able to get it working > (basically after choosing the WPF IPy template to start with, nothing shows > up). :( > I just did file->new project, selected the WPF project, and then double clicked on the XAML file in the new project to open the designer. From loocas at duber.cz Wed Apr 13 22:49:54 2011 From: loocas at duber.cz (=?UTF-8?B?THVrw6HFoSBEdWLEm2Rh?=) Date: Wed, 13 Apr 2011 22:49:54 +0200 Subject: [IronPython] VS 2010 Integrated Shell question In-Reply-To: <6C7ABA8B4E309440B857D74348836F2E1504BF82@TK5EX14MBXC133.redmond.corp.microsoft.com> References: <4DA48BBB.4000708@duber.cz> <4DA5D666.4060201@duber.cz> <6C7ABA8B4E309440B857D74348836F2E1504BB6E@TK5EX14MBXC133.redmond.corp.microsoft.com> <4DA5EE88.7070603@duber.cz> <6C7ABA8B4E309440B857D74348836F2E1504BF82@TK5EX14MBXC133.redmond.corp.microsoft.com> Message-ID: <4DA60C72.907@duber.cz> Ah, of course, I had the project explorer (or whatever is that area called) hidden and thus I wasn't able to select the XAML file. Sorry for this, it works now for me. Thank you very much, once again! :) Luk?? Dub?da Director [T] +420 602 444 164 duber studio(tm) [M] info at duber.cz [W] http://www.duber.cz [A] R.A.Dvorsk?ho 601, Praha 10 [A] 10900, Czech Republic, Europe On 13.4.2011 22:43, Dino Viehland wrote: > Luk?? wrote: >> Now, I'm wondering, how did you get the WPF designer to work in the >> Integrated Shell version of VS? I don't seem to be able to get it working >> (basically after choosing the WPF IPy template to start with, nothing shows >> up). :( >> > > I just did file->new project, selected the WPF project, and then double clicked > on the XAML file in the new project to open the designer. > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From haniti.grk at gmail.com Thu Apr 14 02:34:25 2011 From: haniti.grk at gmail.com (haniti grk) Date: Wed, 13 Apr 2011 19:34:25 -0500 Subject: [IronPython] Microsoft.Scripting.Shell no more? Message-ID: This was from http://www.ironpython.info/index.php/Simulating_thread.interrupt_main The code below is supposed to simulate thread.interrupt, but it seems like Microsoft.Scripting.Shell is not there any more... import clr > clr.AddReference('Microsoft.Scripting') > from Microsoft.Scripting.Shell import KeyboardInterruptException > from System import Threading > > main = Thread.CurrentThread > > main.Abort(KeyboardInterruptException("")) > Here is a dump from ipy console: >>> clr.AddReference('Microsoft.Scripting') > >>> import Microsoft.Scripting > >>> dir(Microsoft.Scripting) > ['ArgumentTypeException', 'AssemblyLoadedEventArgs', 'CompilerOptions', > 'ErrorCo > unter', 'ErrorSink', 'Generation', 'Hosting', 'IScopeVariable', > 'IndexSpan', 'In > validImplementationException', 'LanguageOptions', > 'ParamDictionaryAttribute', 'P > latformAdaptationLayer', 'Runtime', 'ScopeStorage', 'ScopeVariable', > 'ScopeVaria > bleIgnoreCase', 'ScriptCode', 'ScriptCodeParseResult', 'Severity', > 'SourceCodeKi > nd', 'SourceCodePropertiesUtils', 'SourceCodeReader', 'SourceLocation', > 'SourceS > pan', 'SourceUnit', 'StreamContentProvider', 'SyntaxErrorException', > 'TextConten > tProvider', 'TokenCategory', 'TokenInfo', 'TokenKind', 'TokenTriggers', > 'Utils'] > Can someone verify that this is the case? Or is there a way to raise an exception to the main thread using threading module? -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Thu Apr 14 02:42:17 2011 From: dinov at microsoft.com (Dino Viehland) Date: Thu, 14 Apr 2011 00:42:17 +0000 Subject: [IronPython] Microsoft.Scripting.Shell no more? In-Reply-To: References: Message-ID: <6C7ABA8B4E309440B857D74348836F2E1504C5F7@TK5EX14MBXC133.redmond.corp.microsoft.com> it looks like it moved to just Microsoft.Scripting namespace and is now in the Microsoft.Dynamic assembly instead of Microsoft.Scripting. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of haniti grk Sent: Wednesday, April 13, 2011 5:34 PM To: Discussion of IronPython Subject: [IronPython] Microsoft.Scripting.Shell no more? This was from http://www.ironpython.info/index.php/Simulating_thread.interrupt_main The code below is supposed to simulate thread.interrupt, but it seems like Microsoft.Scripting.Shell is not there any more... import clr clr.AddReference('Microsoft.Scripting') from Microsoft.Scripting.Shell import KeyboardInterruptException from System import Threading main = Thread.CurrentThread main.Abort(KeyboardInterruptException("")) Here is a dump from ipy console: >>> clr.AddReference('Microsoft.Scripting') >>> import Microsoft.Scripting >>> dir(Microsoft.Scripting) ['ArgumentTypeException', 'AssemblyLoadedEventArgs', 'CompilerOptions', 'ErrorCo unter', 'ErrorSink', 'Generation', 'Hosting', 'IScopeVariable', 'IndexSpan', 'In validImplementationException', 'LanguageOptions', 'ParamDictionaryAttribute', 'P latformAdaptationLayer', 'Runtime', 'ScopeStorage', 'ScopeVariable', 'ScopeVaria bleIgnoreCase', 'ScriptCode', 'ScriptCodeParseResult', 'Severity', 'SourceCodeKi nd', 'SourceCodePropertiesUtils', 'SourceCodeReader', 'SourceLocation', 'SourceS pan', 'SourceUnit', 'StreamContentProvider', 'SyntaxErrorException', 'TextConten tProvider', 'TokenCategory', 'TokenInfo', 'TokenKind', 'TokenTriggers', 'Utils'] Can someone verify that this is the case? Or is there a way to raise an exception to the main thread using threading module? -------------- next part -------------- An HTML attachment was scrubbed... URL: From chadbr at slb.com Thu Apr 14 07:14:15 2011 From: chadbr at slb.com (Chad Brockman) Date: Thu, 14 Apr 2011 05:14:15 +0000 Subject: [IronPython] IronPython for Silverlight 5? Message-ID: <6451C9079312284DA83CCE202D0E903B3542D476@NL0230MBX09N1.DIR.slb.com> I see Silverlight 5 now has something besides simple reflection (ICustomTypeProvider) - http://msdn.microsoft.com/en-us/library/gg986857(v=VS.96).aspx#data Will we see an update to Iron*/DLR to support binding to dynamic objects any time soon? This will open fantastic options for using IronPython in Silverlight. Thanks -- Chad Chad Brockman Production Solutions Architect chadbr at slb.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.schaber at 3s-software.com Thu Apr 14 08:16:08 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Thu, 14 Apr 2011 08:16:08 +0200 Subject: [IronPython] VS 2010 Integrated Shell question In-Reply-To: <4DA5D666.4060201@duber.cz> References: <4DA48BBB.4000708@duber.cz> <4DA5D666.4060201@duber.cz> Message-ID: Hi, Luk??, Yes. I did not try it with VS 2010 myself, but it is documented that way, and it was the same with the 2008 version where I tried the Express edition at home and the professional at work. Gr??e, Markus > -----Urspr?ngliche Nachricht----- > Von: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] Im Auftrag von Luk?? Dubeda > Gesendet: Mittwoch, 13. April 2011 18:59 > An: Discussion of IronPython > Betreff: Re: [IronPython] VS 2010 Integrated Shell question > > Thanks Markus, for the explanation. > > So, basically, if I buy the VS 2010 Professional, I'll get both, the > IronPython tools support as well as the ability to design WPF or WinForms > applications? > > Thanks again, much appretiated, > > Luk?? Dub?da > Director > [T] +420 602 444 164 > > duber studio(tm) > [M] info at duber.cz > [W] http://www.duber.cz > > [A] R.A.Dvorsk?ho 601, Praha 10 > [A] 10900, Czech Republic, Europe > > On 13.4.2011 9:41, Markus Schaber wrote: > > Hi, Luk??, > > > > The restriction here is not within IronPython tools, but within Visual > Studio Express. > > > > Microsoft released the free (as in "free beer") express editions with > artificial restrictions. (My personal guess is that one reason is to > prevent other free IDEs from gaining enough momentum that they can start > rivaling the commercial editions, and another one is that their marketers > can argument "there are powerful free development tools for .NET", so > students etc. don't go to Java (Eclipse, Netbeans), or Linux.). > > > > One of those restrictions is that they only support one language (one > cannot edit C# and VB projects in the same running instance, even when > both editions are installed), another one is that no plugins are allowed. > > > > Those restrictions are meant to motivate "power users" (or any serious > user) to buy the commercial versions. > > > > The "integrated Shell" is the unrestricted, but barebone framework / > environment without any languages and plugins, they release it for free to > 3rd party vendors (like IronPython tools, or Delphi Prism), to bind them > to their framework and platform. > > > > Regards, > > Markus > >> -----Urspr?ngliche Nachricht----- > >> Von: users-bounces at lists.ironpython.com [mailto:users- > >> bounces at lists.ironpython.com] Im Auftrag von Luk?? Dubeda > >> Gesendet: Dienstag, 12. April 2011 19:28 > >> An: Discussion of IronPython > >> Betreff: [IronPython] VS 2010 Integrated Shell question > >> > >> Hi there everyone, > >> > >> I have a, perhaps lame, question. > >> > >> I downloaded the VS 2010 Integrated Shell and installed the > >> IronPython tools for it. > >> > >> However, does the VS 2010 IS have a WPF and WinForms designer? I > >> can't seem to get it working. :( > >> > >> Also, the IPy tools are available only for the Integrated Shell and > >> actual commercial versions of Visual Studio, is that right? > >> > >> I'm asking because I get both WPF and WinForms designers in the > >> Visual Studio 2010 C# Express, but it's a pain to design my GUI in > >> one package and write IPy code for it in another. > >> > >> Is there any solution for this? > >> > >> Thank you very much in advance, cheers, > >> > >> -- > >> Luk?? Dub?da > >> Director > >> [T] +420 602 444 164 > >> > >> duber studio(tm) > >> [M] info at duber.cz > >> [W] http://www.duber.cz > >> > >> [A] R.A.Dvorsk?ho 601, Praha 10 > >> [A] 10900, Czech Republic, Europe > >> _______________________________________________ > >> 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 lady_radsu at yahoo.com Thu Apr 14 09:02:32 2011 From: lady_radsu at yahoo.com (surangika ranathunga) Date: Thu, 14 Apr 2011 00:02:32 -0700 (PDT) Subject: [IronPython] how to generate multiple concurrent scriptign engines? Message-ID: <876088.67328.qm@web110213.mail.gq1.yahoo.com> Hi, I am using Ironpython to connect to a legacy python code from C#. I am not fully familiar with Ironpython, but managed to get it working for a single-threaded application. This is how I implemented this: ??????????????? ScriptEngine engine = Python.CreateEngine(); ??????????????? ScriptRuntime runtime = engine.Runtime; ??????????????? ScriptScope scope = runtime.CreateScope(); ??????????????? ops = engine.Operations; ??????????????? ScriptSource source = engine.CreateScriptSourceFromFile("ironpython.py"); ??????????????? source.Execute(scope); ??????????????? string class_param = rule; ??????????????? object[] parameters = new object[1]; ??????????????? parameters[0] = class_param; ??????????????? object klass = scope.GetVariable("model_checker"); ??????????????? object instance = ops.Invoke(klass, parameters); ??????????????? method = ops.GetMember(instance, "check_model"); Now I want to make my application multi-threaded, and I want to have concurrently running scripting engines. Essentially, these engines should access the same underlying python code, and hence these scripting engines are identical to each other. Without any change, the above code works fine for most of the time for a multi-threaded application. However, there is an exception that appears from time to time, and I suspect that it is due to a concurrency issue. Is there anything specific that I should do to generate multiple scripting engines running in separate threads without interfering with each other? any ideas greatly appreciated -------------- next part -------------- An HTML attachment was scrubbed... URL: From numerodix at gmail.com Thu Apr 14 10:57:23 2011 From: numerodix at gmail.com (Martin Matusiak) Date: Thu, 14 Apr 2011 10:57:23 +0200 Subject: [IronPython] How to make a gtk event? In-Reply-To: <6C7ABA8B4E309440B857D74348836F2E1504B913@TK5EX14MBXC133.redmond.corp.microsoft.com> References: <6C7ABA8B4E309440B857D74348836F2E1504B85E@TK5EX14MBXC133.redmond.corp.microsoft.com> <6C7ABA8B4E309440B857D74348836F2E1504B913@TK5EX14MBXC133.redmond.corp.microsoft.com> Message-ID: Yes, that works. But pedantically speaking, is it possible to manufacture an event that would agree on type with the gtk produced ones? I really don't know if this ever comes up but suppose at one point it needs to be interchangeable with a built in event? Martin 2011/4/13 Dino Viehland : > Oh, reading comprehension fail... ?as long as you don't want it statically declared > (e.g. it's only ever accessed from Python) then there's a sample pyevent.py in > the Tutorial which does this. It's just an object with __iadd__ / __isub__ and a > list of handlers to dispatch to. > >> -----Original Message----- >> From: users-bounces at lists.ironpython.com [mailto:users- >> bounces at lists.ironpython.com] On Behalf Of Martin Matusiak >> Sent: Wednesday, April 13, 2011 9:41 AM >> To: Discussion of IronPython >> Subject: Re: [IronPython] How to make a gtk event? >> >> I'm not talking about the handler, I'm talking about creating a new event for >> this widget. As in: >> >> mywidget.SomethingHappened += some_handler >> >> 2011/4/13 Dino Viehland : >> > Martin wrote: >> >> Hey guys, >> >> >> >> I'm writing a program using using gtk# and I have a custom widget >> >> that I want to make an event for. Here is what an event looks like: >> >> >> >> >>> print self.mainwindow.Shown >> >> > >> 0x000000000000002B >> >> [IronPython.Runtime.Types.ReflectedEvent+BoundEvent]> >> >> >> >> So I seem to need to instantiate this type with my event name and >> >> trigger function somehow as parameters, but I don't know how. Any >> ideas? >> > >> > The BoundEvent object supports in place addition and subtraction for >> > adding/removing the events and it'll accept any callable object on the >> > right hand side. ?So you should just do >> > += on shown, such as: >> > >> > def handler(sender, args): >> > ? ?print('hello') >> > >> > self.mainwindow.shown += handler >> > _______________________________________________ >> > 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 jdhardy at gmail.com Thu Apr 14 16:31:47 2011 From: jdhardy at gmail.com (Jeff Hardy) Date: Thu, 14 Apr 2011 08:31:47 -0600 Subject: [IronPython] IronPython for Silverlight 5? In-Reply-To: <6451C9079312284DA83CCE202D0E903B3542D476@NL0230MBX09N1.DIR.slb.com> References: <6451C9079312284DA83CCE202D0E903B3542D476@NL0230MBX09N1.DIR.slb.com> Message-ID: On Wed, Apr 13, 2011 at 11:14 PM, Chad Brockman wrote: > I see Silverlight 5 now has something besides simple reflection > (ICustomTypeProvider) - > > http://msdn.microsoft.com/en-us/library/gg986857(v=VS.96).aspx#data > > Will we see an update to Iron*/DLR to support binding to dynamic objects any > time soon? This will open fantastic options for using IronPython in > Silverlight. If someone provides a patch, yes. We actually need someone with an interest in Silverlight to keep an eye on it and make sure that we don't break SL support and new features like this. We don't have anyone in that role right now. - Jeff From jdhardy at gmail.com Thu Apr 14 16:35:53 2011 From: jdhardy at gmail.com (Jeff Hardy) Date: Thu, 14 Apr 2011 08:35:53 -0600 Subject: [IronPython] how to generate multiple concurrent scriptign engines? In-Reply-To: <876088.67328.qm@web110213.mail.gq1.yahoo.com> References: <876088.67328.qm@web110213.mail.gq1.yahoo.com> Message-ID: As long as you have a ScriptScope per thread, you should be able to share the ScriptEngine & Runtime between threads. What is the exception that you are getting? If it's a GUI program, remember that UI elements can only be manipulated from the main thread. - Jeff On Thu, Apr 14, 2011 at 1:02 AM, surangika ranathunga wrote: > > Hi, > I am using Ironpython to connect to a legacy python code from C#. > I am not fully familiar with Ironpython, but managed to get it working for a single-threaded application. > This is how I implemented this: > > ??????????????? ScriptEngine engine = Python.CreateEngine(); > ??????????????? ScriptRuntime runtime = engine.Runtime; > ??????????????? ScriptScope scope = runtime.CreateScope(); > ??????????????? ops = engine.Operations; > ??????????????? ScriptSource source = engine.CreateScriptSourceFromFile("ironpython.py"); > ??????????????? source.Execute(scope); > ??????????????? string class_param = rule; > ??????????????? object[] parameters = new object[1]; > ??????????????? parameters[0] = class_param; > ??????????????? object klass = scope.GetVariable("model_checker"); > ??????????????? object instance = ops.Invoke(klass, parameters); > ??????????????? method = ops.GetMember(instance, "check_model"); > > Now I want to make my application multi-threaded, and I want to have concurrently running scripting engines. Essentially, these engines should access the same underlying python code, and hence these scripting engines are identical to each other. > Without any change, the above code works fine for most of the time for a multi-threaded application. However, there is an exception that appears from time to time, and I suspect that it is due to a concurrency issue. > > Is there anything specific that I should do to generate multiple scripting engines running in separate threads without interfering with each other? > > any ideas greatly appreciated > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From rome at Wintellect.com Thu Apr 14 18:15:10 2011 From: rome at Wintellect.com (Keith Rome) Date: Thu, 14 Apr 2011 09:15:10 -0700 Subject: [IronPython] IronPython for Silverlight 5? In-Reply-To: References: <6451C9079312284DA83CCE202D0E903B3542D476@NL0230MBX09N1.DIR.slb.com> Message-ID: <7737799D90E55E4BB9C9F7E40D161E1108D4A95758@VA3DIAXVS461.RED001.local> The logical thing would seem to be adding ICustomTypeProvider to ExpandoObject or DynamicObject, but these are both in System.Core so more or less out of our hands. Or has the Silverlight team extended those classes to support this new interface (I haven't pulled down the SL5 bits to check)? And it begs the question of why did the Silverlight team feel we need yet another (incompatible) custom type info implementation? Keith Rome Senior Consultant and Architect MCPD-EAD, MCSD, MCDBA, MCTS-WPF, MCTS-TFS, MCTS-WSS Wintellect | 770.617.4016 | krome at wintellect.com www.wintellect.com -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jeff Hardy Sent: Thursday, April 14, 2011 10:32 AM To: Discussion of IronPython Cc: Chad Brockman Subject: Re: [IronPython] IronPython for Silverlight 5? On Wed, Apr 13, 2011 at 11:14 PM, Chad Brockman wrote: > I see Silverlight 5 now has something besides simple reflection > (ICustomTypeProvider) - > > http://msdn.microsoft.com/en-us/library/gg986857(v=VS.96).aspx#data > > Will we see an update to Iron*/DLR to support binding to dynamic > objects any time soon? This will open fantastic options for using > IronPython in Silverlight. If someone provides a patch, yes. We actually need someone with an interest in Silverlight to keep an eye on it and make sure that we don't break SL support and new features like this. We don't have anyone in that role right now. - Jeff _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at microsoft.com Thu Apr 14 19:03:21 2011 From: dinov at microsoft.com (Dino Viehland) Date: Thu, 14 Apr 2011 17:03:21 +0000 Subject: [IronPython] IronPython for Silverlight 5? In-Reply-To: References: <6451C9079312284DA83CCE202D0E903B3542D476@NL0230MBX09N1.DIR.slb.com> Message-ID: <6C7ABA8B4E309440B857D74348836F2E1504D547@TK5EX14MBXC133.redmond.corp.microsoft.com> Jeff wrote: > On Wed, Apr 13, 2011 at 11:14 PM, Chad Brockman > wrote: > > I see Silverlight 5 now has something besides simple reflection > > (ICustomTypeProvider) - > > > > http://msdn.microsoft.com/en-us/library/gg986857(v=VS.96).aspx#data > > > > Will we see an update to Iron*/DLR to support binding to dynamic > > objects any time soon? This will open fantastic options for using > > IronPython in Silverlight. > > If someone provides a patch, yes. > > We actually need someone with an interest in Silverlight to keep an eye on it > and make sure that we don't break SL support and new features like this. We > don't have anyone in that role right now. If anyone's interested on working on this it'd probably mean adding an implementation of this onto OldInstance as well as adding it onto our new-style instances whose classes are created by NewTypeMaker. Adding the interface is probably pretty easy, making it return useful things may be a little more difficult. I'm a little surprised they didn't go with the already existing ICustomTypeDescriptor. From dinov at microsoft.com Thu Apr 14 19:05:39 2011 From: dinov at microsoft.com (Dino Viehland) Date: Thu, 14 Apr 2011 17:05:39 +0000 Subject: [IronPython] How to make a gtk event? In-Reply-To: References: <6C7ABA8B4E309440B857D74348836F2E1504B85E@TK5EX14MBXC133.redmond.corp.microsoft.com> <6C7ABA8B4E309440B857D74348836F2E1504B913@TK5EX14MBXC133.redmond.corp.microsoft.com> Message-ID: <6C7ABA8B4E309440B857D74348836F2E1504D599@TK5EX14MBXC133.redmond.corp.microsoft.com> Unless GTK has some event class of its own my guess is the answer is no. But if it doesn't have an event class of its own then it probably doesn't matter as I'd think it would never consume your events - only other Python code would. > -----Original Message----- > From: Martin Matusiak [mailto:numerodix at gmail.com] > Sent: Thursday, April 14, 2011 1:57 AM > To: Discussion of IronPython > Cc: Dino Viehland > Subject: Re: [IronPython] How to make a gtk event? > > Yes, that works. But pedantically speaking, is it possible to manufacture an > event that would agree on type with the gtk produced ones? I really don't > know if this ever comes up but suppose at one point it needs to be > interchangeable with a built in event? > > > Martin > > 2011/4/13 Dino Viehland : > > Oh, reading comprehension fail... ?as long as you don't want it > > statically declared (e.g. it's only ever accessed from Python) then > > there's a sample pyevent.py in the Tutorial which does this. It's just > > an object with __iadd__ / __isub__ and a list of handlers to dispatch to. > > > >> -----Original Message----- > >> From: users-bounces at lists.ironpython.com [mailto:users- > >> bounces at lists.ironpython.com] On Behalf Of Martin Matusiak > >> Sent: Wednesday, April 13, 2011 9:41 AM > >> To: Discussion of IronPython > >> Subject: Re: [IronPython] How to make a gtk event? > >> > >> I'm not talking about the handler, I'm talking about creating a new > >> event for this widget. As in: > >> > >> mywidget.SomethingHappened += some_handler > >> > >> 2011/4/13 Dino Viehland : > >> > Martin wrote: > >> >> Hey guys, > >> >> > >> >> I'm writing a program using using gtk# and I have a custom widget > >> >> that I want to make an event for. Here is what an event looks like: > >> >> > >> >> >>> print self.mainwindow.Shown > >> >> >> >> 0x000000000000002B > >> >> [IronPython.Runtime.Types.ReflectedEvent+BoundEvent]> > >> >> > >> >> So I seem to need to instantiate this type with my event name and > >> >> trigger function somehow as parameters, but I don't know how. Any > >> ideas? > >> > > >> > The BoundEvent object supports in place addition and subtraction > >> > for adding/removing the events and it'll accept any callable object > >> > on the right hand side. ?So you should just do > >> > += on shown, such as: > >> > > >> > def handler(sender, args): > >> > ? ?print('hello') > >> > > >> > self.mainwindow.shown += handler > >> > _______________________________________________ > >> > 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 jdhardy at gmail.com Thu Apr 14 22:10:38 2011 From: jdhardy at gmail.com (Jeff Hardy) Date: Thu, 14 Apr 2011 14:10:38 -0600 Subject: [IronPython] IronPython for Silverlight 5? In-Reply-To: <6C7ABA8B4E309440B857D74348836F2E1504D547@TK5EX14MBXC133.redmond.corp.microsoft.com> References: <6451C9079312284DA83CCE202D0E903B3542D476@NL0230MBX09N1.DIR.slb.com> <6C7ABA8B4E309440B857D74348836F2E1504D547@TK5EX14MBXC133.redmond.corp.microsoft.com> Message-ID: On Thu, Apr 14, 2011 at 11:03 AM, Dino Viehland wrote: > Jeff wrote: >> On Wed, Apr 13, 2011 at 11:14 PM, Chad Brockman >> wrote: >> > I see Silverlight 5 now has something besides simple reflection >> > (ICustomTypeProvider) - >> > >> > http://msdn.microsoft.com/en-us/library/gg986857(v=VS.96).aspx#data >> > >> > Will we see an update to Iron*/DLR to support binding to dynamic >> > objects any time soon? This will open fantastic options for using >> > IronPython in Silverlight. >> >> If someone provides a patch, yes. >> >> We actually need someone with an interest in Silverlight to keep an eye on it >> and make sure that we don't break SL support and new features like this. We >> don't have anyone in that role right now. > > If anyone's interested on working on this it'd probably mean adding an implementation > of this onto OldInstance as well as adding it onto our new-style instances whose > classes are created by NewTypeMaker. ?Adding the interface is probably pretty easy, > making it return useful things may be a little more difficult. > > I'm a little surprised they didn't go with the already existing ICustomTypeDescriptor. Are you really surprised? :) It is still in Beta. Maybe there's a slight chance their minds could be changed? I'm guessing they don't have the rest of System.ComponentModel either, so they didn't want to add just one interface. - Jeff From rome at Wintellect.com Fri Apr 15 00:29:33 2011 From: rome at Wintellect.com (Keith Rome) Date: Thu, 14 Apr 2011 15:29:33 -0700 Subject: [IronPython] IronPython for Silverlight 5? In-Reply-To: References: <6451C9079312284DA83CCE202D0E903B3542D476@NL0230MBX09N1.DIR.slb.com> <6C7ABA8B4E309440B857D74348836F2E1504D547@TK5EX14MBXC133.redmond.corp.microsoft.com> Message-ID: <7737799D90E55E4BB9C9F7E40D161E1108D4A95875@VA3DIAXVS461.RED001.local> After looking into what it takes to implement ICustomTypeProvider it seems like it would be a nightmare for dynamic object support. You have to produce actual custom Type instances, presumably using TypeBuilder and emitting IL opcodes to handle the getter/setter accessors. If the databinding system caches those dynamically-created Types then it could cause problems because what happens when we add a new member via expando after binding once (or remove one that previously existed)? But if they don't cache the Type objects then it seems like the overhead might be absurd from constructing these things again and again (and you can't use TypeBuilder without first creating a dynamic assembly and module). I really hope they alter course and go with ICustomTypeDescriptor instead (or even IDynamicMetaObjectProvider if that is feasible). I really don't understand how they expect the current system to work for "dynamic properties" because there is nothing dynamic at all about a System.Type instance. The best it can hope to be is a snapshot of the metadata from a dynamic object as of some point in time. Keith Rome Senior Consultant and Architect MCPD-EAD, MCSD, MCDBA, MCTS-WPF, MCTS-TFS, MCTS-WSS Wintellect | 770.617.4016 | krome at wintellect.com www.wintellect.com -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jeff Hardy Sent: Thursday, April 14, 2011 4:11 PM To: Discussion of IronPython Cc: Chad Brockman Subject: Re: [IronPython] IronPython for Silverlight 5? On Thu, Apr 14, 2011 at 11:03 AM, Dino Viehland wrote: > Jeff wrote: >> On Wed, Apr 13, 2011 at 11:14 PM, Chad Brockman >> wrote: >> > I see Silverlight 5 now has something besides simple reflection >> > (ICustomTypeProvider) - >> > >> > http://msdn.microsoft.com/en-us/library/gg986857(v=VS.96).aspx#data >> > >> > Will we see an update to Iron*/DLR to support binding to dynamic >> > objects any time soon? This will open fantastic options for using >> > IronPython in Silverlight. >> >> If someone provides a patch, yes. >> >> We actually need someone with an interest in Silverlight to keep an >> eye on it and make sure that we don't break SL support and new >> features like this. We don't have anyone in that role right now. > > If anyone's interested on working on this it'd probably mean adding an > implementation of this onto OldInstance as well as adding it onto our > new-style instances whose classes are created by NewTypeMaker. ?Adding > the interface is probably pretty easy, making it return useful things may be a little more difficult. > > I'm a little surprised they didn't go with the already existing ICustomTypeDescriptor. Are you really surprised? :) It is still in Beta. Maybe there's a slight chance their minds could be changed? I'm guessing they don't have the rest of System.ComponentModel either, so they didn't want to add just one interface. - Jeff _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From Tomas.Matousek at microsoft.com Fri Apr 15 00:49:29 2011 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Thu, 14 Apr 2011 22:49:29 +0000 Subject: [IronPython] IronPython for Silverlight 5? In-Reply-To: <7737799D90E55E4BB9C9F7E40D161E1108D4A95875@VA3DIAXVS461.RED001.local> References: <6451C9079312284DA83CCE202D0E903B3542D476@NL0230MBX09N1.DIR.slb.com> <6C7ABA8B4E309440B857D74348836F2E1504D547@TK5EX14MBXC133.redmond.corp.microsoft.com> <7737799D90E55E4BB9C9F7E40D161E1108D4A95875@VA3DIAXVS461.RED001.local> Message-ID: <9597F4A19BFDB342B6E90963100C3308244BE7@SN2PRD0302MB113.namprd03.prod.outlook.com> Couldn't you just subclass Type? It's methods are virtual and can be overridden. I don't think you need to emit a real RuntimeType. Tomas -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Keith Rome Sent: Thursday, April 14, 2011 3:30 PM To: Discussion of IronPython Subject: Re: [IronPython] IronPython for Silverlight 5? After looking into what it takes to implement ICustomTypeProvider it seems like it would be a nightmare for dynamic object support. You have to produce actual custom Type instances, presumably using TypeBuilder and emitting IL opcodes to handle the getter/setter accessors. If the databinding system caches those dynamically-created Types then it could cause problems because what happens when we add a new member via expando after binding once (or remove one that previously existed)? But if they don't cache the Type objects then it seems like the overhead might be absurd from constructing these things again and again (and you can't use TypeBuilder without first creating a dynamic assembly and module). I really hope they alter course and go with ICustomTypeDescriptor instead (or even IDynamicMetaObjectProvider if that is feasible). I really don't understand how they expect the current system to work for "dynamic properties" because there is nothing dynamic at all about a System.Type instance. The best it can hope to be is a snapshot of the metadata from a dynamic object as of some point in time. Keith Rome Senior Consultant and Architect MCPD-EAD, MCSD, MCDBA, MCTS-WPF, MCTS-TFS, MCTS-WSS Wintellect | 770.617.4016 | krome at wintellect.com www.wintellect.com -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jeff Hardy Sent: Thursday, April 14, 2011 4:11 PM To: Discussion of IronPython Cc: Chad Brockman Subject: Re: [IronPython] IronPython for Silverlight 5? On Thu, Apr 14, 2011 at 11:03 AM, Dino Viehland wrote: > Jeff wrote: >> On Wed, Apr 13, 2011 at 11:14 PM, Chad Brockman >> wrote: >> > I see Silverlight 5 now has something besides simple reflection >> > (ICustomTypeProvider) - >> > >> > http://msdn.microsoft.com/en-us/library/gg986857(v=VS.96).aspx#data >> > >> > Will we see an update to Iron*/DLR to support binding to dynamic >> > objects any time soon? This will open fantastic options for using >> > IronPython in Silverlight. >> >> If someone provides a patch, yes. >> >> We actually need someone with an interest in Silverlight to keep an >> eye on it and make sure that we don't break SL support and new >> features like this. We don't have anyone in that role right now. > > If anyone's interested on working on this it'd probably mean adding an > implementation of this onto OldInstance as well as adding it onto our > new-style instances whose classes are created by NewTypeMaker. ?Adding > the interface is probably pretty easy, making it return useful things may be a little more difficult. > > I'm a little surprised they didn't go with the already existing ICustomTypeDescriptor. Are you really surprised? :) It is still in Beta. Maybe there's a slight chance their minds could be changed? I'm guessing they don't have the rest of System.ComponentModel either, so they didn't want to add just one interface. - 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 rome at Wintellect.com Fri Apr 15 01:14:55 2011 From: rome at Wintellect.com (Keith Rome) Date: Thu, 14 Apr 2011 16:14:55 -0700 Subject: [IronPython] IronPython for Silverlight 5? In-Reply-To: <9597F4A19BFDB342B6E90963100C3308244BE7@SN2PRD0302MB113.namprd03.prod.outlook.com> References: <6451C9079312284DA83CCE202D0E903B3542D476@NL0230MBX09N1.DIR.slb.com> <6C7ABA8B4E309440B857D74348836F2E1504D547@TK5EX14MBXC133.redmond.corp.microsoft.com> <7737799D90E55E4BB9C9F7E40D161E1108D4A95875@VA3DIAXVS461.RED001.local> <9597F4A19BFDB342B6E90963100C3308244BE7@SN2PRD0302MB113.namprd03.prod.outlook.com> Message-ID: <2C742390-4ADB-4C07-9429-474E10638C30@wintellect.com> The docs for System.Type claims that you cannot subclass from it in Silverlight. Is this being relaxed in v5? Keith Rome Senior Consultant and Architect MCPD-EAD, MCSD, MCDBA, MCTS-WPF, MCTS-TFS, MCTS-WSS Wintellect | 770.617.4016 | krome at wintellect.com www.wintellect.com On Apr 14, 2011, at 6:49 PM, "Tomas Matousek" wrote: > Couldn't you just subclass Type? It's methods are virtual and can be overridden. I don't think you need to emit a real RuntimeType. > > Tomas > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Keith Rome > Sent: Thursday, April 14, 2011 3:30 PM > To: Discussion of IronPython > Subject: Re: [IronPython] IronPython for Silverlight 5? > > After looking into what it takes to implement ICustomTypeProvider it seems like it would be a nightmare for dynamic object support. You have to produce actual custom Type instances, presumably using TypeBuilder and emitting IL opcodes to handle the getter/setter accessors. If the databinding system caches those dynamically-created Types then it could cause problems because what happens when we add a new member via expando after binding once (or remove one that previously existed)? But if they don't cache the Type objects then it seems like the overhead might be absurd from constructing these things again and again (and you can't use TypeBuilder without first creating a dynamic assembly and module). > > I really hope they alter course and go with ICustomTypeDescriptor instead (or even IDynamicMetaObjectProvider if that is feasible). I really don't understand how they expect the current system to work for "dynamic properties" because there is nothing dynamic at all about a System.Type instance. The best it can hope to be is a snapshot of the metadata from a dynamic object as of some point in time. > > > Keith Rome > Senior Consultant and Architect > MCPD-EAD, MCSD, MCDBA, MCTS-WPF, MCTS-TFS, MCTS-WSS Wintellect | 770.617.4016 | krome at wintellect.com www.wintellect.com > > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jeff Hardy > Sent: Thursday, April 14, 2011 4:11 PM > To: Discussion of IronPython > Cc: Chad Brockman > Subject: Re: [IronPython] IronPython for Silverlight 5? > > On Thu, Apr 14, 2011 at 11:03 AM, Dino Viehland wrote: >> Jeff wrote: >>> On Wed, Apr 13, 2011 at 11:14 PM, Chad Brockman >>> wrote: >>>> I see Silverlight 5 now has something besides simple reflection >>>> (ICustomTypeProvider) - >>>> >>>> http://msdn.microsoft.com/en-us/library/gg986857(v=VS.96).aspx#data >>>> >>>> Will we see an update to Iron*/DLR to support binding to dynamic >>>> objects any time soon? This will open fantastic options for using >>>> IronPython in Silverlight. >>> >>> If someone provides a patch, yes. >>> >>> We actually need someone with an interest in Silverlight to keep an >>> eye on it and make sure that we don't break SL support and new >>> features like this. We don't have anyone in that role right now. >> >> If anyone's interested on working on this it'd probably mean adding an >> implementation of this onto OldInstance as well as adding it onto our >> new-style instances whose classes are created by NewTypeMaker. Adding >> the interface is probably pretty easy, making it return useful things may be a little more difficult. >> >> I'm a little surprised they didn't go with the already existing ICustomTypeDescriptor. > > Are you really surprised? :) > > It is still in Beta. Maybe there's a slight chance their minds could be changed? I'm guessing they don't have the rest of System.ComponentModel either, so they didn't want to add just one interface. > > - 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 > > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From Tomas.Matousek at microsoft.com Fri Apr 15 01:21:24 2011 From: Tomas.Matousek at microsoft.com (Tomas Matousek) Date: Thu, 14 Apr 2011 23:21:24 +0000 Subject: [IronPython] IronPython for Silverlight 5? In-Reply-To: <2C742390-4ADB-4C07-9429-474E10638C30@wintellect.com> References: <6451C9079312284DA83CCE202D0E903B3542D476@NL0230MBX09N1.DIR.slb.com> <6C7ABA8B4E309440B857D74348836F2E1504D547@TK5EX14MBXC133.redmond.corp.microsoft.com> <7737799D90E55E4BB9C9F7E40D161E1108D4A95875@VA3DIAXVS461.RED001.local> <9597F4A19BFDB342B6E90963100C3308244BE7@SN2PRD0302MB113.namprd03.prod.outlook.com> <2C742390-4ADB-4C07-9429-474E10638C30@wintellect.com> Message-ID: <9597F4A19BFDB342B6E90963100C3308244C4A@SN2PRD0302MB113.namprd03.prod.outlook.com> I think this should be possible in SL4 already: public abstract class Type : MemberInfo, _Type, IReflect { [SecuritySafeCritical] internal protected Type(); } There seems to be nothing that would prevent from doing so. Tomas -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Keith Rome Sent: Thursday, April 14, 2011 4:15 PM To: Discussion of IronPython Cc: Discussion of IronPython Subject: Re: [IronPython] IronPython for Silverlight 5? The docs for System.Type claims that you cannot subclass from it in Silverlight. Is this being relaxed in v5? Keith Rome Senior Consultant and Architect MCPD-EAD, MCSD, MCDBA, MCTS-WPF, MCTS-TFS, MCTS-WSS Wintellect | 770.617.4016 | krome at wintellect.com www.wintellect.com On Apr 14, 2011, at 6:49 PM, "Tomas Matousek" wrote: > Couldn't you just subclass Type? It's methods are virtual and can be overridden. I don't think you need to emit a real RuntimeType. > > Tomas > > -----Original Message----- > From: users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] On Behalf Of Keith Rome > Sent: Thursday, April 14, 2011 3:30 PM > To: Discussion of IronPython > Subject: Re: [IronPython] IronPython for Silverlight 5? > > After looking into what it takes to implement ICustomTypeProvider it seems like it would be a nightmare for dynamic object support. You have to produce actual custom Type instances, presumably using TypeBuilder and emitting IL opcodes to handle the getter/setter accessors. If the databinding system caches those dynamically-created Types then it could cause problems because what happens when we add a new member via expando after binding once (or remove one that previously existed)? But if they don't cache the Type objects then it seems like the overhead might be absurd from constructing these things again and again (and you can't use TypeBuilder without first creating a dynamic assembly and module). > > I really hope they alter course and go with ICustomTypeDescriptor instead (or even IDynamicMetaObjectProvider if that is feasible). I really don't understand how they expect the current system to work for "dynamic properties" because there is nothing dynamic at all about a System.Type instance. The best it can hope to be is a snapshot of the metadata from a dynamic object as of some point in time. > > > Keith Rome > Senior Consultant and Architect > MCPD-EAD, MCSD, MCDBA, MCTS-WPF, MCTS-TFS, MCTS-WSS Wintellect | > 770.617.4016 | krome at wintellect.com www.wintellect.com > > > -----Original Message----- > From: users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jeff Hardy > Sent: Thursday, April 14, 2011 4:11 PM > To: Discussion of IronPython > Cc: Chad Brockman > Subject: Re: [IronPython] IronPython for Silverlight 5? > > On Thu, Apr 14, 2011 at 11:03 AM, Dino Viehland wrote: >> Jeff wrote: >>> On Wed, Apr 13, 2011 at 11:14 PM, Chad Brockman >>> wrote: >>>> I see Silverlight 5 now has something besides simple reflection >>>> (ICustomTypeProvider) - >>>> >>>> http://msdn.microsoft.com/en-us/library/gg986857(v=VS.96).aspx#data >>>> >>>> Will we see an update to Iron*/DLR to support binding to dynamic >>>> objects any time soon? This will open fantastic options for using >>>> IronPython in Silverlight. >>> >>> If someone provides a patch, yes. >>> >>> We actually need someone with an interest in Silverlight to keep an >>> eye on it and make sure that we don't break SL support and new >>> features like this. We don't have anyone in that role right now. >> >> If anyone's interested on working on this it'd probably mean adding >> an implementation of this onto OldInstance as well as adding it onto >> our new-style instances whose classes are created by NewTypeMaker. >> Adding the interface is probably pretty easy, making it return useful things may be a little more difficult. >> >> I'm a little surprised they didn't go with the already existing ICustomTypeDescriptor. > > Are you really surprised? :) > > It is still in Beta. Maybe there's a slight chance their minds could be changed? I'm guessing they don't have the rest of System.ComponentModel either, so they didn't want to add just one interface. > > - 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 > > > > > _______________________________________________ > 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 lady_radsu at yahoo.com Fri Apr 15 05:18:30 2011 From: lady_radsu at yahoo.com (surangika ranathunga) Date: Thu, 14 Apr 2011 20:18:30 -0700 (PDT) Subject: [IronPython] how to generate multiple concurrent scriptign engines? In-Reply-To: Message-ID: <337612.2195.qm@web110210.mail.gq1.yahoo.com> Hi, Below is the exception I receive: here, D:\PhD Work\Research\libomv\test\MonitorService\MonitorService\ExpectationMonitor.cs:line 88 refers to source.Execute(scope); in the below given code. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceExce ption: Object reference not set to an instance of an object. ?? at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) ?? at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value) ?? at IronPython.Runtime.PythonContext.GetEqualSite(Type type) ?? at IronPython.Runtime.CommonDictionaryStorage.UpdateHelperFunctions(Type t, Object key) ?? at IronPython.Runtime.CommonDictionaryStorage.AddNoLock(Object key, Object value) ?? at IronPython.Runtime.CommonDictionaryStorage.Add(Object key, Object value) ?? at IronPython.Runtime.PythonDictionary.SetItem(Object key, Object value) ?? at IronPython.Runtime.PythonDictionary.set_Item(Object key, Object value) ?? at IronPython.Modules.PythonCopyReg.PerformModuleReload(PythonContext context, PythonDictionary dict) ?? --- End of inner exception stack trace --- ?? at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) ?? at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) ?? at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) ?? at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) ?? at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) ?? at IronPython.Runtime.PythonContext.CreateBuiltinModule(String moduleName, Type type, ModuleOptions options) ?? at IronPython.Runtime.PythonContext.CreateBuiltinModule(String moduleName, Type type) ?? at IronPython.Runtime.PythonContext.CreateBuiltinModule(String name) ?? at IronPython.Runtime.PythonContext.GetBuiltinModule(String name) ?? at IronPython.Runtime.Importer.ImportBuiltin(CodeContext context, String name) ?? at IronPython.Modules.PythonCopyReg.EnsureModuleInitialized(CodeContext context) ?? at IronPython.Modules.PythonCopyReg.GetDispatchTable(CodeContext context) ?? at IronPython.Modules.PythonRegex.PerformModuleReload(PythonContext context,PythonDictionary dict) ?? --- End of inner exception stack trace --- ?? at Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call(Object[] args, Boolean& shouldOptimize) ?? at IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`5.Call4(CallSite site, CodeContext context, TFuncType func, T0 arg0, T1 arg1, T2 arg2, T3 arg3) ?? at System.Dynamic.UpdateDelegates.UpdateAndExecute6[T0,T1,T2,T3,T4,T5,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) ?? at IronPython.Runtime.Importer.Import(CodeContext context, String fullName, PythonTuple from, Int32 level) ?? at IronPython.Runtime.Operations.PythonOps.ImportTop(CodeContext context, String fullName, Int32 level) ?? at Microsoft.Scripting.Interpreter.FuncCallInstruction`4.Run(InterpretedFrame frame) ?? at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) ?? at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1) ?? at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx) ?? at IronPython.Compiler.PythonScriptCode.Run(Scope scope) ?? at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope) ?? at IronPython.Compiler.RuntimeScriptCode.Run(Scope scope) ?? at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink errorSink) ?? at Microsoft.Scripting.SourceUnit.Execute(Scope scope) ?? at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope) ?? at MonitorService.ExpectationMonitor.Initialize(String rule) in D:\PhD Work\Research\libomv\test\MonitorService\MonitorService\ExpectationMonitor.cs:line 88 --- On Thu, 14/4/11, Jeff Hardy wrote: From: Jeff Hardy Subject: Re: [IronPython] how to generate multiple concurrent scriptign engines? To: "Discussion of IronPython" Cc: "surangika ranathunga" Received: Thursday, 14 April, 2011, 7:35 AM As long as you have a ScriptScope per thread, you should be able to share the ScriptEngine & Runtime between threads. What is the exception that you are getting? If it's a GUI program, remember that UI elements can only be manipulated from the main thread. - Jeff On Thu, Apr 14, 2011 at 1:02 AM, surangika ranathunga wrote: > > Hi, > I am using Ironpython to connect to a legacy python code from C#. > I am not fully familiar with Ironpython, but managed to get it working for a single-threaded application. > This is how I implemented this: > > ??????????????? ScriptEngine engine = Python.CreateEngine(); > ??????????????? ScriptRuntime runtime = engine.Runtime; > ??????????????? ScriptScope scope = runtime.CreateScope(); > ??????????????? ops = engine.Operations; > ??????????????? ScriptSource source = engine.CreateScriptSourceFromFile("ironpython.py"); > ??????????????? source.Execute(scope); > ??????????????? string class_param = rule; > ??????????????? object[] parameters = new object[1]; > ??????????????? parameters[0] = class_param; > ??????????????? object klass = scope.GetVariable("model_checker"); > ??????????????? object instance = ops.Invoke(klass, parameters); > ??????????????? method = ops.GetMember(instance, "check_model"); > > Now I want to make my application multi-threaded, and I want to have concurrently running scripting engines. Essentially, these engines should access the same underlying python code, and hence these scripting engines are identical to each other. > Without any change, the above code works fine for most of the time for a multi-threaded application. However, there is an exception that appears from time to time, and I suspect that it is due to a concurrency issue. > > Is there anything specific that I should do to generate multiple scripting engines running in separate threads without interfering with each other? > > any ideas greatly appreciated > > _______________________________________________ > 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 Fri Apr 15 16:28:50 2011 From: jdhardy at gmail.com (Jeff Hardy) Date: Fri, 15 Apr 2011 08:28:50 -0600 Subject: [IronPython] how to generate multiple concurrent scriptign engines? In-Reply-To: <337612.2195.qm@web110210.mail.gq1.yahoo.com> References: <337612.2195.qm@web110210.mail.gq1.yahoo.com> Message-ID: Any chance you can share what the source is? The exception comes from PythonCopyReg's initialization, which means we might have a bug (it might not be thread-safe, or something else). If you could create a minimal sample that has the issue that would be even better. - Jeff On Thu, Apr 14, 2011 at 9:18 PM, surangika ranathunga wrote: > Hi, > Below is the exception I receive: > here, D:\PhD > Work\Research\libomv\test\MonitorService\MonitorService\ExpectationMonitor.cs:line > 88 refers to source.Execute(scope); in the below given code. > > System.Reflection.TargetInvocationException: Exception has been thrown by > the target of an invocation. ---> > System.Reflection.TargetInvocationException: Exception has been thrown by > the target of an invocation. ---> System.NullReferenceExce > ption: Object reference not set to an instance of an object. > at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue > value, Boolean add) > at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue > value) > at IronPython.Runtime.PythonContext.GetEqualSite(Type type) > at IronPython.Runtime.CommonDictionaryStorage.UpdateHelperFunctions(Type > t, Object key) > at IronPython.Runtime.CommonDictionaryStorage.AddNoLock(Object key, > Object value) > at IronPython.Runtime.CommonDictionaryStorage.Add(Object key, Object > value) > at IronPython.Runtime.PythonDictionary.SetItem(Object key, Object value) > at IronPython.Runtime.PythonDictionary.set_Item(Object key, Object > value) > at IronPython.Modules.PythonCopyReg.PerformModuleReload(PythonContext > context, PythonDictionary dict) > --- End of inner exception stack trace --- > at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo > method, Object target, Object[] arguments, SignatureStruct& sig, > MethodAttributes methodAttributes, RuntimeType typeOwner) > at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo > method, Object target, Object[] arguments, Signature sig, MethodAttributes > methodAttributes, RuntimeType typeOwner) > at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags > invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean > skipVisibilityChecks) > at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags > invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) > at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) > at IronPython.Runtime.PythonContext.CreateBuiltinModule(String > moduleName, Type type, ModuleOptions options) > at IronPython.Runtime.PythonContext.CreateBuiltinModule(String > moduleName, Type type) > at IronPython.Runtime.PythonContext.CreateBuiltinModule(String name) > at IronPython.Runtime.PythonContext.GetBuiltinModule(String name) > at IronPython.Runtime.Importer.ImportBuiltin(CodeContext context, String > name) > at IronPython.Modules.PythonCopyReg.EnsureModuleInitialized(CodeContext > context) > at IronPython.Modules.PythonCopyReg.GetDispatchTable(CodeContext > context) > at IronPython.Modules.PythonRegex.PerformModuleReload(PythonContext > context,PythonDictionary dict) > --- End of inner exception stack trace --- > at > Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call(Object[] args, > Boolean& shouldOptimize) > at > IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`5.Call4(CallSite > site, CodeContext context, TFuncType func, T0 arg0, T1 arg1, T2 arg2, T3 > arg3) > at > System.Dynamic.UpdateDelegates.UpdateAndExecute6[T0,T1,T2,T3,T4,T5,TRet](CallSite > site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) > at IronPython.Runtime.Importer.Import(CodeContext context, String > fullName, PythonTuple from, Int32 level) > at IronPython.Runtime.Operations.PythonOps.ImportTop(CodeContext > context, String fullName, Int32 level) > at > Microsoft.Scripting.Interpreter.FuncCallInstruction`4.Run(InterpretedFrame > frame) > at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame > frame) > at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, > T1 arg1) > at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx) > at IronPython.Compiler.PythonScriptCode.Run(Scope scope) > at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope) > at IronPython.Compiler.RuntimeScriptCode.Run(Scope scope) > at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink > errorSink) > at Microsoft.Scripting.SourceUnit.Execute(Scope scope) > at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope) > at MonitorService.ExpectationMonitor.Initialize(String rule) in D:\PhD > Work\Research\libomv\test\MonitorService\MonitorService\ExpectationMonitor.cs:line > 88 > > --- On *Thu, 14/4/11, Jeff Hardy * wrote: > > > From: Jeff Hardy > Subject: Re: [IronPython] how to generate multiple concurrent scriptign > engines? > To: "Discussion of IronPython" > Cc: "surangika ranathunga" > Received: Thursday, 14 April, 2011, 7:35 AM > > > As long as you have a ScriptScope per thread, you should be able to > share the ScriptEngine & Runtime between threads. > > What is the exception that you are getting? If it's a GUI program, > remember that UI elements can only be manipulated from the main > thread. > > - Jeff > > On Thu, Apr 14, 2011 at 1:02 AM, surangika ranathunga > > wrote: > > > > Hi, > > I am using Ironpython to connect to a legacy python code from C#. > > I am not fully familiar with Ironpython, but managed to get it working > for a single-threaded application. > > This is how I implemented this: > > > > ScriptEngine engine = Python.CreateEngine(); > > ScriptRuntime runtime = engine.Runtime; > > ScriptScope scope = runtime.CreateScope(); > > ops = engine.Operations; > > ScriptSource source = > engine.CreateScriptSourceFromFile("ironpython.py"); > > source.Execute(scope); > > string class_param = rule; > > object[] parameters = new object[1]; > > parameters[0] = class_param; > > object klass = scope.GetVariable("model_checker"); > > object instance = ops.Invoke(klass, parameters); > > method = ops.GetMember(instance, "check_model"); > > > > Now I want to make my application multi-threaded, and I want to have > concurrently running scripting engines. Essentially, these engines should > access the same underlying python code, and hence these scripting engines > are identical to each other. > > Without any change, the above code works fine for most of the time for a > multi-threaded application. However, there is an exception that appears from > time to time, and I suspect that it is due to a concurrency issue. > > > > Is there anything specific that I should do to generate multiple > scripting engines running in separate threads without interfering with each > other? > > > > any ideas greatly appreciated > > > > _______________________________________________ > > 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 loocas at duber.cz Fri Apr 15 17:50:25 2011 From: loocas at duber.cz (=?UTF-8?B?THVrw6HFoSBEdWLEm2Rh?=) Date: Fri, 15 Apr 2011 17:50:25 +0200 Subject: [IronPython] WPF module in IronPython scripting? In-Reply-To: References: <337612.2195.qm@web110210.mail.gq1.yahoo.com> Message-ID: <4DA86941.6050102@duber.cz> Hi there everyone, I just bumped into a problem where when I run the IPy.exe console and execute a script that contains: import wpf all works well. However, when I want to import the wpf namespace into the same script, but run outside the IPy.exe (i.e. as an embedded engine) I get an error saying that the module wpf doesn't exist! I even tried to add the IronPython.Wpf.dll into the PATH, I tried referencing it in my script via clr.AddReferenceToFile, nothing works and I don't have access to the wpf methods etc... Is there anything I can do about it? As always, thanks a lot in advance! :) Luk?? Dub?da Director [T] +420 602 444 164 duber studio(tm) [M] info at duber.cz [W] http://www.duber.cz [A] R.A.Dvorsk?ho 601, Praha 10 [A] 10900, Czech Republic, Europe From dinov at microsoft.com Fri Apr 15 18:36:11 2011 From: dinov at microsoft.com (Dino Viehland) Date: Fri, 15 Apr 2011 16:36:11 +0000 Subject: [IronPython] how to generate multiple concurrent scriptign engines? In-Reply-To: References: <337612.2195.qm@web110210.mail.gq1.yahoo.com> Message-ID: <6C7ABA8B4E309440B857D74348836F2E1504F24E@TK5EX14MBXC133.redmond.corp.microsoft.com> It might come from CopyReg but the bug is definitely in GetEqualSite - we just need a lock(_equalSites) { ... } around the TryGetValue and creation of the equal site. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jeff Hardy Sent: Friday, April 15, 2011 7:29 AM To: surangika ranathunga Cc: Discussion of IronPython Subject: Re: [IronPython] how to generate multiple concurrent scriptign engines? Any chance you can share what the source is? The exception comes from PythonCopyReg's initialization, which means we might have a bug (it might not be thread-safe, or something else). If you could create a minimal sample that has the issue that would be even better. - Jeff On Thu, Apr 14, 2011 at 9:18 PM, surangika ranathunga > wrote: Hi, Below is the exception I receive: here, D:\PhD Work\Research\libomv\test\MonitorService\MonitorService\ExpectationMonitor.cs:line 88 refers to source.Execute(scope); in the below given code. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceExce ption: Object reference not set to an instance of an object. at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value) at IronPython.Runtime.PythonContext.GetEqualSite(Type type) at IronPython.Runtime.CommonDictionaryStorage.UpdateHelperFunctions(Type t, Object key) at IronPython.Runtime.CommonDictionaryStorage.AddNoLock(Object key, Object value) at IronPython.Runtime.CommonDictionaryStorage.Add(Object key, Object value) at IronPython.Runtime.PythonDictionary.SetItem(Object key, Object value) at IronPython.Runtime.PythonDictionary.set_Item(Object key, Object value) at IronPython.Modules.PythonCopyReg.PerformModuleReload(PythonContext context, PythonDictionary dict) --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at IronPython.Runtime.PythonContext.CreateBuiltinModule(String moduleName, Type type, ModuleOptions options) at IronPython.Runtime.PythonContext.CreateBuiltinModule(String moduleName, Type type) at IronPython.Runtime.PythonContext.CreateBuiltinModule(String name) at IronPython.Runtime.PythonContext.GetBuiltinModule(String name) at IronPython.Runtime.Importer.ImportBuiltin(CodeContext context, String name) at IronPython.Modules.PythonCopyReg.EnsureModuleInitialized(CodeContext context) at IronPython.Modules.PythonCopyReg.GetDispatchTable(CodeContext context) at IronPython.Modules.PythonRegex.PerformModuleReload(PythonContext context,PythonDictionary dict) --- End of inner exception stack trace --- at Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call(Object[] args, Boolean& shouldOptimize) at IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`5.Call4(CallSite site, CodeContext context, TFuncType func, T0 arg0, T1 arg1, T2 arg2, T3 arg3) at System.Dynamic.UpdateDelegates.UpdateAndExecute6[T0,T1,T2,T3,T4,T5,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) at IronPython.Runtime.Importer.Import(CodeContext context, String fullName, PythonTuple from, Int32 level) at IronPython.Runtime.Operations.PythonOps.ImportTop(CodeContext context, String fullName, Int32 level) at Microsoft.Scripting.Interpreter.FuncCallInstruction`4.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1) at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx) at IronPython.Compiler.PythonScriptCode.Run(Scope scope) at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope) at IronPython.Compiler.RuntimeScriptCode.Run(Scope scope) at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink errorSink) at Microsoft.Scripting.SourceUnit.Execute(Scope scope) at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope) at MonitorService.ExpectationMonitor.Initialize(String rule) in D:\PhD Work\Research\libomv\test\MonitorService\MonitorService\ExpectationMonitor.cs:line 88 --- On Thu, 14/4/11, Jeff Hardy > wrote: From: Jeff Hardy > Subject: Re: [IronPython] how to generate multiple concurrent scriptign engines? To: "Discussion of IronPython" > Cc: "surangika ranathunga" > Received: Thursday, 14 April, 2011, 7:35 AM As long as you have a ScriptScope per thread, you should be able to share the ScriptEngine & Runtime between threads. What is the exception that you are getting? If it's a GUI program, remember that UI elements can only be manipulated from the main thread. - Jeff On Thu, Apr 14, 2011 at 1:02 AM, surangika ranathunga > wrote: > > Hi, > I am using Ironpython to connect to a legacy python code from C#. > I am not fully familiar with Ironpython, but managed to get it working for a single-threaded application. > This is how I implemented this: > > ScriptEngine engine = Python.CreateEngine(); > ScriptRuntime runtime = engine.Runtime; > ScriptScope scope = runtime.CreateScope(); > ops = engine.Operations; > ScriptSource source = engine.CreateScriptSourceFromFile("ironpython.py"); > source.Execute(scope); > string class_param = rule; > object[] parameters = new object[1]; > parameters[0] = class_param; > object klass = scope.GetVariable("model_checker"); > object instance = ops.Invoke(klass, parameters); > method = ops.GetMember(instance, "check_model"); > > Now I want to make my application multi-threaded, and I want to have concurrently running scripting engines. Essentially, these engines should access the same underlying python code, and hence these scripting engines are identical to each other. > Without any change, the above code works fine for most of the time for a multi-threaded application. However, there is an exception that appears from time to time, and I suspect that it is due to a concurrency issue. > > Is there anything specific that I should do to generate multiple scripting engines running in separate threads without interfering with each other? > > any ideas greatly appreciated > > _______________________________________________ > 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 Apr 15 18:38:23 2011 From: dinov at microsoft.com (Dino Viehland) Date: Fri, 15 Apr 2011 16:38:23 +0000 Subject: [IronPython] WPF module in IronPython scripting? In-Reply-To: <4DA86941.6050102@duber.cz> References: <337612.2195.qm@web110210.mail.gq1.yahoo.com> <4DA86941.6050102@duber.cz> Message-ID: <6C7ABA8B4E309440B857D74348836F2E1504F289@TK5EX14MBXC133.redmond.corp.microsoft.com> Luk?? wrote: > Hi there everyone, > > I just bumped into a problem where when I run the IPy.exe console and > execute a script that contains: > > import wpf > > all works well. However, when I want to import the wpf namespace into the > same script, but run outside the IPy.exe (i.e. as an embedded engine) I get > an error saying that the module wpf doesn't exist! > > I even tried to add the IronPython.Wpf.dll into the PATH, I tried referencing > it in my script via clr.AddReferenceToFile, nothing works and I don't have > access to the wpf methods etc... > > Is there anything I can do about it? I would have expected AddReferenceToFile to work but what about doing a scriptRuntime.LoadAssembly(typeof(Wpf).Assembly); where the host app has a reference to IronPython.Wpf.dll? I think the code for loading from the DLLs directory is ipy.exe specific - you could also look at replicating that for your host app so there's a general way to add additional Python built-in modules. From jdhardy at gmail.com Fri Apr 15 18:40:43 2011 From: jdhardy at gmail.com (Jeff Hardy) Date: Fri, 15 Apr 2011 10:40:43 -0600 Subject: [IronPython] how to generate multiple concurrent scriptign engines? In-Reply-To: <6C7ABA8B4E309440B857D74348836F2E1504F24E@TK5EX14MBXC133.redmond.corp.microsoft.com> References: <337612.2195.qm@web110210.mail.gq1.yahoo.com> <6C7ABA8B4E309440B857D74348836F2E1504F24E@TK5EX14MBXC133.redmond.corp.microsoft.com> Message-ID: Can one of your alter-egos file a bug so it doesn't get lost? - Jeff On Fri, Apr 15, 2011 at 10:36 AM, Dino Viehland wrote: > It might come from CopyReg but the bug is definitely in GetEqualSite ? we > just need a lock(_equalSites) { ? } around the TryGetValue and creation of > the equal site. > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Jeff Hardy > *Sent:* Friday, April 15, 2011 7:29 AM > *To:* surangika ranathunga > *Cc:* Discussion of IronPython > > *Subject:* Re: [IronPython] how to generate multiple concurrent scriptign > engines? > > > > Any chance you can share what the source is? The exception comes from > PythonCopyReg's initialization, which means we might have a bug (it might > not be thread-safe, or something else). If you could create a minimal sample > that has the issue that would be even better. > > > > - Jeff > > On Thu, Apr 14, 2011 at 9:18 PM, surangika ranathunga < > lady_radsu at yahoo.com> wrote: > > Hi, > Below is the exception I receive: > here, D:\PhD > Work\Research\libomv\test\MonitorService\MonitorService\ExpectationMonitor.cs:line > 88 refers to source.Execute(scope); in the below given code. > > System.Reflection.TargetInvocationException: Exception has been thrown by > the target of an invocation. ---> > System.Reflection.TargetInvocationException: Exception has been thrown by > the target of an invocation. ---> System.NullReferenceExce > ption: Object reference not set to an instance of an object. > at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue > value, Boolean add) > at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue > value) > at IronPython.Runtime.PythonContext.GetEqualSite(Type type) > at IronPython.Runtime.CommonDictionaryStorage.UpdateHelperFunctions(Type > t, Object key) > at IronPython.Runtime.CommonDictionaryStorage.AddNoLock(Object key, > Object value) > at IronPython.Runtime.CommonDictionaryStorage.Add(Object key, Object > value) > at IronPython.Runtime.PythonDictionary.SetItem(Object key, Object value) > at IronPython.Runtime.PythonDictionary.set_Item(Object key, Object > value) > at IronPython.Modules.PythonCopyReg.PerformModuleReload(PythonContext > context, PythonDictionary dict) > --- End of inner exception stack trace --- > at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo > method, Object target, Object[] arguments, SignatureStruct& sig, > MethodAttributes methodAttributes, RuntimeType typeOwner) > at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo > method, Object target, Object[] arguments, Signature sig, MethodAttributes > methodAttributes, RuntimeType typeOwner) > at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags > invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean > skipVisibilityChecks) > at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags > invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) > at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) > at IronPython.Runtime.PythonContext.CreateBuiltinModule(String > moduleName, Type type, ModuleOptions options) > at IronPython.Runtime.PythonContext.CreateBuiltinModule(String > moduleName, Type type) > at IronPython.Runtime.PythonContext.CreateBuiltinModule(String name) > at IronPython.Runtime.PythonContext.GetBuiltinModule(String name) > at IronPython.Runtime.Importer.ImportBuiltin(CodeContext context, String > name) > at IronPython.Modules.PythonCopyReg.EnsureModuleInitialized(CodeContext > context) > at IronPython.Modules.PythonCopyReg.GetDispatchTable(CodeContext > context) > at IronPython.Modules.PythonRegex.PerformModuleReload(PythonContext > context,PythonDictionary dict) > --- End of inner exception stack trace --- > at > Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call(Object[] args, > Boolean& shouldOptimize) > at > IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`5.Call4(CallSite > site, CodeContext context, TFuncType func, T0 arg0, T1 arg1, T2 arg2, T3 > arg3) > at > System.Dynamic.UpdateDelegates.UpdateAndExecute6[T0,T1,T2,T3,T4,T5,TRet](CallSite > site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) > at IronPython.Runtime.Importer.Import(CodeContext context, String > fullName, PythonTuple from, Int32 level) > at IronPython.Runtime.Operations.PythonOps.ImportTop(CodeContext > context, String fullName, Int32 level) > at > Microsoft.Scripting.Interpreter.FuncCallInstruction`4.Run(InterpretedFrame > frame) > at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame > frame) > at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, > T1 arg1) > at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx) > at IronPython.Compiler.PythonScriptCode.Run(Scope scope) > at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope) > at IronPython.Compiler.RuntimeScriptCode.Run(Scope scope) > at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink > errorSink) > at Microsoft.Scripting.SourceUnit.Execute(Scope scope) > at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope) > at MonitorService.ExpectationMonitor.Initialize(String rule) in D:\PhD > Work\Research\libomv\test\MonitorService\MonitorService\ExpectationMonitor.cs:line > 88 > > --- On *Thu, 14/4/11, Jeff Hardy * wrote: > > > From: Jeff Hardy > Subject: Re: [IronPython] how to generate multiple concurrent scriptign > engines? > To: "Discussion of IronPython" > Cc: "surangika ranathunga" > Received: Thursday, 14 April, 2011, 7:35 AM > > > > As long as you have a ScriptScope per thread, you should be able to > share the ScriptEngine & Runtime between threads. > > What is the exception that you are getting? If it's a GUI program, > remember that UI elements can only be manipulated from the main > thread. > > - Jeff > > On Thu, Apr 14, 2011 at 1:02 AM, surangika ranathunga > > wrote: > > > > Hi, > > I am using Ironpython to connect to a legacy python code from C#. > > I am not fully familiar with Ironpython, but managed to get it working > for a single-threaded application. > > This is how I implemented this: > > > > ScriptEngine engine = Python.CreateEngine(); > > ScriptRuntime runtime = engine.Runtime; > > ScriptScope scope = runtime.CreateScope(); > > ops = engine.Operations; > > ScriptSource source = > engine.CreateScriptSourceFromFile("ironpython.py"); > > source.Execute(scope); > > string class_param = rule; > > object[] parameters = new object[1]; > > parameters[0] = class_param; > > object klass = scope.GetVariable("model_checker"); > > object instance = ops.Invoke(klass, parameters); > > method = ops.GetMember(instance, "check_model"); > > > > Now I want to make my application multi-threaded, and I want to have > concurrently running scripting engines. Essentially, these engines should > access the same underlying python code, and hence these scripting engines > are identical to each other. > > Without any change, the above code works fine for most of the time for a > multi-threaded application. However, there is an exception that appears from > time to time, and I suspect that it is due to a concurrency issue. > > > > Is there anything specific that I should do to generate multiple > scripting engines running in separate threads without interfering with each > other? > > > > any ideas greatly appreciated > > > > _______________________________________________ > > 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 Apr 15 18:42:09 2011 From: dinov at microsoft.com (Dino Viehland) Date: Fri, 15 Apr 2011 16:42:09 +0000 Subject: [IronPython] how to generate multiple concurrent scriptign engines? In-Reply-To: References: <337612.2195.qm@web110210.mail.gq1.yahoo.com> <6C7ABA8B4E309440B857D74348836F2E1504F24E@TK5EX14MBXC133.redmond.corp.microsoft.com> Message-ID: <6C7ABA8B4E309440B857D74348836F2E1504F2FF@TK5EX14MBXC133.redmond.corp.microsoft.com> Filed as http://ironpython.codeplex.com/workitem/30551 From: Jeff Hardy [mailto:jdhardy at gmail.com] Sent: Friday, April 15, 2011 9:41 AM To: Discussion of IronPython Cc: Dino Viehland; surangika ranathunga Subject: Re: [IronPython] how to generate multiple concurrent scriptign engines? Can one of your alter-egos file a bug so it doesn't get lost? - Jeff On Fri, Apr 15, 2011 at 10:36 AM, Dino Viehland > wrote: It might come from CopyReg but the bug is definitely in GetEqualSite - we just need a lock(_equalSites) { ... } around the TryGetValue and creation of the equal site. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jeff Hardy Sent: Friday, April 15, 2011 7:29 AM To: surangika ranathunga Cc: Discussion of IronPython Subject: Re: [IronPython] how to generate multiple concurrent scriptign engines? Any chance you can share what the source is? The exception comes from PythonCopyReg's initialization, which means we might have a bug (it might not be thread-safe, or something else). If you could create a minimal sample that has the issue that would be even better. - Jeff On Thu, Apr 14, 2011 at 9:18 PM, surangika ranathunga > wrote: Hi, Below is the exception I receive: here, D:\PhD Work\Research\libomv\test\MonitorService\MonitorService\ExpectationMonitor.cs:line 88 refers to source.Execute(scope); in the below given code. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceExce ption: Object reference not set to an instance of an object. at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value) at IronPython.Runtime.PythonContext.GetEqualSite(Type type) at IronPython.Runtime.CommonDictionaryStorage.UpdateHelperFunctions(Type t, Object key) at IronPython.Runtime.CommonDictionaryStorage.AddNoLock(Object key, Object value) at IronPython.Runtime.CommonDictionaryStorage.Add(Object key, Object value) at IronPython.Runtime.PythonDictionary.SetItem(Object key, Object value) at IronPython.Runtime.PythonDictionary.set_Item(Object key, Object value) at IronPython.Modules.PythonCopyReg.PerformModuleReload(PythonContext context, PythonDictionary dict) --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at IronPython.Runtime.PythonContext.CreateBuiltinModule(String moduleName, Type type, ModuleOptions options) at IronPython.Runtime.PythonContext.CreateBuiltinModule(String moduleName, Type type) at IronPython.Runtime.PythonContext.CreateBuiltinModule(String name) at IronPython.Runtime.PythonContext.GetBuiltinModule(String name) at IronPython.Runtime.Importer.ImportBuiltin(CodeContext context, String name) at IronPython.Modules.PythonCopyReg.EnsureModuleInitialized(CodeContext context) at IronPython.Modules.PythonCopyReg.GetDispatchTable(CodeContext context) at IronPython.Modules.PythonRegex.PerformModuleReload(PythonContext context,PythonDictionary dict) --- End of inner exception stack trace --- at Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call(Object[] args, Boolean& shouldOptimize) at IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`5.Call4(CallSite site, CodeContext context, TFuncType func, T0 arg0, T1 arg1, T2 arg2, T3 arg3) at System.Dynamic.UpdateDelegates.UpdateAndExecute6[T0,T1,T2,T3,T4,T5,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) at IronPython.Runtime.Importer.Import(CodeContext context, String fullName, PythonTuple from, Int32 level) at IronPython.Runtime.Operations.PythonOps.ImportTop(CodeContext context, String fullName, Int32 level) at Microsoft.Scripting.Interpreter.FuncCallInstruction`4.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1) at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx) at IronPython.Compiler.PythonScriptCode.Run(Scope scope) at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope) at IronPython.Compiler.RuntimeScriptCode.Run(Scope scope) at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink errorSink) at Microsoft.Scripting.SourceUnit.Execute(Scope scope) at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope) at MonitorService.ExpectationMonitor.Initialize(String rule) in D:\PhD Work\Research\libomv\test\MonitorService\MonitorService\ExpectationMonitor.cs:line 88 --- On Thu, 14/4/11, Jeff Hardy > wrote: From: Jeff Hardy > Subject: Re: [IronPython] how to generate multiple concurrent scriptign engines? To: "Discussion of IronPython" > Cc: "surangika ranathunga" > Received: Thursday, 14 April, 2011, 7:35 AM As long as you have a ScriptScope per thread, you should be able to share the ScriptEngine & Runtime between threads. What is the exception that you are getting? If it's a GUI program, remember that UI elements can only be manipulated from the main thread. - Jeff On Thu, Apr 14, 2011 at 1:02 AM, surangika ranathunga > wrote: > > Hi, > I am using Ironpython to connect to a legacy python code from C#. > I am not fully familiar with Ironpython, but managed to get it working for a single-threaded application. > This is how I implemented this: > > ScriptEngine engine = Python.CreateEngine(); > ScriptRuntime runtime = engine.Runtime; > ScriptScope scope = runtime.CreateScope(); > ops = engine.Operations; > ScriptSource source = engine.CreateScriptSourceFromFile("ironpython.py"); > source.Execute(scope); > string class_param = rule; > object[] parameters = new object[1]; > parameters[0] = class_param; > object klass = scope.GetVariable("model_checker"); > object instance = ops.Invoke(klass, parameters); > method = ops.GetMember(instance, "check_model"); > > Now I want to make my application multi-threaded, and I want to have concurrently running scripting engines. Essentially, these engines should access the same underlying python code, and hence these scripting engines are identical to each other. > Without any change, the above code works fine for most of the time for a multi-threaded application. However, there is an exception that appears from time to time, and I suspect that it is due to a concurrency issue. > > Is there anything specific that I should do to generate multiple scripting engines running in separate threads without interfering with each other? > > any ideas greatly appreciated > > _______________________________________________ > 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 loocas at duber.cz Fri Apr 15 19:41:10 2011 From: loocas at duber.cz (=?UTF-8?B?THVrw6HFoSBEdWLEm2Rh?=) Date: Fri, 15 Apr 2011 19:41:10 +0200 Subject: [IronPython] WPF module in IronPython scripting? In-Reply-To: <6C7ABA8B4E309440B857D74348836F2E1504F289@TK5EX14MBXC133.redmond.corp.microsoft.com> References: <337612.2195.qm@web110210.mail.gq1.yahoo.com> <4DA86941.6050102@duber.cz> <6C7ABA8B4E309440B857D74348836F2E1504F289@TK5EX14MBXC133.redmond.corp.microsoft.com> Message-ID: <4DA88336.8020207@duber.cz> Unfortunately loading the Assembly didn't work, it threw an error: dotNet runtime exception: Could not add reference to assembly IronPython.Wpf.dll Nothing else. :( Unfortunately we don't have access to the Host app's source at all, we're only writing a .NET plugin that enables us to run IronPython inside the host app's native scripting language. But I'll talk to the programmer who wrote the actual IPy plugin for me and see what the problem might be. I just thought it's something related to .NET and IPy only. Thank you! Luk?? Dub?da Director [T] +420 602 444 164 duber studio(tm) [M] info at duber.cz [W] http://www.duber.cz [A] R.A.Dvorsk?ho 601, Praha 10 [A] 10900, Czech Republic, Europe On 15.4.2011 18:38, Dino Viehland wrote: > Luk?? wrote: >> Hi there everyone, >> >> I just bumped into a problem where when I run the IPy.exe console and >> execute a script that contains: >> >> import wpf >> >> all works well. However, when I want to import the wpf namespace into the >> same script, but run outside the IPy.exe (i.e. as an embedded engine) I get >> an error saying that the module wpf doesn't exist! >> >> I even tried to add the IronPython.Wpf.dll into the PATH, I tried referencing >> it in my script via clr.AddReferenceToFile, nothing works and I don't have >> access to the wpf methods etc... >> >> Is there anything I can do about it? > > I would have expected AddReferenceToFile to work but what about doing a > scriptRuntime.LoadAssembly(typeof(Wpf).Assembly); where the host app > has a reference to IronPython.Wpf.dll? > > I think the code for loading from the DLLs directory is ipy.exe specific - you could > also look at replicating that for your host app so there's a general way to add > additional Python built-in modules. > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From m.schaber at 3s-software.com Mon Apr 18 08:24:25 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Mon, 18 Apr 2011 08:24:25 +0200 Subject: [IronPython] WPF module in IronPython scripting? In-Reply-To: <4DA88336.8020207@duber.cz> References: <337612.2195.qm@web110210.mail.gq1.yahoo.com> <4DA86941.6050102@duber.cz><6C7ABA8B4E309440B857D74348836F2E1504F289@TK5EX14MBXC133.redmond.corp.microsoft.com> <4DA88336.8020207@duber.cz> Message-ID: Hi, Luk??, It may be a problem related to the .NET assembly search path, or it may be the host application blocking/filtering the loading of arbitrary assemblies. Did you try clr.AddReference() with the Assemblies being in the GAC? Did you try clr.AddReferencetoFileAndPath()? Could you try to catch the exception, and explore it for more details (e. G. an inner exception)? Regards, Markus > -----Urspr?ngliche Nachricht----- > Von: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] Im Auftrag von Luk?? Dubeda > Gesendet: Freitag, 15. April 2011 19:41 > An: Discussion of IronPython > Betreff: Re: [IronPython] WPF module in IronPython scripting? > > Unfortunately loading the Assembly didn't work, it threw an error: > > dotNet runtime exception: Could not add reference to assembly > IronPython.Wpf.dll > > Nothing else. :( > > Unfortunately we don't have access to the Host app's source at all, we're > only writing a .NET plugin that enables us to run IronPython inside the > host app's native scripting language. > > But I'll talk to the programmer who wrote the actual IPy plugin for me and > see what the problem might be. > > I just thought it's something related to .NET and IPy only. > > Thank you! > > Luk?? Dub?da > Director > [T] +420 602 444 164 > > duber studio(tm) > [M] info at duber.cz > [W] http://www.duber.cz > > [A] R.A.Dvorsk?ho 601, Praha 10 > [A] 10900, Czech Republic, Europe > > On 15.4.2011 18:38, Dino Viehland wrote: > > Luk?? wrote: > >> Hi there everyone, > >> > >> I just bumped into a problem where when I run the IPy.exe console and > >> execute a script that contains: > >> > >> import wpf > >> > >> all works well. However, when I want to import the wpf namespace into > >> the same script, but run outside the IPy.exe (i.e. as an embedded > >> engine) I get an error saying that the module wpf doesn't exist! > >> > >> I even tried to add the IronPython.Wpf.dll into the PATH, I tried > >> referencing it in my script via clr.AddReferenceToFile, nothing works > >> and I don't have access to the wpf methods etc... > >> > >> Is there anything I can do about it? > > > > I would have expected AddReferenceToFile to work but what about doing > > a scriptRuntime.LoadAssembly(typeof(Wpf).Assembly); where the host > > app has a reference to IronPython.Wpf.dll? > > > > I think the code for loading from the DLLs directory is ipy.exe > > specific - you could also look at replicating that for your host app > > so there's a general way to add additional Python built-in modules. > > > > > > _______________________________________________ > > 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 vfr.niko at hotmail.fr Mon Apr 18 13:56:35 2011 From: vfr.niko at hotmail.fr (NikoVFR) Date: Mon, 18 Apr 2011 04:56:35 -0700 (PDT) Subject: [IronPython] AttributeError : System.Drawing.Graphics is "read-only" Message-ID: <31419737.post@talk.nabble.com> Hello everybody... first i apologize for my bad english... i did not practice for a very long time... A strange problem in a ironpython app, done with Sharpdevelop... I created a form, without borders, captions, icon...., just a simple square to draw... When I try to draw from my OnPaint Function, IronPy answers me : Exception.AttributeError : attribute 'Graphics' of 'namespace#' object is read-only Thanks for helping me, i really can't find any solution here... -- View this message in context: http://old.nabble.com/AttributeError-%3A-System.Drawing.Graphics-is-%22read-only%22-tp31419737p31419737.html Sent from the IronPython mailing list archive at Nabble.com. From jschementi at gmail.com Mon Apr 18 14:03:43 2011 From: jschementi at gmail.com (Jimmy Schementi) Date: Mon, 18 Apr 2011 08:03:43 -0400 Subject: [IronPython] AttributeError : System.Drawing.Graphics is "read-only" In-Reply-To: <31419737.post@talk.nabble.com> References: <31419737.post@talk.nabble.com> Message-ID: Can you send the python code that causes this error? ~Jimmy On Apr 18, 2011, at 7:56 AM, NikoVFR wrote: > > Hello everybody... > > first i apologize for my bad english... i did not practice for a very long > time... > > A strange problem in a ironpython app, done with Sharpdevelop... > > I created a form, without borders, captions, icon...., just a simple square > to draw... > > When I try to draw from my OnPaint Function, IronPy answers me : > Exception.AttributeError : > attribute 'Graphics' of 'namespace#' object is read-only > > Thanks for helping me, i really can't find any solution here... > -- > View this message in context: http://old.nabble.com/AttributeError-%3A-System.Drawing.Graphics-is-%22read-only%22-tp31419737p31419737.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 doug.blank at gmail.com Mon Apr 18 14:16:44 2011 From: doug.blank at gmail.com (Doug Blank) Date: Mon, 18 Apr 2011 08:16:44 -0400 Subject: [IronPython] AttributeError : System.Drawing.Graphics is "read-only" In-Reply-To: <31419737.post@talk.nabble.com> References: <31419737.post@talk.nabble.com> Message-ID: On Mon, Apr 18, 2011 at 7:56 AM, NikoVFR wrote: > > Hello everybody... > > first i apologize for my bad english... i did not practice for a very long > time... > > A strange problem in a ironpython app, done with Sharpdevelop... > > I created a form, without borders, captions, icon...., just a simple square > to draw... > > When I try to draw from my OnPaint Function, IronPy answers me : > Exception.AttributeError : > attribute 'Graphics' of 'namespace#' object is read-only That usually means that you have misspelled an attribute. For example, if you say Gtk.Wibbow instead of Gtk.Window, you'll get that error. (It is actually a bad error message in that you are only looking up a value, not creating one; is that only a Mono-only issue I wonder?) As Jimmy says, we'd need to see the code to say more. -Doug > Thanks for helping me, i really can't find any solution here... > -- > View this message in context: http://old.nabble.com/AttributeError-%3A-System.Drawing.Graphics-is-%22read-only%22-tp31419737p31419737.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 m.schaber at 3s-software.com Mon Apr 18 15:00:09 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Mon, 18 Apr 2011 15:00:09 +0200 Subject: [IronPython] AttributeError : System.Drawing.Graphics is"read-only" In-Reply-To: References: <31419737.post@talk.nabble.com> Message-ID: Hi, Doug, We get the same misleading error message with IPy 2.6 on microsoft .NET 2.0. Gr??e, Markus > -----Urspr?ngliche Nachricht----- > Von: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] Im Auftrag von Doug Blank > Gesendet: Montag, 18. April 2011 14:17 > An: Discussion of IronPython > Cc: NikoVFR > Betreff: Re: [IronPython] AttributeError : System.Drawing.Graphics > is"read-only" > > On Mon, Apr 18, 2011 at 7:56 AM, NikoVFR wrote: > > > > Hello everybody... > > > > first i apologize for my bad english... i did not practice for a very > > long time... > > > > A strange problem in a ironpython app, done with Sharpdevelop... > > > > I created a form, without borders, captions, icon...., just a simple > > square to draw... > > > > When I try to draw from my OnPaint Function, IronPy answers me : > > Exception.AttributeError : > > attribute 'Graphics' of 'namespace#' object is read-only > > That usually means that you have misspelled an attribute. For example, if > you say Gtk.Wibbow instead of Gtk.Window, you'll get that error. > (It is actually a bad error message in that you are only looking up a > value, not creating one; is that only a Mono-only issue I wonder?) > > As Jimmy says, we'd need to see the code to say more. > > -Doug > > > Thanks for helping me, i really can't find any solution here... > > -- > > View this message in context: > > http://old.nabble.com/AttributeError-%3A-System.Drawing.Graphics-is-%2 > > 2read-only%22-tp31419737p31419737.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 > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From vfr.niko at hotmail.fr Mon Apr 18 15:30:53 2011 From: vfr.niko at hotmail.fr (NikoVFR) Date: Mon, 18 Apr 2011 06:30:53 -0700 (PDT) Subject: [IronPython] AttributeError : System.Drawing.Graphics is "read-only" In-Reply-To: References: <31419737.post@talk.nabble.com> Message-ID: <31423875.post@talk.nabble.com> class MainForm(Form): def MainFormPaint(self, sender, e): print "MainFormPaint %i"%self._paint gr = e.Graphics self.MainPanel.Draw(gr,0) class MainPanel: def Draw(self,gr,starty): y = starty for c in self.Children: y = c.Draw(gr,y) Tell me if you need more code.... -- View this message in context: http://old.nabble.com/AttributeError-%3A-System.Drawing.Graphics-is-%22read-only%22-tp31419737p31423875.html Sent from the IronPython mailing list archive at Nabble.com. From m.schaber at 3s-software.com Mon Apr 18 15:46:38 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Mon, 18 Apr 2011 15:46:38 +0200 Subject: [IronPython] AttributeError : System.Drawing.Graphics is "read-only" In-Reply-To: <31423875.post@talk.nabble.com> References: <31419737.post@talk.nabble.com> <31423875.post@talk.nabble.com> Message-ID: Hi, Niko, A small self-contained running example would be nice. I tried to guess some of the missing context, and now get the exception that MainForm has no _paint member. Regards, Markus > -----Urspr?ngliche Nachricht----- > Von: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] Im Auftrag von NikoVFR > Gesendet: Montag, 18. April 2011 15:31 > An: users at lists.ironpython.com > Betreff: Re: [IronPython] AttributeError : System.Drawing.Graphics is > "read-only" > > > class MainForm(Form): > def MainFormPaint(self, sender, e): > print "MainFormPaint %i"%self._paint > gr = e.Graphics > self.MainPanel.Draw(gr,0) > > class MainPanel: > def Draw(self,gr,starty): > y = starty > for c in self.Children: > y = c.Draw(gr,y) > > Tell me if you need more code.... > -- > View this message in context: http://old.nabble.com/AttributeError-%3A- > System.Drawing.Graphics-is-%22read-only%22-tp31419737p31423875.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 vfr.niko at hotmail.fr Mon Apr 18 17:33:28 2011 From: vfr.niko at hotmail.fr (NikoVFR) Date: Mon, 18 Apr 2011 08:33:28 -0700 (PDT) Subject: [IronPython] AttributeError : System.Drawing.Graphics is "read-only" In-Reply-To: References: <31419737.post@talk.nabble.com> <31423875.post@talk.nabble.com> Message-ID: <31425014.post@talk.nabble.com> Markus Schaber-6 wrote: > > Hi, Niko, > > A small self-contained running example would be nice. > > I tried to guess some of the missing context, and now get the exception > that MainForm has no _paint member. > > Regards, > Markus > > >> -----Urspr?ngliche Nachricht----- >> Von: users-bounces at lists.ironpython.com [mailto:users- >> bounces at lists.ironpython.com] Im Auftrag von NikoVFR >> Gesendet: Montag, 18. April 2011 15:31 >> An: users at lists.ironpython.com >> Betreff: Re: [IronPython] AttributeError : System.Drawing.Graphics is >> "read-only" >> >> >> class MainForm(Form): >> def MainFormPaint(self, sender, e): >> print "MainFormPaint %i"%self._paint >> gr = e.Graphics >> self.MainPanel.Draw(gr,0) >> >> class MainPanel: >> def Draw(self,gr,starty): >> y = starty >> for c in self.Children: >> y = c.Draw(gr,y) >> >> Tell me if you need more code.... >> -- >> View this message in context: http://old.nabble.com/AttributeError-%3A- >> System.Drawing.Graphics-is-%22read-only%22-tp31419737p31423875.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 > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > Ok, problem solved, sorry you wasted your time for me.... I was just trying to create a System.Graphics.Font..... Re-read it again and found... Thanks whatever.... -- View this message in context: http://old.nabble.com/AttributeError-%3A-System.Drawing.Graphics-is-%22read-only%22-tp31419737p31425014.html Sent from the IronPython mailing list archive at Nabble.com. From lady_radsu at yahoo.com Tue Apr 19 04:27:30 2011 From: lady_radsu at yahoo.com (surangika ranathunga) Date: Mon, 18 Apr 2011 19:27:30 -0700 (PDT) Subject: [IronPython] how to generate multiple concurrent scriptign engines? In-Reply-To: Message-ID: <347689.40614.qm@web110216.mail.gq1.yahoo.com> Hi, Sorry I missed the posts on this thread. This is the code that caused me the problem (I posted this in the first post of the thread) So according to your mails, I take that this is due to a bug in the ironpython code. Is there a way I can have some alternative work-out, something that I can do?through my code? (i'm in kind of a hury to finish the project :S ) ? ScriptEngine engine = Python.CreateEngine(); ScriptRuntime runtime = engine.Runtime; ScriptScope scope = runtime.CreateScope(); ops = engine.Operations; try { ScriptSource source = engine.CreateScriptSourceFromFile("ironpython.py"); source.Execute(scope); string class_param = rule; object[] parameters = new object[1]; parameters[0] = class_param; object klass = scope.GetVariable("model_checker"); object instance = ops.Invoke(klass, parameters); method = ops.GetMember(instance, "check_model"); } catch (Exception e) { Console.WriteLine(e.ToString()); } ? ? --- On Thu, 14/4/11, Jeff Hardy wrote: From: Jeff Hardy Subject: Re: [IronPython] how to generate multiple concurrent scriptign engines? To: "Discussion of IronPython" Cc: "surangika ranathunga" Received: Thursday, 14 April, 2011, 7:35 AM As long as you have a ScriptScope per thread, you should be able to share the ScriptEngine & Runtime between threads. What is the exception that you are getting? If it's a GUI program, remember that UI elements can only be manipulated from the main thread. - Jeff On Thu, Apr 14, 2011 at 1:02 AM, surangika ranathunga wrote: > > Hi, > I am using Ironpython to connect to a legacy python code from C#. > I am not fully familiar with Ironpython, but managed to get it working for a single-threaded application. > This is how I implemented this: > > ??????????????? ScriptEngine engine = Python.CreateEngine(); > ??????????????? ScriptRuntime runtime = engine.Runtime; > ??????????????? ScriptScope scope = runtime.CreateScope(); > ??????????????? ops = engine.Operations; > ??????????????? ScriptSource source = engine.CreateScriptSourceFromFile("ironpython.py"); > ??????????????? source.Execute(scope); > ??????????????? string class_param = rule; > ??????????????? object[] parameters = new object[1]; > ??????????????? parameters[0] = class_param; > ??????????????? object klass = scope.GetVariable("model_checker"); > ??????????????? object instance = ops.Invoke(klass, parameters); > ??????????????? method = ops.GetMember(instance, "check_model"); > > Now I want to make my application multi-threaded, and I want to have concurrently running scripting engines. Essentially, these engines should access the same underlying python code, and hence these scripting engines are identical to each other. > Without any change, the above code works fine for most of the time for a multi-threaded application. However, there is an exception that appears from time to time, and I suspect that it is due to a concurrency issue. > > Is there anything specific that I should do to generate multiple scripting engines running in separate threads without interfering with each other? > > any ideas greatly appreciated > > _______________________________________________ > 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 m.schaber at 3s-software.com Wed Apr 20 08:23:52 2011 From: m.schaber at 3s-software.com (Markus Schaber) Date: Wed, 20 Apr 2011 08:23:52 +0200 Subject: [IronPython] how to generate multiple concurrent scriptignengines? In-Reply-To: <347689.40614.qm@web110216.mail.gq1.yahoo.com> References: <347689.40614.qm@web110216.mail.gq1.yahoo.com> Message-ID: Hi, You can re-read the thread at http://lists.ironpython.com/pipermail/users-ironpython.com/. The fastest possibility is: - Fetch the IronPython source. - Patch PythonContext.GetEqualSite yourself according to the description in the thread. - Use your own compiled version. Gr??e, Markus Von: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] Im Auftrag von surangika ranathunga Gesendet: Dienstag, 19. April 2011 04:28 An: Discussion of IronPython; Jeff Hardy Betreff: Re: [IronPython] how to generate multiple concurrent scriptignengines? Hi, Sorry I missed the posts on this thread. This is the code that caused me the problem (I posted this in the first post of the thread) So according to your mails, I take that this is due to a bug in the ironpython code. Is there a way I can have some alternative work-out, something that I can do through my code? (i'm in kind of a hury to finish the project :S ) ScriptEngine engine = Python.CreateEngine(); ScriptRuntime runtime = engine.Runtime; ScriptScope scope = runtime.CreateScope(); ops = engine.Operations; try { ScriptSource source = engine.CreateScriptSourceFromFile("ironpython.py"); source.Execute(scope); string class_param = rule; object[] parameters = new object[1]; parameters[0] = class_param; object klass = scope.GetVariable("model_checker"); object instance = ops.Invoke(klass, parameters); method = ops.GetMember(instance, "check_model"); } catch (Exception e) { Console.WriteLine(e.ToString()); } --- On Thu, 14/4/11, Jeff Hardy > wrote: From: Jeff Hardy > Subject: Re: [IronPython] how to generate multiple concurrent scriptign engines? To: "Discussion of IronPython" > Cc: "surangika ranathunga" > Received: Thursday, 14 April, 2011, 7:35 AM As long as you have a ScriptScope per thread, you should be able to share the ScriptEngine & Runtime between threads. What is the exception that you are getting? If it's a GUI program, remember that UI elements can only be manipulated from the main thread. - Jeff On Thu, Apr 14, 2011 at 1:02 AM, surangika ranathunga > wrote: > > Hi, > I am using Ironpython to connect to a legacy python code from C#. > I am not fully familiar with Ironpython, but managed to get it working for a single-threaded application. > This is how I implemented this: > > ScriptEngine engine = Python.CreateEngine(); > ScriptRuntime runtime = engine.Runtime; > ScriptScope scope = runtime.CreateScope(); > ops = engine.Operations; > ScriptSource source = engine.CreateScriptSourceFromFile("ironpython.py"); > source.Execute(scope); > string class_param = rule; > object[] parameters = new object[1]; > parameters[0] = class_param; > object klass = scope.GetVariable("model_checker"); > object instance = ops.Invoke(klass, parameters); > method = ops.GetMember(instance, "check_model"); > > Now I want to make my application multi-threaded, and I want to have concurrently running scripting engines. Essentially, these engines should access the same underlying python code, and hence these scripting engines are identical to each other. > Without any change, the above code works fine for most of the time for a multi-threaded application. However, there is an exception that appears from time to time, and I suspect that it is due to a concurrency issue. > > Is there anything specific that I should do to generate multiple scripting engines running in separate threads without interfering with each other? > > any ideas greatly appreciated > > _______________________________________________ > 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 cbsiftcb at gmail.com Thu Apr 21 22:14:25 2011 From: cbsiftcb at gmail.com (cbsiftcb at gmail.com) Date: Thu, 21 Apr 2011 15:14:25 -0500 Subject: [IronPython] IronPython Tools v2.7 - Console Application - custom ipy.exe Message-ID: I am using the IronPython Tools (v2.7) with Visual Studio 2010, which works great. I have a need to use a custom shell vs. the standard shell (ipy.exe) for debugging. The custom shell better emulates our business application reducing possible development vs. production issues. Is there a way to point the IronPython console project to a custom shell similar to SharpDev? If not, suggested workarounds? Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From lady_radsu at yahoo.com Fri Apr 22 04:29:50 2011 From: lady_radsu at yahoo.com (surangika ranathunga) Date: Thu, 21 Apr 2011 19:29:50 -0700 (PDT) Subject: [IronPython] need help to build Ironpython Message-ID: <819814.14910.qm@web110216.mail.gq1.yahoo.com> Hi All, I have downloaded Ironpython source code using subversion, from the url https://IronPython.svn.codeplex.com/svn (hope this is a stable version to build ironpython dlls to be used in other projects). Then I located IronPython.sln inside IronPython_Main\Solutions folder and opened this in VS, and ran the build command. The build was successful and now I have the new dll files. Is this how the building process is done? -------------- next part -------------- An HTML attachment was scrubbed... URL: From slide.o.mix at gmail.com Fri Apr 22 05:08:04 2011 From: slide.o.mix at gmail.com (Slide) Date: Thu, 21 Apr 2011 20:08:04 -0700 Subject: [IronPython] need help to build Ironpython In-Reply-To: <819814.14910.qm@web110216.mail.gq1.yahoo.com> References: <819814.14910.qm@web110216.mail.gq1.yahoo.com> Message-ID: The source on codeplex is old. Check out github repo ironlanguages. That is where the source currently resides. On Apr 21, 2011 7:29 PM, "surangika ranathunga" wrote: > Hi All, > I have downloaded Ironpython source code using subversion, from the url https://IronPython.svn.codeplex.com/svn (hope this is a stable version to build ironpython dlls to be used in other projects). > > Then I located IronPython.sln inside IronPython_Main\Solutions folder and opened this in VS, and ran the build command. The build was successful and now I have the new dll files. > Is this how the building process is done? > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Fri Apr 22 05:39:07 2011 From: vernondcole at gmail.com (Vernon Cole) Date: Thu, 21 Apr 2011 21:39:07 -0600 Subject: [IronPython] need help to build Ironpython In-Reply-To: <819814.14910.qm@web110216.mail.gq1.yahoo.com> References: <819814.14910.qm@web110216.mail.gq1.yahoo.com> Message-ID: https://github.com/IronLanguages/main has the current source. Use the Python 2.7 branch. Vernon Cole (sent from my 'droid phone) On Apr 21, 2011 10:30 PM, "surangika ranathunga" wrote: > Hi All, > I have downloaded Ironpython source code using subversion, from the url https://IronPython.svn.codeplex.com/svn (hope this is a stable version to build ironpython dlls to be used in other projects). > > Then I located IronPython.sln inside IronPython_Main\Solutions folder and opened this in VS, and ran the build command. The build was successful and now I have the new dll files. > Is this how the building process is done? > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jschementi at gmail.com Fri Apr 22 05:43:10 2011 From: jschementi at gmail.com (Jimmy Schementi) Date: Thu, 21 Apr 2011 23:43:10 -0400 Subject: [IronPython] need help to build Ironpython In-Reply-To: References: <819814.14910.qm@web110216.mail.gq1.yahoo.com> Message-ID: <2D135EFD-6187-4E93-9D16-5D23594AC532@gmail.com> Just for clarity, here's the URL: http://github.com/IronLanguages/main We should remove the source from CodePlex with a readme that redirects people to github. ~Jimmy On Apr 21, 2011, at 11:08 PM, Slide wrote: > The source on codeplex is old. Check out github repo ironlanguages. That is where the source currently resides. > > On Apr 21, 2011 7:29 PM, "surangika ranathunga" wrote: > > Hi All, > > I have downloaded Ironpython source code using subversion, from the url https://IronPython.svn.codeplex.com/svn (hope this is a stable version to build ironpython dlls to be used in other projects). > > > > Then I located IronPython.sln inside IronPython_Main\Solutions folder and opened this in VS, and ran the build command. The build was successful and now I have the new dll files. > > Is this how the building process is done? > > > > > _______________________________________________ > 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 Fri Apr 22 06:12:19 2011 From: jdhardy at gmail.com (Jeff Hardy) Date: Thu, 21 Apr 2011 22:12:19 -0600 Subject: [IronPython] need help to build Ironpython In-Reply-To: <2D135EFD-6187-4E93-9D16-5D23594AC532@gmail.com> References: <819814.14910.qm@web110216.mail.gq1.yahoo.com> <2D135EFD-6187-4E93-9D16-5D23594AC532@gmail.com> Message-ID: I checked in a commit that does that (see the last commit), but i didn't delete the rest of the source. - Jeff On Thursday, April 21, 2011, Jimmy Schementi wrote: > Just for clarity, here's the URL:http://github.com/IronLanguages/main > We should remove the source from CodePlex with a readme that redirects people to github. > > ~Jimmy > On Apr 21, 2011, at 11:08 PM, Slide wrote: > > The source on codeplex is old. Check out github repo ironlanguages. That is where the source currently resides. > On Apr 21, 2011 7:29 PM, "surangika ranathunga" wrote:> Hi All, >> I have downloaded Ironpython source code using subversion, from the url https://IronPython.svn.codeplex.com/svn (hope this is a stable version to build ironpython dlls to be used in other projects). >> >> Then I located IronPython.sln inside IronPython_Main\Solutions folder and opened this in VS, and ran the build command. The build was successful and now I have the new dll files. >> Is this how the building process is done? >> >> > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From davew252 at tx.rr.com Sun Apr 24 18:05:36 2011 From: davew252 at tx.rr.com (Dave Wald) Date: Sun, 24 Apr 2011 11:05:36 -0500 Subject: [IronPython] IronPython Tools v2.7 - Console Application - custom ipy.exe In-Reply-To: References: Message-ID: <4DB44A50.7070908@tx.rr.com> Hey CB - You might have a look at how IPython does it. http://ipython.scipy.org/moin/ They have a pretty good walkthrough on integrating it, and IPython ain't no slouch. Only problem is, it depends on GNU readline (Or, in this case PyReadline, which is not DLR-aware at this point and needs some work) for auto-completion etc., so you have to disable that part. You can turn that off in config. But aside from that, the rest of it works just fine with IronPython. (I'm just an old country programmer :-) , but I didn't have too much trouble getting it to work.) There's also Sho, from MS Research, but the source code is not available. But I'll tell you now, they embed IronPy and have a lot of hardcoded stuff in the hookups... Probably not the best example. But check out the IPython example. Here's a link to an earlier post on the topic which explains what I did. https://groups.google.com/forum/?fromgroups#!topic/ironpy/uQJzxhjjh2M Hope that helps. Dave On 4/21/2011 3:14 PM, cbsiftcb at gmail.com wrote: > > I am using the IronPython Tools (v2.7) with Visual Studio 2010, which > works great. I have a need to use a custom shell vs. the standard > shell (ipy.exe) for debugging. The custom shell better emulates our > business application reducing possible development vs. production issues. > > Is there a way to point the IronPython console project to a custom > shell similar to SharpDev? > > If not, suggested workarounds? > > Thanks! > > > _______________________________________________ > 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 rawatsaurabh at yahoo.co.in Tue Apr 26 11:56:39 2011 From: rawatsaurabh at yahoo.co.in (saurabh rawat) Date: Tue, 26 Apr 2011 15:26:39 +0530 (IST) Subject: [IronPython] Unable to compare two junk character string in Iron Python.Do I need to include any particular encoding.?? Message-ID: <336142.89876.qm@web137414.mail.in.yahoo.com> HI, I have problem while working with text containing the unknown characters I have a method which compare the variable song with "some special character string"? and return true and false on the match and mismatch respectively. example (0)song = The goodgoddevil robzombie pfjsdfgolsdg?????? ?? ?? ?? (1)if song == "The goodgoddevil robzombie pfjsdfgolsdg?????? ?? ?? ??" it exits as soon as it tries to execute the line (1) I have go-ogled and found that something like this is to be? included #!/usr/bin/python # -*- coding: ascii -*- But still the same behavior, i think some problem with the coding - encoding standard. Could plz somebody help. Rgds, Saurabh ???????????????????????????????? ?????????????? " The ultimate test of a relationship is to disagree but to hold hands..............."? ?????????????? ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From cenovsky at bakalari.cz Tue Apr 26 13:16:48 2011 From: cenovsky at bakalari.cz (Lukas Cenovsky) Date: Tue, 26 Apr 2011 13:16:48 +0200 Subject: [IronPython] Unable to compare two junk character string in Iron Python.Do I need to include any particular encoding.?? In-Reply-To: <336142.89876.qm@web137414.mail.in.yahoo.com> References: <336142.89876.qm@web137414.mail.in.yahoo.com> Message-ID: <4DB6A9A0.6000404@bakalari.cz> An HTML attachment was scrubbed... URL: From rawatsaurabh at yahoo.co.in Tue Apr 26 13:51:19 2011 From: rawatsaurabh at yahoo.co.in (saurabh rawat) Date: Tue, 26 Apr 2011 17:21:19 +0530 (IST) Subject: [IronPython] Unable to compare two junk character string in Iron Python.Do I need to include any particular encoding.?? In-Reply-To: <4DB6A9A0.6000404@bakalari.cz> Message-ID: <879002.17018.qm@web137419.mail.in.yahoo.com> Hmm..you mean to say # -*- coding: utf-8-*- like this..will give it a try..i have actually but no success or may be I am missing the correct way to specify it. Thanks and Rgds, Saurabh ???????????????????????????????? ?????????????? " The ultimate test of a relationship is to disagree but to hold hands..............."? ?????????????? ? --- On Tue, 26/4/11, Lukas Cenovsky wrote: From: Lukas Cenovsky Subject: Re: [IronPython] Unable to compare two junk character string in Iron Python.Do I need to include any particular encoding.?? To: "Discussion of IronPython" Date: Tuesday, 26 April, 2011, 4:46 PM You should use the same encoding as has you special character string. Have you tried using utf-8 instead of ascii? -- -- Luk?? On 26.4.2011 11:56, saurabh rawat wrote: HI, I have problem while working with text containing the unknown characters I have a method which compare the variable song with "some special character string"? and return true and false on the match and mismatch respectively. example (0)song = The goodgoddevil robzombie pfjsdfgolsdg???? ?? ?? ?? (1)if song == "The goodgoddevil robzombie pfjsdfgolsdg???? ?? ?? ??" it exits as soon as it tries to execute the line (1) I have go-ogled and found that something like this is to be? included #!/usr/bin/python # -*- coding: ascii -*- But still the same behavior, i think some problem with the coding - encoding standard. Could plz somebody help. Rgds, Saurabh ???????????????????????????????? ?????????????? " The ultimate test of a relationship is to disagree but to hold hands..............."? ?????????????? ? _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -----Inline Attachment Follows----- _______________________________________________ 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 jgehrcke at googlemail.com Tue Apr 26 14:20:55 2011 From: jgehrcke at googlemail.com (Jan-Philip Gehrcke) Date: Tue, 26 Apr 2011 14:20:55 +0200 Subject: [IronPython] Unable to compare two junk character string in Iron Python.Do I need to include any particular encoding.?? In-Reply-To: <879002.17018.qm@web137419.mail.in.yahoo.com> References: <879002.17018.qm@web137419.mail.in.yahoo.com> Message-ID: <4DB6B8A7.7010707@googlemail.com> Saurabh, first of all, you did not provide an error message, but it looks like a decoding/unicode issue. Visit: http://stackoverflow.com/questions/368805/python-unicodedecodeerror-am-i-misunderstanding-encode The first answer should help a lot. Furthermore, this seems to be good literature on the field: http://www.joelonsoftware.com/articles/Unicode.html http://docs.python.org/howto/unicode.html Regarding the application of # -*- coding: coding -*-, read here: http://www.network-theory.co.uk/docs/pytut/SourceCodeEncoding.html So, in your case it looks like a good idea to use e.g. UTF-8 as source encoding. Check the settings of the text editor you are using and set the source encoding to UTF-8 (if it does not allow this, you should use another editor). Then, tell (Iron)Python that your source code is encoded by UTF-8 by putting this into the file header: # -*- coding: utf-8 -*-. Cheers, Jan-Philip On 04/26/2011 01:51 PM, saurabh rawat wrote: > > Hmm..you mean to say # -*- coding: utf-8-*- like this..will give it a > try..i have actually but no success or may be I am missing the correct > way to specify it. > Thanks and Rgds, > Saurabh > > " /*The ultimate test of a relationship is to disagree > but to hold hands*............/..." > > > > > --- On *Tue, 26/4/11, Lukas Cenovsky //* wrote: > > > From: Lukas Cenovsky > Subject: Re: [IronPython] Unable to compare two junk character > string in Iron Python.Do I need to include any particular encoding.?? > To: "Discussion of IronPython" > Date: Tuesday, 26 April, 2011, 4:46 PM > > You should use the same encoding as has you special character string. > Have you tried using utf-8 instead of ascii? > > -- > -- Luk?? > > > On 26.4.2011 11:56, saurabh rawat wrote: >> >> HI, >> I have problem while working with text containing the unknown >> characters >> I have a method which compare the variable song with "some special >> character string" and return true and false on the match and >> mismatch respectively. >> >> example >> >> (0)song = The goodgoddevil robzombie pfjsdfgolsdg???? ?? ?? ?? >> (1)if song == "The goodgoddevil robzombie pfjsdfgolsdg???? ?? ?? ??" >> >> it exits as soon as it tries to execute the line (1) >> >> >> I have go-ogled and found that something like this is to be included >> #!/usr/bin/python >> # -*- coding: ascii -*- >> >> But still the same behavior, i think some problem with the coding >> - encoding standard. >> Could plz somebody help. >> >> Rgds, >> Saurabh >> >> " /*The ultimate test of a relationship is to >> disagree but to hold hands*............/..." >> >> >> >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -----Inline Attachment Follows----- > > _______________________________________________ > 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 sdementen at gmail.com Wed Apr 27 21:40:08 2011 From: sdementen at gmail.com (=?ISO-8859-1?Q?S=E9bastien_de_Menten?=) Date: Wed, 27 Apr 2011 21:40:08 +0200 Subject: [IronPython] GetRunningObjectTable In-Reply-To: References: Message-ID: Hi, I am trying to use the GetRunningObjectTable function to retrieve a list of all running objects (to later use them in COM automation). I do the following : >>> import System >>> System.Runtime.InteropServices.ComTypes.IBindCtx.GetRunningObjectTable(0) Traceback (most recent call last): File "", line 1, in TypeError: expected IBindCtx, got int I am puzzled by the error as, if i understood properly the way ipy works, I would expect to give an Int as input parameter and get back a tuple with the restult of the function and the out parameter. If i replace the 0 with a refernce to a IBindCtx type: >>> import clr >>> rot=clr.Reference[System.Runtime.InteropServices.ComTypes.IBindCtx]() >>> System.Runtime.InteropServices.ComTypes.IBindCtx.GetRunningObjectTable(rot) Traceback (most recent call last): File "", line 1, in TypeError: expected IBindCtx, got StrongBox[IBindCtx] My knowledge of .net is quite reduced ... any help would be greatly appreciated sebastien ps: sorry if this message appears as reposted but I do not see it in the mailing list after more than 24 hours ... -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdhardy at gmail.com Wed Apr 27 22:05:39 2011 From: jdhardy at gmail.com (Jeff Hardy) Date: Wed, 27 Apr 2011 14:05:39 -0600 Subject: [IronPython] GetRunningObjectTable In-Reply-To: References: Message-ID: GetRunningObjectTable isn't a static method, so you'll need to call it on an instance of IBindCtx. Not sure where you'd get one of those, though. - Jeff On Wed, Apr 27, 2011 at 1:40 PM, S?bastien de Menten wrote: > Hi, > > I am trying to use the GetRunningObjectTable function to retrieve a list of > all running objects (to later use them in COM automation). > > I do the following : > >>>> import System >>>> >>>> System.Runtime.InteropServices.ComTypes.IBindCtx.GetRunningObjectTable(0) > Traceback (most recent call last): > ? File "", line 1, in > TypeError: expected IBindCtx, got int > > I am puzzled by the error as, if i understood properly the way ipy works, I > would expect to give an Int as input parameter and get back a tuple with the > restult of the function and the out parameter. > > If i replace the 0 with a refernce to a IBindCtx type: >>>> import clr >>>> rot=clr.Reference[System.Runtime.InteropServices.ComTypes.IBindCtx]() >>>> >>>> System.Runtime.InteropServices.ComTypes.IBindCtx.GetRunningObjectTable(rot) > Traceback (most recent call last): > ? File "", line 1, in > TypeError: expected IBindCtx, got StrongBox[IBindCtx] > > My knowledge of .net is quite reduced ... any help would be greatly > appreciated > > sebastien > > ps: sorry if this message appears as reposted but I do not see it in the > mailing list after more than 24 hours ... > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > From lady_radsu at yahoo.com Thu Apr 28 05:00:47 2011 From: lady_radsu at yahoo.com (surangika ranathunga) Date: Wed, 27 Apr 2011 20:00:47 -0700 (PDT) Subject: [IronPython] how to generate multiple concurrent scriptignengines? In-Reply-To: Message-ID: <760856.22727.qm@web110211.mail.gq1.yahoo.com> I applied the suggested patch and have been testing it for quite a few days. The exception did not occur ever since. So I think I can assume that the problem is no longer there. Thanks a lot for all your timely help --- On Tue, 19/4/11, Markus Schaber wrote: From: Markus Schaber Subject: Re: [IronPython] how to generate multiple concurrent scriptignengines? To: "Discussion of IronPython" Received: Tuesday, 19 April, 2011, 11:23 PM Hi, ?You can re-read the thread at http://lists.ironpython.com/pipermail/users-ironpython.com/. ?The fastest possibility is:- Fetch the IronPython source.- Patch PythonContext.GetEqualSite yourself according to the description in the thread.- Use your own compiled version. ?Gr??e,Markus ?Von: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] Im Auftrag von surangika ranathunga Gesendet: Dienstag, 19. April 2011 04:28 An: Discussion of IronPython; Jeff Hardy Betreff: Re: [IronPython] how to generate multiple concurrent scriptignengines? ?Hi,Sorry I missed the posts on this thread. This is the code that caused me the problem (I posted this in the first post of the thread)So according to your mails, I take that this is due to a bug in the ironpython code. Is there a way I can have some alternative work-out, something that I can do?through my code? (i'm in kind of a hury to finish the project :S )?ScriptEngine engine = Python.CreateEngine();ScriptRuntime runtime = engine.Runtime;ScriptScope scope = runtime.CreateScope();ops = engine.Operations;try{ScriptSource source = engine.CreateScriptSourceFromFile("ironpython.py");source.Execute(scope);string class_param = rule;object[] parameters = new object[1];parameters[0] = class_param;object klass = scope.GetVariable("model_checker");object instance = ops.Invoke(klass, parameters);method = ops.GetMember(instance, "check_model");}catch (Exception e){Console.WriteLine(e.ToString());}?? --- On Thu, 14/4/11, Jeff Hardy wrote: From: Jeff Hardy Subject: Re: [IronPython] how to generate multiple concurrent scriptign engines? To: "Discussion of IronPython" Cc: "surangika ranathunga" Received: Thursday, 14 April, 2011, 7:35 AMAs long as you have a ScriptScope per thread, you should be able to share the ScriptEngine & Runtime between threads. What is the exception that you are getting? If it's a GUI program, remember that UI elements can only be manipulated from the main thread. - Jeff On Thu, Apr 14, 2011 at 1:02 AM, surangika ranathunga wrote: > > Hi, > I am using Ironpython to connect to a legacy python code from C#. > I am not fully familiar with Ironpython, but managed to get it working for a single-threaded application. > This is how I implemented this: > > ??????????????? ScriptEngine engine = Python.CreateEngine(); > ??????????????? ScriptRuntime runtime = engine.Runtime; > ??????????????? ScriptScope scope = runtime.CreateScope(); > ??????????????? ops = engine.Operations; > ??????????????? ScriptSource source = engine.CreateScriptSourceFromFile("ironpython.py"); > ??????????????? source.Execute(scope); > ??????????????? string class_param = rule; > ??????????????? object[] parameters = new object[1]; > ??????????????? parameters[0] = class_param; > ??????????????? object klass = scope.GetVariable("model_checker"); > ??????????????? object instance = ops.Invoke(klass, parameters); > ??????????????? method = ops.GetMember(instance, "check_model"); > > Now I want to make my application multi-threaded, and I want to have concurrently running scripting engines. Essentially, these engines should access the same underlying python code, and hence these scripting engines are identical to each other. > Without any change, the above code works fine for most of the time for a multi-threaded application. However, there is an exception that appears from time to time, and I suspect that it is due to a concurrency issue. > > Is there anything specific that I should do to generate multiple scripting engines running in separate threads without interfering with each other? > > any ideas greatly appreciated > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > ? -----Inline Attachment Follows----- _______________________________________________ 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 rawatsaurabh at yahoo.co.in Thu Apr 28 13:38:57 2011 From: rawatsaurabh at yahoo.co.in (saurabh rawat) Date: Thu, 28 Apr 2011 17:08:57 +0530 (IST) Subject: [IronPython] Unable to compare two junk character string in Iron Python.Do I need to include any particular encoding.?? In-Reply-To: <4DB6B8A7.7010707@googlemail.com> Message-ID: <523941.70977.qm@web137416.mail.in.yahoo.com> An iron python script may sometimes retrieve values that may contain junk values such as ?The Urbane fjnadlfkjsdglk pfjsdfgolsdg?? ? ? ??. Or you may assign such junk values to a variable ex: Artist = ?The Urbane fjnadlfkjsdglk pfjsdfgolsdg?? ? ? ??. ? When you try to save the file we encounter an error which says ?Invalid encoding, ascii saving as UTF-8? ? Solution: Close the script(.py) Open it now with note pad Click save as You can see ?Encoding? option Select ?Unicode? and click save ? Run the script, it will work fine. ? Note: You will not be able to open the script again with IDE. You can open it using note pad This is the answer soem one has given to me , and it worked too.... rgds,Saurabh ???????????????????????????????? ?????????????? " The ultimate test of a relationship is to disagree but to hold hands..............."? ?????????????? ? --- On Tue, 26/4/11, Jan-Philip Gehrcke wrote: From: Jan-Philip Gehrcke Subject: Re: [IronPython] Unable to compare two junk character string in Iron Python.Do I need to include any particular encoding.?? To: "Discussion of IronPython" Date: Tuesday, 26 April, 2011, 5:50 PM Saurabh, first of all, you did not provide an error message, but it looks like a decoding/unicode issue. Visit: http://stackoverflow.com/questions/368805/python-unicodedecodeerror-am-i-misunderstanding-encode The first answer should help a lot. Furthermore, this seems to be good literature on the field: http://www.joelonsoftware.com/articles/Unicode.html http://docs.python.org/howto/unicode.html Regarding the application of # -*- coding: coding -*-, read here: http://www.network-theory.co.uk/docs/pytut/SourceCodeEncoding.html So, in your case it looks like a good idea to use e.g. UTF-8 as source encoding. Check the settings of the text editor you are using and set the source encoding to UTF-8 (if it does not allow this, you should use another editor). Then, tell (Iron)Python that your source code is encoded by UTF-8 by putting this into the file header: # -*- coding: utf-8 -*-. Cheers, Jan-Philip On 04/26/2011 01:51 PM, saurabh rawat wrote: > > Hmm..you mean to say # -*- coding: utf-8-*- like this..will give it a > try..i have actually but no success or may be I am missing the correct > way to specify it. > Thanks and Rgds, > Saurabh >? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??? >? ? ? ? ? ? ? ? " /*The ultimate test of a relationship is to disagree > but to hold hands*............/..." >? ? ? ? ? ? ??? >? > > > --- On *Tue, 26/4/11, Lukas Cenovsky //* wrote: > > >? ???From: Lukas Cenovsky >? ???Subject: Re: [IronPython] Unable to compare two junk character >? ???string in Iron Python.Do I need to include any particular encoding.?? >? ???To: "Discussion of IronPython" >? ???Date: Tuesday, 26 April, 2011, 4:46 PM > >? ???You should use the same encoding as has you special character string. >? ???Have you tried using utf-8 instead of ascii? > >? ???-- >? ???-- Luk?? > > >? ???On 26.4.2011 11:56, saurabh rawat wrote: >> >>? ???HI, >>? ???I have problem while working with text containing the unknown >>? ???characters >>? ???I have a method which compare the variable song with "some special >>? ???character string"? and return true and false on the match and >>? ???mismatch respectively. >> >>? ???example >> >>? ???(0)song = The goodgoddevil robzombie pfjsdfgolsdg???? ?? ?? ?? >>? ???(1)if song == "The goodgoddevil robzombie pfjsdfgolsdg???? ?? ?? ??" >> >>? ???it exits as soon as it tries to execute the line (1) >> >> >>? ???I have go-ogled and found that something like this is to be? included >>? ???#!/usr/bin/python >>? ???# -*- coding: ascii -*- >> >>? ???But still the same behavior, i think some problem with the coding >>? ???- encoding standard. >>? ???Could plz somebody help. >> >>? ???Rgds, >>? ???Saurabh >>? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??? >>? ? ? ? ? ? ? ? ? ? " /*The ultimate test of a relationship is to >>? ???disagree but to hold hands*............/..." >>? ? ? ? ? ? ? ? ??? >>? ? ? >> >> >>? ???_______________________________________________ >>? ???Users mailing list >>? ???Users at lists.ironpython.com >>? ???http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > >? ???-----Inline Attachment Follows----- > >? ???_______________________________________________ >? ???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 sdementen at gmail.com Sat Apr 30 11:42:08 2011 From: sdementen at gmail.com (Sebastien de Menten) Date: Sat, 30 Apr 2011 11:42:08 +0200 Subject: [IronPython] ctypes .net interaction (casting a pointer to a .net object) Message-ID: <1304156528.1611.6.camel@sebastien-X71SL> Hi, In my effort to be able to use the GetRunningObjectTable in ironpython, I succeeded in recovering a pointer to a IBindCtx object by using the ctypes library. Is it possible to then "cast" this pointer (or transform it) to a IBindCtx Ironpython type on which I could call other methods ? And more generally, is it possible to use both the native .net objects in ipy and the ctypes library in ipy (and so transform from one world to the other) ? sebastien From dinov at microsoft.com Sat Apr 30 20:52:16 2011 From: dinov at microsoft.com (Dino Viehland) Date: Sat, 30 Apr 2011 18:52:16 +0000 Subject: [IronPython] ctypes .net interaction (casting a pointer to a .net object) In-Reply-To: <1304156528.1611.6.camel@sebastien-X71SL> References: <1304156528.1611.6.camel@sebastien-X71SL> Message-ID: <6C7ABA8B4E309440B857D74348836F2E1512F9FF@TK5EX14MBXC133.redmond.corp.microsoft.com> Sebastien wrote: > In my effort to be able to use the GetRunningObjectTable in ironpython, I > succeeded in recovering a pointer to a IBindCtx object by using the ctypes > library. > > Is it possible to then "cast" this pointer (or transform it) to a IBindCtx > Ironpython type on which I could call other methods ? You should be able to call Marshal.GetObjectForIUnknown such as: from System import IntPtr from System.Runtime.InteropServices import Marshal obj = Marshal.GetObjectForIUnknown(IntPtr(ptr)) >From there you should be able to do IBindCtx.GetRunningObjectTable(obj). If the COM object supports automation or provides type info then you could just do obj.GetRunningObjectTable(). > And more generally, is it possible to use both the native .net objects in ipy > and the ctypes library in ipy (and so transform from one world to the other) ? I think the answer to this is generally yes. In particular for COM objects you can because of the CLR and IronPython's support for COM interop. If you're dealing with other plain old structures and you have a .NET version of them you'll just need to copy all of the fields yourself .