From cyberpro60 at hotmail.com Sat Mar 1 12:47:21 2008 From: cyberpro60 at hotmail.com (cyberpro60 at hotmail.com) Date: Sat, 1 Mar 2008 22:47:21 +1100 Subject: [IronPython] Integration: now I am totally confused Message-ID: I have read through ALL the posts that mention integration of Iron Python into Visual Studio and I have to admit that I am now more confused than before I started. From my perspective it seems that the IP website actually exacerbates the confusion by NOT stating the obvious. Just so you know: I want to know if the latest beta version (IP v2.00 or any version) integrates into the full release version Visual Studio 2008 and I can't find a clear cut answer to this question anywhere! Sure, I have read the Iron Python Studio page and yes, I do know that you can build a standalone VS look-a-like [isolated] version running in a Visual Studio Shell - which is fine if you don't have Visual Studio installed. But what if you do? I have Visual Studio 2008 installed - so does IP automatically integrate with it upon installation? If it doesn't what do I have to do to get it to happen without wrecking my Visual Studio installation? For example, Microsoft says that you can get IP working in BOTH isolated AND integrated modes ???? Is this still true of the latest release candidates ? Visual Studio 2008 Shell (Isolated) is listed as a "prerequisite" for Python Studio .... which obviously doesn't look like it will work if you have VS 2008 already installed. So can you use Visual Studio Shell (Integrated) instead?? So many questions .... so few answers. (it sort of looks like we haven't advanced much beyond the days when IP was first offered as an "Integrated" component of Visual Studio --- which sort of worked sometimes ... a little bit ... if you were really lucky. There seems to be such a mass of conflicting information out there which is all so unnecessary - all it takes is for one of the developers to post a clear and unequivocal statement about this issue on IP website. Problem solved! If IP integrates right now then fine .... if it doesn't then I will wait until it does. What I can't afford to do is stuff up my current VS installation experimenting with something that I have no idea is going to work or not. Thanks in anticipation for any forthcoming "enlightenment"! -------------- next part -------------- An HTML attachment was scrubbed... URL: From stalya at zeomega.com Mon Mar 3 11:14:10 2008 From: stalya at zeomega.com (Suma Talya) Date: Mon, 03 Mar 2008 15:44:10 +0530 Subject: [IronPython] Exporting Python code as an assembly (Curt Hagenlocher) Message-ID: <47CBCF72.8060703@zeomega.com> Hi, I am having 2.0 alpha 8 of IronPython Binaries. I downloaded the wrapper changes with comment "Fixed constructor to call __init__" version no. 7386 from http://www.codeplex.com/coils/SourceControl/ListDownloadableCommits.aspx As soon as I create .dll file using MakeModule.py, I m renaming the py file. Now from ironpython interpreter i m trying to import dll file and create instance. It is failing to create instance, >>> import clr >>> clr.AddReference('IronPythonDLL.dll') >>> import IronPythonDLL >>> IronPythonDLL.IronPythonClass >>> o=IronPythonDLL.IronPythonClass() Traceback (most recent call last): File IronPythonDLL, line unknown, in .ctor File IronPythonDLL, line unknown, in InitClass File , line unknown, in ##26 TypeError: Value cannot be null. Parameter name: scriptSource Do we need to have py file also in the same directory along with dll? Thanks, -Suma. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dfugate at microsoft.com Mon Mar 3 17:45:51 2008 From: dfugate at microsoft.com (Dave Fugate) Date: Mon, 3 Mar 2008 08:45:51 -0800 Subject: [IronPython] Integration: now I am totally confused In-Reply-To: References: Message-ID: <7346A825E148B049A9AD1D3ED46A2D91235133694F@NA-EXMSG-C106.redmond.corp.microsoft.com> IronPythonStudio is developed by Clarius Consulting Labs (http://www.codeplex.com/clarius), and I'm a little unsure as to whether they monitor this list. Have you tried contacting them directly about your question(s)? If not, I found an email address (info at clariusconsulting.net) on their site that might be helpful. An alternative you might want to also try is using the IronPython Community Technology Preview for ASP.NET (http://www.asp.net/ironpython/). This installs directly into the full release version of Visual Studio 2008, is based on IronPython 2.0 Alpha 1 or 2, and provides features such as Python intellisense for VS. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of cyberpro60 at hotmail.com Sent: Saturday, March 01, 2008 3:47 AM To: users at lists.ironpython.com Subject: [IronPython] Integration: now I am totally confused I have read through ALL the posts that mention integration of Iron Python into Visual Studio and I have to admit that I am now more confused than before I started. From my perspective it seems that the IP website actually exacerbates the confusion by NOT stating the obvious. Just so you know: I want to know if the latest beta version (IP v2.00 or any version) integrates into the full release version Visual Studio 2008 and I can't find a clear cut answer to this question anywhere! Sure, I have read the Iron Python Studio page and yes, I do know that you can build a standalone VS look-a-like [isolated] version running in a Visual Studio Shell - which is fine if you don't have Visual Studio installed. But what if you do? I have Visual Studio 2008 installed - so does IP automatically integrate with it upon installation? If it doesn't what do I have to do to get it to happen without wrecking my Visual Studio installation? For example, Microsoft says that you can get IP working in BOTH isolated AND integrated modes ???? Is this still true of the latest release candidates ? Visual Studio 2008 Shell (Isolated) is listed as a "prerequisite" for Python Studio .... which obviously doesn't look like it will work if you have VS 2008 already installed. So can you use Visual Studio Shell (Integrated) instead?? So many questions .... so few answers. (it sort of looks like we haven't advanced much beyond the days when IP was first offered as an "Integrated" component of Visual Studio --- which sort of worked sometimes ... a little bit ... if you were really lucky. There seems to be such a mass of conflicting information out there which is all so unnecessary - all it takes is for one of the developers to post a clear and unequivocal statement about this issue on IP website. Problem solved! If IP integrates right now then fine .... if it doesn't then I will wait until it does. What I can't afford to do is stuff up my current VS installation experimenting with something that I have no idea is going to work or not. Thanks in anticipation for any forthcoming "enlightenment"! -------------- next part -------------- An HTML attachment was scrubbed... URL: From rpigneri at LavaStorm.com Mon Mar 3 17:59:32 2008 From: rpigneri at LavaStorm.com (Pigneri, Rocco) Date: Mon, 3 Mar 2008 11:59:32 -0500 Subject: [IronPython] Integration: now I am totally confused In-Reply-To: References: Message-ID: Dear "cyberpro60", I, too, have run into your problems and share your experiences. Unfortunately, it seems that the maintainer of IPStudio is not answering e-mail on this list although others, such as Michael Foord, have been kind enough to answer whatever questions they can about IPStudio. Here is what I have discovered from playing with IPS: - IPS is a new, isolated version of the IronPythonIntegration VSX example project from the VS SDK's. As far as I can tell, IPS cannot be integrated into the full VS, thus making it more difficult to use IPY with static languages such as C#. IronPythonIntegration is still available and may be able to integrate with the rest of VS, but I have not yet tried it. - IPS will not hurt any installed versions of VS. I have three different versions installed, and none of them has been hurt at all. - I could not get IPS to work with 1.1.1. There's a directory under where IPS is installed that has IronPython.dll and IronMath.dll in their 1.1.0 versions. Replacing them with 1.1.1 didn't produce any runtime changes. - Microsoft's website claims that you can build language backends that use both the isolated and integrated modes. However, IPS's website only states that you need the isolated mode. It's mum about using integrated mode. - IMHO, IPS is still very much an "alpha" product. While it does offer quite a bit of functionality, I was unable to perform many common VS tasks (creating references to projects or stand-alone DLL's, using UI widgets that require resources, deleting files from a project, and others) that are needed in larger projects. I found it particularly strong in creating WinForms forms and dialogs whose Python code can then be pulled out of IPS and used with minimal changes in the rest of your application. However, I do advise writing any code for your UI outside of IPS. Any syntax or reference errors cause the GUI builder to disappear until you fix the problem and then reload the GUI editor. Hope that helps, Rocco ________________________________ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of cyberpro60 at hotmail.com Sent: Saturday, March 01, 2008 6:47 AM To: users at lists.ironpython.com Subject: [IronPython] Integration: now I am totally confused I have read through ALL the posts that mention integration of Iron Python into Visual Studio and I have to admit that I am now more confused than before I started. From my perspective it seems that the IP website actually exacerbates the confusion by NOT stating the obvious. Just so you know: I want to know if the latest beta version (IP v2.00 or any version) integrates into the full release version Visual Studio 2008 and I can't find a clear cut answer to this question anywhere! Sure, I have read the Iron Python Studio page and yes, I do know that you can build a standalone VS look-a-like [isolated] version running in a Visual Studio Shell - which is fine if you don't have Visual Studio installed. But what if you do? I have Visual Studio 2008 installed - so does IP automatically integrate with it upon installation? If it doesn't what do I have to do to get it to happen without wrecking my Visual Studio installation? For example, Microsoft says that you can get IP working in BOTH isolated AND integrated modes ???? Is this still true of the latest release candidates ? Visual Studio 2008 Shell (Isolated) is listed as a "prerequisite" for Python Studio .... which obviously doesn't look like it will work if you have VS 2008 already installed. So can you use Visual Studio Shell (Integrated) instead?? So many questions .... so few answers. (it sort of looks like we haven't advanced much beyond the days when IP was first offered as an "Integrated" component of Visual Studio --- which sort of worked sometimes ... a little bit ... if you were really lucky. There seems to be such a mass of conflicting information out there which is all so unnecessary - all it takes is for one of the developers to post a clear and unequivocal statement about this issue on IP website. Problem solved! If IP integrates right now then fine .... if it doesn't then I will wait until it does. What I can't afford to do is stuff up my current VS installation experimenting with something that I have no idea is going to work or not. Thanks in anticipation for any forthcoming "enlightenment"! -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Mon Mar 3 18:38:31 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 3 Mar 2008 09:38:31 -0800 Subject: [IronPython] Integration: now I am totally confused In-Reply-To: References: Message-ID: <7AD436E4270DD54A94238001769C2227011CF570CD42@DF-GRTDANE-MSG.exchange.corp.microsoft.com> For integrated mode you can use the VS SDK sample of IronPython which IPS is based off of. But it's more onerous as you need to build the sample it's not just something you download and install. I do agree though that this is an alpha product - after all at its core is just a sample. While we're on the subject I'll just point out the developer position we're hiring for (http://members.microsoft.com/careers/search/details.aspx?JobID=8BEEE2C2-A95D-41C6-9075-CF6347EE07F1) specifically calls out us wanting to include VS IDE support. So this is something we want to do but we need someone to do it :). From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Pigneri, Rocco Sent: Monday, March 03, 2008 9:00 AM To: Discussion of IronPython Subject: Re: [IronPython] Integration: now I am totally confused Dear "cyberpro60", I, too, have run into your problems and share your experiences. Unfortunately, it seems that the maintainer of IPStudio is not answering e-mail on this list although others, such as Michael Foord, have been kind enough to answer whatever questions they can about IPStudio. Here is what I have discovered from playing with IPS: - IPS is a new, isolated version of the IronPythonIntegration VSX example project from the VS SDK's. As far as I can tell, IPS cannot be integrated into the full VS, thus making it more difficult to use IPY with static languages such as C#. IronPythonIntegration is still available and may be able to integrate with the rest of VS, but I have not yet tried it. - IPS will not hurt any installed versions of VS. I have three different versions installed, and none of them has been hurt at all. - I could not get IPS to work with 1.1.1. There's a directory under where IPS is installed that has IronPython.dll and IronMath.dll in their 1.1.0 versions. Replacing them with 1.1.1 didn't produce any runtime changes. - Microsoft's website claims that you can build language backends that use both the isolated and integrated modes. However, IPS's website only states that you need the isolated mode. It's mum about using integrated mode. - IMHO, IPS is still very much an "alpha" product. While it does offer quite a bit of functionality, I was unable to perform many common VS tasks (creating references to projects or stand-alone DLL's, using UI widgets that require resources, deleting files from a project, and others) that are needed in larger projects. I found it particularly strong in creating WinForms forms and dialogs whose Python code can then be pulled out of IPS and used with minimal changes in the rest of your application. However, I do advise writing any code for your UI outside of IPS. Any syntax or reference errors cause the GUI builder to disappear until you fix the problem and then reload the GUI editor. Hope that helps, Rocco ________________________________ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of cyberpro60 at hotmail.com Sent: Saturday, March 01, 2008 6:47 AM To: users at lists.ironpython.com Subject: [IronPython] Integration: now I am totally confused I have read through ALL the posts that mention integration of Iron Python into Visual Studio and I have to admit that I am now more confused than before I started. From my perspective it seems that the IP website actually exacerbates the confusion by NOT stating the obvious. Just so you know: I want to know if the latest beta version (IP v2.00 or any version) integrates into the full release version Visual Studio 2008 and I can't find a clear cut answer to this question anywhere! Sure, I have read the Iron Python Studio page and yes, I do know that you can build a standalone VS look-a-like [isolated] version running in a Visual Studio Shell - which is fine if you don't have Visual Studio installed. But what if you do? I have Visual Studio 2008 installed - so does IP automatically integrate with it upon installation? If it doesn't what do I have to do to get it to happen without wrecking my Visual Studio installation? For example, Microsoft says that you can get IP working in BOTH isolated AND integrated modes ???? Is this still true of the latest release candidates ? Visual Studio 2008 Shell (Isolated) is listed as a "prerequisite" for Python Studio .... which obviously doesn't look like it will work if you have VS 2008 already installed. So can you use Visual Studio Shell (Integrated) instead?? So many questions .... so few answers. (it sort of looks like we haven't advanced much beyond the days when IP was first offered as an "Integrated" component of Visual Studio --- which sort of worked sometimes ... a little bit ... if you were really lucky. There seems to be such a mass of conflicting information out there which is all so unnecessary - all it takes is for one of the developers to post a clear and unequivocal statement about this issue on IP website. Problem solved! If IP integrates right now then fine .... if it doesn't then I will wait until it does. What I can't afford to do is stuff up my current VS installation experimenting with something that I have no idea is going to work or not. Thanks in anticipation for any forthcoming "enlightenment"! -------------- next part -------------- An HTML attachment was scrubbed... URL: From rpigneri at LavaStorm.com Mon Mar 3 18:43:24 2008 From: rpigneri at LavaStorm.com (Pigneri, Rocco) Date: Mon, 3 Mar 2008 12:43:24 -0500 Subject: [IronPython] Integration: now I am totally confused In-Reply-To: <7AD436E4270DD54A94238001769C2227011CF570CD42@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <7AD436E4270DD54A94238001769C2227011CF570CD42@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: Dino, That sounds great. Robust dev tool support would really help IPY. One thing that I would recommend is support for integrating IPY with full VS. That would easily allow developers to exploit the full power of .NET with IPY and whatever other languages they choose. Rocco ________________________________ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: Monday, March 03, 2008 12:39 PM To: Discussion of IronPython Subject: Re: [IronPython] Integration: now I am totally confused For integrated mode you can use the VS SDK sample of IronPython which IPS is based off of. But it's more onerous as you need to build the sample it's not just something you download and install. I do agree though that this is an alpha product - after all at its core is just a sample. While we're on the subject I'll just point out the developer position we're hiring for (http://members.microsoft.com/careers/search/details.aspx?JobID=8BEEE2C2 -A95D-41C6-9075-CF6347EE07F1) specifically calls out us wanting to include VS IDE support. So this is something we want to do but we need someone to do it J. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Pigneri, Rocco Sent: Monday, March 03, 2008 9:00 AM To: Discussion of IronPython Subject: Re: [IronPython] Integration: now I am totally confused Dear "cyberpro60", I, too, have run into your problems and share your experiences. Unfortunately, it seems that the maintainer of IPStudio is not answering e-mail on this list although others, such as Michael Foord, have been kind enough to answer whatever questions they can about IPStudio. Here is what I have discovered from playing with IPS: - IPS is a new, isolated version of the IronPythonIntegration VSX example project from the VS SDK's. As far as I can tell, IPS cannot be integrated into the full VS, thus making it more difficult to use IPY with static languages such as C#. IronPythonIntegration is still available and may be able to integrate with the rest of VS, but I have not yet tried it. - IPS will not hurt any installed versions of VS. I have three different versions installed, and none of them has been hurt at all. - I could not get IPS to work with 1.1.1. There's a directory under where IPS is installed that has IronPython.dll and IronMath.dll in their 1.1.0 versions. Replacing them with 1.1.1 didn't produce any runtime changes. - Microsoft's website claims that you can build language backends that use both the isolated and integrated modes. However, IPS's website only states that you need the isolated mode. It's mum about using integrated mode. - IMHO, IPS is still very much an "alpha" product. While it does offer quite a bit of functionality, I was unable to perform many common VS tasks (creating references to projects or stand-alone DLL's, using UI widgets that require resources, deleting files from a project, and others) that are needed in larger projects. I found it particularly strong in creating WinForms forms and dialogs whose Python code can then be pulled out of IPS and used with minimal changes in the rest of your application. However, I do advise writing any code for your UI outside of IPS. Any syntax or reference errors cause the GUI builder to disappear until you fix the problem and then reload the GUI editor. Hope that helps, Rocco ________________________________ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of cyberpro60 at hotmail.com Sent: Saturday, March 01, 2008 6:47 AM To: users at lists.ironpython.com Subject: [IronPython] Integration: now I am totally confused I have read through ALL the posts that mention integration of Iron Python into Visual Studio and I have to admit that I am now more confused than before I started. From my perspective it seems that the IP website actually exacerbates the confusion by NOT stating the obvious. Just so you know: I want to know if the latest beta version (IP v2.00 or any version) integrates into the full release version Visual Studio 2008 and I can't find a clear cut answer to this question anywhere! Sure, I have read the Iron Python Studio page and yes, I do know that you can build a standalone VS look-a-like [isolated] version running in a Visual Studio Shell - which is fine if you don't have Visual Studio installed. But what if you do? I have Visual Studio 2008 installed - so does IP automatically integrate with it upon installation? If it doesn't what do I have to do to get it to happen without wrecking my Visual Studio installation? For example, Microsoft says that you can get IP working in BOTH isolated AND integrated modes ???? Is this still true of the latest release candidates ? Visual Studio 2008 Shell (Isolated) is listed as a "prerequisite" for Python Studio .... which obviously doesn't look like it will work if you have VS 2008 already installed. So can you use Visual Studio Shell (Integrated) instead?? So many questions .... so few answers. (it sort of looks like we haven't advanced much beyond the days when IP was first offered as an "Integrated" component of Visual Studio --- which sort of worked sometimes ... a little bit ... if you were really lucky. There seems to be such a mass of conflicting information out there which is all so unnecessary - all it takes is for one of the developers to post a clear and unequivocal statement about this issue on IP website. Problem solved! If IP integrates right now then fine .... if it doesn't then I will wait until it does. What I can't afford to do is stuff up my current VS installation experimenting with something that I have no idea is going to work or not. Thanks in anticipation for any forthcoming "enlightenment"! -------------- next part -------------- An HTML attachment was scrubbed... URL: From acarter at teamdataforce.com Tue Mar 4 00:38:28 2008 From: acarter at teamdataforce.com (Adam Carter) Date: Mon, 3 Mar 2008 15:38:28 -0800 Subject: [IronPython] Integration: now I am totally confused In-Reply-To: References: Message-ID: <000c01c87d87$af71b1e0$0e5515a0$@com> Like someone else said: your best bet is to install the ASP.NET futures pack, which will add IP support to Visual Studio. You might also be interested in this blog post: http://blogs.msdn.com/haibo_luo/archive/2007/10/16/5482940.aspx Good luck, --Adam From fuzzyman at voidspace.org.uk Tue Mar 4 17:01:45 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 04 Mar 2008 16:01:45 +0000 Subject: [IronPython] PyCon Python and .NET Open Spaces Message-ID: <47CD7269.9060001@voidspace.org.uk> Hello all, Feihong Hsu, who is speaking at PyCon on Python.NET, is organising a 'Python and .NET' open spaces event. This is for IronPython and Python.NET users and anyone interested in Python and .NET. http://wiki.python.org/moin/PyCon2008/PythonDotNet It is too early to book a definite room/time - but he is thinking about Saturday night (March 14) from 7:00 to 8:30. See you there! He is also keen (and I think that it is an excellent idea), that as many people as possible involved in Python and .NET do lightning talks. I will be attempting to get together a lightning talk on the Resolver Systems 'Ironclad' project. Michael http://www.manning.com/foord From fuzzyman at voidspace.org.uk Tue Mar 4 17:26:29 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 04 Mar 2008 16:26:29 +0000 Subject: [IronPython] PyCon Python and .NET Open Spaces In-Reply-To: <47CD7269.9060001@voidspace.org.uk> References: <47CD7269.9060001@voidspace.org.uk> Message-ID: <47CD7835.4000604@voidspace.org.uk> Michael Foord wrote: > Hello all, > > Feihong Hsu, who is speaking at PyCon on Python.NET, is organising a > 'Python and .NET' open spaces event. This is for IronPython and > Python.NET users and anyone interested in Python and .NET. > > http://wiki.python.org/moin/PyCon2008/PythonDotNet > > It is too early to book a definite room/time - but he is thinking about > Saturday night (March 14) from 7:00 to 8:30. > Oops - that should be Saturday March 15th. Michael http://www.manning.com/foord > See you there! > > He is also keen (and I think that it is an excellent idea), that as many > people as possible involved in Python and .NET do lightning talks. I > will be attempting to get together a lightning talk on the Resolver > Systems 'Ironclad' project. > > Michael > http://www.manning.com/foord > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From harri.vartiainen at iki.fi Tue Mar 4 18:23:41 2008 From: harri.vartiainen at iki.fi (Harri Vartiainen) Date: Tue, 4 Mar 2008 19:23:41 +0200 Subject: [IronPython] Using callback function Message-ID: Hi, I'm trying to use callback function of dll. The API has VB.NET definition for callback: Public Class FosdkApi ... ' set callback function 'FOSDKLIB_API BOOL WINAPI FOSDKSetCallback(IN INT nCamIndex, ' IN INT (CALLBACK *pCallbackFunc)(VOID *pContext, DOUBLE SampleTime, BYTE *pBuf, LONG lBufferSize) ' IN VOID *pCBContext); Public Declare Function FOSDKSetCallback Lib "FOSDK" (ByVal nCamIndex As Long, ByVal pCallbackFunc As Long, ByVal pCBContext As Long) As Long Help(FosdkApi.FOSDKSetCallback) prints: Help on built-in function FOSDKSetCallback | FOSDKSetCallback(...) | Int64 FOSDKSetCallback(Int64 nCamIndex, Int64 pCallbackFunc, Int64 pCBContext) So how I can use that? From dinov at exchange.microsoft.com Tue Mar 4 20:24:56 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Tue, 4 Mar 2008 11:24:56 -0800 Subject: [IronPython] Using callback function In-Reply-To: References: Message-ID: <7AD436E4270DD54A94238001769C2227011CF5C2F1E4@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Calling it isn't really the interesting part, the interesting part is what arguments do you pass to it. To call it you just need to import the class that the function is defined in. You can do that using: import clr clr.AddReference('VBAssemblyName') from VBNamespaceName import * where VBAssemblyName is the name of the VB assembly and VBNamespaceName is the name of the namespace this type lives in. From there you should be able to do: VBTypeName.FOSDKSetCallback(...) Then the question becomes what do you pass for nCamIndex, pCallbackFunc, and pCBContext. But before we go there there's a few interesting things about the signatures. First is that they're declared as taking Int64's instead of IntPtr's. If this is your own DLL then you probably want to change these to IntPtrs so they're passing the right size data on both 32-bit and 64-bit platforms. Then your callback function would look something like: Public Declare Function FOSDKSetCallback Lib "FOSDK" (ByVal nCamIndex As IntPtr, ByVal pCallbackFunc As Long, ByVal pCBContext As IntPtr) As Long The 2nd oddity is that pCallbackFunc is not taking a delegate. That means you'll need to manually call Marshal.GetFunctionPointerForDelegate on a delegate object. Which also means you're going to need to manually construct the delegate object. Again if you can change the signature you probably want to have this taking a delegate typed something like (using the C# syntax here): delegate int MyDelegate(IntPtr pContext, double sampleTime, IntPtr pBuf, int lBufferSize); Then your VB function would end up looking something like: Public Declare Function FOSDKSetCallback Lib "FOSDK" (ByVal nCamIndex As Long, ByVal pCallbackFunc As MyDelegate, ByVal pCBContext As IntPtr) As Long >From there you should be able to do: def myCallback(context, sampleTime, buffer, bufferSize): print context, sampleTime, buffer, bufferSize from System import IntPtr FOSDKSetCallback(0, myCallback, IntPtr.Zero) The only interesting thing then is what you need to pass in for nCamIndex, hopefully the library documentation will explain that :) If you can't change the signature you'll still need to define the delegate type somewhere (which you can't do from IronPython). Then your call will probably end up looking like: from System import Marshal, Int64 FOSDKSetCallback(0, Int64(Marshal.GetFunctionPointerForDelegate(MyDelegate(myCallback))), 0) -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Harri Vartiainen Sent: Tuesday, March 04, 2008 9:24 AM To: users at lists.ironpython.com Subject: [IronPython] Using callback function Hi, I'm trying to use callback function of dll. The API has VB.NET definition for callback: Public Class FosdkApi ... ' set callback function 'FOSDKLIB_API BOOL WINAPI FOSDKSetCallback(IN INT nCamIndex, ' IN INT (CALLBACK *pCallbackFunc)(VOID *pContext, DOUBLE SampleTime, BYTE *pBuf, LONG lBufferSize) ' IN VOID *pCBContext); Public Declare Function FOSDKSetCallback Lib "FOSDK" (ByVal nCamIndex As Long, ByVal pCallbackFunc As Long, ByVal pCBContext As Long) As Long Help(FosdkApi.FOSDKSetCallback) prints: Help on built-in function FOSDKSetCallback | FOSDKSetCallback(...) | Int64 FOSDKSetCallback(Int64 nCamIndex, Int64 pCallbackFunc, Int64 pCBContext) So how I can use that? _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From harri.vartiainen at iki.fi Tue Mar 4 21:36:58 2008 From: harri.vartiainen at iki.fi (Harri Vartiainen) Date: Tue, 4 Mar 2008 22:36:58 +0200 Subject: [IronPython] Using callback function In-Reply-To: <7AD436E4270DD54A94238001769C2227011CF5C2F1E4@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <7AD436E4270DD54A94238001769C2227011CF5C2F1E4@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: Thank you for fast answer. Unfortunately the "fosdk" library is from vendor and I can't change that. The values of parameters are non-issue, I was lost with the declaration of callback function and passing the function to FOSDKSetCallback. I defined my own delegate (or copied from example I found from documentation): Imports System Imports System.Runtime.InteropServices public class MyDeleg Public Delegate Function MyCallback(ByVal pCBContext As Integer, ByVal SampleTime As Double, _ ByVal pBuf As IntPtr, ByVal lBufferSize As Integer) As Integer End Class Compiled it and all seemed go OK until the conversion to Int64, so I got to this: from System.Runtime.InteropServices import Marshal FOSDKSetCallback(0, Marshal.GetFunctionPointerForDelegate(MyDelegate(myCallback)).ToInt64(), 0) Seems pretty ok for now, next I've to figure out how to get the whole system working and start receiving callbacks, but that's different problem.. Some more VB.NET samples: 'Delgate for callback function Public Delegate Function MyCallback(ByVal pCBContext As Integer, ByVal SampleTime As Double, _ ByVal pBuf As IntPtr, ByVal lBufferSize As Integer) As Integer Private cb As MyCallback 'If the callback is called asynchronously, you have to ensure that the 'callback delegate is alive as long as the function poitner is needed. cb = AddressOf MyCallbackFunc FosdkApi.FOSDKSetCallback(g_iCrntCam, cb, 12) Public Function MyCallbackFunc(ByVal pCBContext As Integer, ByVal SampleTime As Double, _ ByVal pBuf As IntPtr, ByVal lBufferSize As Integer) As Integer sTime = SampleTime bSize = lBufferSize ThreadPool.QueueUserWorkItem(AddressOf ShowCallbackMsg) ' show messages in a seperate thread Return 1 End Function On Tue, Mar 4, 2008 at 9:24 PM, Dino Viehland wrote: > Calling it isn't really the interesting part, the interesting part is what arguments do you pass to it. > > To call it you just need to import the class that the function is defined in. You can do that using: > > import clr > clr.AddReference('VBAssemblyName') > from VBNamespaceName import * > > where VBAssemblyName is the name of the VB assembly and VBNamespaceName is the name of the namespace this type lives in. From there you should be able to do: > > VBTypeName.FOSDKSetCallback(...) > > Then the question becomes what do you pass for nCamIndex, pCallbackFunc, and pCBContext. > > But before we go there there's a few interesting things about the signatures. First is that they're declared as taking Int64's instead of IntPtr's. If this is your own DLL then you probably want to change these to IntPtrs so they're passing the right size data on both 32-bit and 64-bit platforms. Then your callback function would look something like: > > Public Declare Function FOSDKSetCallback Lib "FOSDK" (ByVal nCamIndex As IntPtr, ByVal pCallbackFunc As Long, ByVal pCBContext As IntPtr) As Long > > The 2nd oddity is that pCallbackFunc is not taking a delegate. That means you'll need to manually call Marshal.GetFunctionPointerForDelegate on a delegate object. Which also means you're going to need to manually construct the delegate object. Again if you can change the signature you probably want to have this taking a delegate typed something like (using the C# syntax here): > > delegate int MyDelegate(IntPtr pContext, double sampleTime, IntPtr pBuf, int lBufferSize); > > Then your VB function would end up looking something like: > > Public Declare Function FOSDKSetCallback Lib "FOSDK" (ByVal nCamIndex As Long, ByVal pCallbackFunc As MyDelegate, ByVal pCBContext As IntPtr) As Long > > >From there you should be able to do: > > def myCallback(context, sampleTime, buffer, bufferSize): > print context, sampleTime, buffer, bufferSize > > from System import IntPtr > FOSDKSetCallback(0, myCallback, IntPtr.Zero) > > The only interesting thing then is what you need to pass in for nCamIndex, hopefully the library documentation will explain that :) > > If you can't change the signature you'll still need to define the delegate type somewhere (which you can't do from IronPython). Then your call will probably end up looking like: > > from System import Marshal, Int64 > FOSDKSetCallback(0, Int64(Marshal.GetFunctionPointerForDelegate(MyDelegate(myCallback))), 0) > > > > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Harri Vartiainen > Sent: Tuesday, March 04, 2008 9:24 AM > To: users at lists.ironpython.com > Subject: [IronPython] Using callback function > > Hi, > > I'm trying to use callback function of dll. The API has VB.NET > definition for callback: > > Public Class FosdkApi > ... > ' set callback function > 'FOSDKLIB_API BOOL WINAPI FOSDKSetCallback(IN INT nCamIndex, > ' IN INT (CALLBACK > *pCallbackFunc)(VOID *pContext, DOUBLE SampleTime, BYTE *pBuf, LONG > lBufferSize) > ' > IN VOID *pCBContext); > > Public Declare Function FOSDKSetCallback Lib "FOSDK" (ByVal > nCamIndex As Long, ByVal pCallbackFunc As Long, ByVal pCBContext As > Long) As Long > > Help(FosdkApi.FOSDKSetCallback) prints: > > Help on built-in function FOSDKSetCallback > > | FOSDKSetCallback(...) > | Int64 FOSDKSetCallback(Int64 nCamIndex, Int64 > pCallbackFunc, Int64 pCBContext) > > So how I can use that? > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From curt at hagenlocher.org Wed Mar 5 13:57:56 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Wed, 5 Mar 2008 15:57:56 +0300 Subject: [IronPython] Exporting Python code as an assembly (Curt Hagenlocher) In-Reply-To: <47CBCF72.8060703@zeomega.com> References: <47CBCF72.8060703@zeomega.com> Message-ID: On 3/3/08, Suma Talya wrote: > > Do we need to have py file also in the same directory along with dll? > Yes, that is correct. -- Curt Hagenlocher curt at hagenlocher.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From william at resolversystems.com Thu Mar 6 12:01:59 2008 From: william at resolversystems.com (William Reade) Date: Thu, 06 Mar 2008 11:01:59 +0000 Subject: [IronPython] file.mode property doesn't exist Message-ID: <47CFCF27.7090301@resolversystems.com> Hi ---------------------------------------------------------------- IronPython 1.1.1 (1.1.1) on .NET 2.0.50727.312 Copyright (c) Microsoft Corporation. All rights reserved. >>> f = open("text.txt") >>> f.mode Traceback (most recent call last): File , line 0, in ##82 AttributeError: 'file' object has no attribute 'mode' >>> ---------------------------------------------------------------- Would it be possible to implement this property? I'm trying to implement PyFile_AsFile for Ironclad, and it would be enormously helpful to be able to retrieve a file's mode (for _fdopen in msvcrt.dll) without either (1) depending on a custom IronPython or (2) reflecting the real IronPython half to death. For now, I'm just going to assume that all files have been opened for reading, so I can get some useful functionality without it; still, I'd be very grateful if you would slip this into a nearish-future release (or, ofc, tell me what I failed to notice that makes my request unnecessary ;-) ). Cheers william From henry at cs.its.ac.id Thu Mar 6 17:24:15 2008 From: henry at cs.its.ac.id (henry at cs.its.ac.id) Date: Thu, 6 Mar 2008 23:24:15 +0700 (WIT) Subject: [IronPython] Call another Form from MDI Form Message-ID: <3024.10.126.11.154.1204820655.squirrel@webmail.cs.its.ac.id> hello all, I have MDI Form called mainForm and A Form called Form1. In the MDI Form, I added component like MenuStrip, ToolStripItem. When We click ToolStripItem component, it will load a Form1. Is there any example tutorial about this ? note : I'm using IronPythonIntegration for Visual Studio 2005. many thanks... From slide.o.mix at gmail.com Thu Mar 6 18:48:00 2008 From: slide.o.mix at gmail.com (Slide) Date: Thu, 6 Mar 2008 10:48:00 -0700 Subject: [IronPython] Converting Dict to generic Dictionary Message-ID: Is it possible to convert a Dict to a Dictionary? thanks -- slide-o-blog http://slide-o-blog.blogspot.com/ From srivatsn at microsoft.com Thu Mar 6 18:54:23 2008 From: srivatsn at microsoft.com (Srivatsn Narayanan) Date: Thu, 6 Mar 2008 09:54:23 -0800 Subject: [IronPython] Converting Dict to generic Dictionary In-Reply-To: References: Message-ID: <3FA51E96F92363468CF062D992DC846818CB77CCFB@NA-EXMSG-C106.redmond.corp.microsoft.com> You mean dict? This works: >>> from System.Collections.Generic import * >>> a = {'a':23, 'b':42 } >>> b = Dictionary[object,object](a) >>> b['a'] 23 >>> b.__class__ -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Slide Sent: Thursday, March 06, 2008 9:48 AM To: Discussion of IronPython Subject: [IronPython] Converting Dict to generic Dictionary Is it possible to convert a Dict to a Dictionary? thanks -- slide-o-blog http://slide-o-blog.blogspot.com/ _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From slide.o.mix at gmail.com Thu Mar 6 18:56:54 2008 From: slide.o.mix at gmail.com (Slide) Date: Thu, 6 Mar 2008 10:56:54 -0700 Subject: [IronPython] Converting Dict to generic Dictionary In-Reply-To: <3FA51E96F92363468CF062D992DC846818CB77CCFB@NA-EXMSG-C106.redmond.corp.microsoft.com> References: <3FA51E96F92363468CF062D992DC846818CB77CCFB@NA-EXMSG-C106.redmond.corp.microsoft.com> Message-ID: Thanks, I figured it out about 2 seconds after I hit send! On Thu, Mar 6, 2008 at 10:54 AM, Srivatsn Narayanan wrote: > You mean dict? This works: > > >>> from System.Collections.Generic import * > >>> a = {'a':23, 'b':42 } > >>> b = Dictionary[object,object](a) > >>> b['a'] > 23 > >>> b.__class__ > > > > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Slide > Sent: Thursday, March 06, 2008 9:48 AM > To: Discussion of IronPython > Subject: [IronPython] Converting Dict to generic Dictionary > > Is it possible to convert a Dict to a Dictionary? > > thanks > > -- > slide-o-blog > http://slide-o-blog.blogspot.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 > -- slide-o-blog http://slide-o-blog.blogspot.com/ From dfugate at microsoft.com Thu Mar 6 19:10:42 2008 From: dfugate at microsoft.com (Dave Fugate) Date: Thu, 6 Mar 2008 10:10:42 -0800 Subject: [IronPython] file.mode property doesn't exist In-Reply-To: <47CFCF27.7090301@resolversystems.com> References: <47CFCF27.7090301@resolversystems.com> Message-ID: <7346A825E148B049A9AD1D3ED46A2D9123513F659F@NA-EXMSG-C106.redmond.corp.microsoft.com> Thanks for the bug report. Filed as CodePlex 15484 - http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=15484. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of William Reade Sent: Thursday, March 06, 2008 3:02 AM To: users at lists.ironpython.com Subject: [IronPython] file.mode property doesn't exist Hi ---------------------------------------------------------------- IronPython 1.1.1 (1.1.1) on .NET 2.0.50727.312 Copyright (c) Microsoft Corporation. All rights reserved. >>> f = open("text.txt") >>> f.mode Traceback (most recent call last): File , line 0, in ##82 AttributeError: 'file' object has no attribute 'mode' >>> ---------------------------------------------------------------- Would it be possible to implement this property? I'm trying to implement PyFile_AsFile for Ironclad, and it would be enormously helpful to be able to retrieve a file's mode (for _fdopen in msvcrt.dll) without either (1) depending on a custom IronPython or (2) reflecting the real IronPython half to death. For now, I'm just going to assume that all files have been opened for reading, so I can get some useful functionality without it; still, I'd be very grateful if you would slip this into a nearish-future release (or, ofc, tell me what I failed to notice that makes my request unnecessary ;-) ). Cheers william _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From redmoon17 at gmail.com Fri Mar 7 04:38:53 2008 From: redmoon17 at gmail.com (Kevin Chu) Date: Fri, 7 Mar 2008 11:38:53 +0800 Subject: [IronPython] how to use IronPython in Silverlight 2 Message-ID: <41d7f4a90803061938v3e9c9fabna0cc270b1f14e640@mail.gmail.com> Silverlight 2 beta1 tools for VS2008 only create C# code file, How to create a IronPython code file? -- Once in a Redmoon -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Fri Mar 7 04:55:41 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Thu, 6 Mar 2008 19:55:41 -0800 Subject: [IronPython] how to use IronPython in Silverlight 2 In-Reply-To: <41d7f4a90803061938v3e9c9fabna0cc270b1f14e640@mail.gmail.com> References: <41d7f4a90803061938v3e9c9fabna0cc270b1f14e640@mail.gmail.com> Message-ID: <7AD436E4270DD54A94238001769C2227011CF5C2F949@DF-GRTDANE-MSG.exchange.corp.microsoft.com> You'll need to download the Silverlight 2 SDK. After installing that you'll get all the necessary components installed into something like C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Client. Also installed is an extremely useful tool called Chiron which you'll find somewhere around C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Tools\Chiron. Chiron can take your .py file and produce a .xap which includes the IronPython & DLR DLLs using the /zipdlr command line option. You can also use it to serve http requests and automatically serve up the .xap and let you just edit the files. So once you're ready to make your xap the directory you point at should contain a .py file (I'm not sure what the multi .py file experience is like, but w/ a single file the it doesn't seem the name matters). The simplest thing to put in there is: from System.Windows import Application from System.Windows.Markup import XamlReader Application.Current.RootVisual = XamlReader.Load("someXaml") You can see this from the Ruby perspective over at http://www.iunknown.com/2008/03/dynamic-silverl.html There's various options on how to deploy the DLLs, and you can get into manifest files to deploy additional DLLs, but hopefully that'll get you started. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kevin Chu Sent: Thursday, March 06, 2008 7:39 PM To: Discussion of IronPython Subject: [IronPython] how to use IronPython in Silverlight 2 Silverlight 2 beta1 tools for VS2008 only create C# code file, How to create a IronPython code file? -- Once in a Redmoon -------------- next part -------------- An HTML attachment was scrubbed... URL: From redmoon17 at gmail.com Fri Mar 7 18:31:44 2008 From: redmoon17 at gmail.com (Kevin Chu) Date: Sat, 8 Mar 2008 01:31:44 +0800 Subject: [IronPython] how to use IronPython in Silverlight 2 In-Reply-To: <7AD436E4270DD54A94238001769C2227011CF5C2F949@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <41d7f4a90803061938v3e9c9fabna0cc270b1f14e640@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011CF5C2F949@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <41d7f4a90803070931t174d5dc3k72310411ad0dece9@mail.gmail.com> hi Dino Thanks for your reply. But I try my sample (look attachment), It can't run! Is my code mistake ? *IronPython code:* from System.Windows import Application from System.Windows.Markup import XamlReader class App: def __init__(self): Application.Current.RootVisual = XamlReader.Load("app.xaml") self.scene = Application.Current.RootVisual.grid def start(self): # TO DO: Replace this with your application start logic. self.scene.message.Content = "Welcome to Silverlight and IronPython!" App().start() *XAML code:* On Fri, Mar 7, 2008 at 11:55 AM, Dino Viehland wrote: > You'll need to download the Silverlight 2 SDK. After installing that > you'll get all the necessary components installed into something like > C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Client. Also > installed is an extremely useful tool called Chiron which you'll find > somewhere around C:\Program Files\Microsoft > SDKs\Silverlight\v2.0\Tools\Chiron. Chiron can take your .py file and > produce a .xap which includes the IronPython & DLR DLLs using the /zipdlr > command line option. You can also use it to serve http requests and > automatically serve up the .xap and let you just edit the files. > > > > So once you're ready to make your xap the directory you point at should > contain a .py file (I'm not sure what the multi .py file experience is like, > but w/ a single file the it doesn't seem the name matters). The simplest > thing to put in there is: > > > > from System.Windows import Application > > from System.Windows.Markup import XamlReader > > > > Application.Current.RootVisual = XamlReader.Load("someXaml") > > > > You can see this from the Ruby perspective over at > http://www.iunknown.com/2008/03/dynamic-silverl.html > > > > There's various options on how to deploy the DLLs, and you can get into > manifest files to deploy additional DLLs, but hopefully that'll get you > started. > > > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Kevin Chu > *Sent:* Thursday, March 06, 2008 7:39 PM > *To:* Discussion of IronPython > *Subject:* [IronPython] how to use IronPython in Silverlight 2 > > > > Silverlight 2 beta1 tools for VS2008 only create C# code file, > > How to create a IronPython code file? > > -- > Once in a Redmoon > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -- Once in a Redmoon -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: IPSL2.zip Type: application/zip Size: 4890 bytes Desc: not available URL: From harri.vartiainen at iki.fi Fri Mar 7 19:23:44 2008 From: harri.vartiainen at iki.fi (Harri Vartiainen) Date: Fri, 7 Mar 2008 20:23:44 +0200 Subject: [IronPython] Crash Message-ID: Hi, I got my callback eventually working and found one bug/problem: If the callback function returns invalid type (eg. None), the IronPython crashes: Unhandled exception: Traceback (most recent call last): File , line 0, in System.Int32(Int32, Double, IntPtr, Int32)##154 TypeError: Cannot convert NoneType() to Int32 And then Windows displays the "program crashed - report to Microsoft" -dialog. From dinov at exchange.microsoft.com Fri Mar 7 20:13:39 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Fri, 7 Mar 2008 11:13:39 -0800 Subject: [IronPython] Crash In-Reply-To: References: Message-ID: <7AD436E4270DD54A94238001769C2227011CF5C2FA13@DF-GRTDANE-MSG.exchange.corp.microsoft.com> One thing that might help is running w/ -X:ExceptionDetail to get the full .NET stack trace. I also suspect this exception must be coming from the finalizer thread or from a newly created thread. Is your app multi-threaded? If you create threads w/ Python's thread module then your threads won't rip the process. In .NET 2.0 the CLR started ripping the process whenever there's an unhandled exception but we wrap new threads w/ an exception handler when starting from thread. Other than the fact that it looks like it's on a new thread though it looks like you're calling a method with null as the value and it's expecting an int32. Unfortunately we're not giving you a very useful stack trace. Seeing the full .NET stack trace would be interesting because there's probably something we can do to make this better. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Harri Vartiainen Sent: Friday, March 07, 2008 10:24 AM To: Discussion of IronPython Subject: [IronPython] Crash Hi, I got my callback eventually working and found one bug/problem: If the callback function returns invalid type (eg. None), the IronPython crashes: Unhandled exception: Traceback (most recent call last): File , line 0, in System.Int32(Int32, Double, IntPtr, Int32)##154 TypeError: Cannot convert NoneType() to Int32 And then Windows displays the "program crashed - report to Microsoft" -dialog. _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at exchange.microsoft.com Fri Mar 7 20:25:03 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Fri, 7 Mar 2008 11:25:03 -0800 Subject: [IronPython] how to use IronPython in Silverlight 2 In-Reply-To: <41d7f4a90803070931t174d5dc3k72310411ad0dece9@mail.gmail.com> References: <41d7f4a90803061938v3e9c9fabna0cc270b1f14e640@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011CF5C2F949@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <41d7f4a90803070931t174d5dc3k72310411ad0dece9@mail.gmail.com> Message-ID: <7AD436E4270DD54A94238001769C2227011CF5C2FA25@DF-GRTDANE-MSG.exchange.corp.microsoft.com> One problem is that XamlReader.Load takes the string of XAML and not a filename. But there's something about the XAML that isn't working right too. I'm no XAML expert but simplifying it to the code below works, you can probably build something up from that. Personally for my Silverlight hacking I've just been building up the tree programmatically from Python code even though that's uncool :). from System.Windows import Application from System.Windows.Markup import XamlReader Application.Current.RootVisual = XamlReader.Load(""" """) From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kevin Chu Sent: Friday, March 07, 2008 9:32 AM To: Discussion of IronPython Subject: Re: [IronPython] how to use IronPython in Silverlight 2 hi Dino Thanks for your reply. But I try my sample (look attachment), It can't run! Is my code mistake ? IronPython code: from System.Windows import Application from System.Windows.Markup import XamlReader class App: def __init__(self): Application.Current.RootVisual = XamlReader.Load("app.xaml") self.scene = Application.Current.RootVisual.grid def start(self): # TO DO: Replace this with your application start logic. self.scene.message.Content = "Welcome to Silverlight and IronPython!" App().start() XAML code: On Fri, Mar 7, 2008 at 11:55 AM, Dino Viehland > wrote: You'll need to download the Silverlight 2 SDK. After installing that you'll get all the necessary components installed into something like C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Client. Also installed is an extremely useful tool called Chiron which you'll find somewhere around C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Tools\Chiron. Chiron can take your .py file and produce a .xap which includes the IronPython & DLR DLLs using the /zipdlr command line option. You can also use it to serve http requests and automatically serve up the .xap and let you just edit the files. So once you're ready to make your xap the directory you point at should contain a .py file (I'm not sure what the multi .py file experience is like, but w/ a single file the it doesn't seem the name matters). The simplest thing to put in there is: from System.Windows import Application from System.Windows.Markup import XamlReader Application.Current.RootVisual = XamlReader.Load("someXaml") You can see this from the Ruby perspective over at http://www.iunknown.com/2008/03/dynamic-silverl.html There's various options on how to deploy the DLLs, and you can get into manifest files to deploy additional DLLs, but hopefully that'll get you started. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kevin Chu Sent: Thursday, March 06, 2008 7:39 PM To: Discussion of IronPython Subject: [IronPython] how to use IronPython in Silverlight 2 Silverlight 2 beta1 tools for VS2008 only create C# code file, How to create a IronPython code file? -- Once in a Redmoon _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- Once in a Redmoon -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidjensen at usa.net Fri Mar 7 20:25:21 2008 From: davidjensen at usa.net (David Jensen) Date: Fri, 07 Mar 2008 14:25:21 -0500 Subject: [IronPython] vs 2008 Message-ID: <574mcgTyV3508S01.1204917921@cmsweb01.cms.usa.net> I recently got vs 2008 professional and a computer powerful enough to run it. Is vs 2008 much better suited to IronPython? Can I now do everything in IronPython that I could do in C#? Can I get by with XP pro, or would Vista Ultimate or Server 2008 (both of which I also just got), be better. I assume all I need on XP Pro is .net 3.5. I would prefer doing everything in IronPython (web sites, etc.). David Jensen Apartment 412 414 West 120th Street New York, New York 10027 212-866-7094 646-245-2654 (cell) 206-984-4900 (fax to email) davidjensen at usa.net From dinov at exchange.microsoft.com Fri Mar 7 20:35:27 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Fri, 7 Mar 2008 11:35:27 -0800 Subject: [IronPython] vs 2008 In-Reply-To: <574mcgTyV3508S01.1204917921@cmsweb01.cms.usa.net> References: <574mcgTyV3508S01.1204917921@cmsweb01.cms.usa.net> Message-ID: <7AD436E4270DD54A94238001769C2227011CF5C2FA31@DF-GRTDANE-MSG.exchange.corp.microsoft.com> VS 2008 doesn't ship with support for IronPython. There was a recent thread here about VS integration - check out http://search.live.com/results.aspx?q=%22integration%3A+now+i+am+totally+confused%22&mkt=en-us&scope=&FORM=LIVSOP for more information. As for XP vs. Vista it shouldn't make much of a difference. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of David Jensen Sent: Friday, March 07, 2008 11:25 AM To: users at lists.ironpython.com Subject: [IronPython] vs 2008 I recently got vs 2008 professional and a computer powerful enough to run it. Is vs 2008 much better suited to IronPython? Can I now do everything in IronPython that I could do in C#? Can I get by with XP pro, or would Vista Ultimate or Server 2008 (both of which I also just got), be better. I assume all I need on XP Pro is .net 3.5. I would prefer doing everything in IronPython (web sites, etc.). David Jensen Apartment 412 414 West 120th Street New York, New York 10027 212-866-7094 646-245-2654 (cell) 206-984-4900 (fax to email) davidjensen at usa.net _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From harri.vartiainen at iki.fi Sat Mar 8 01:08:46 2008 From: harri.vartiainen at iki.fi (Harri Vartiainen) Date: Sat, 8 Mar 2008 02:08:46 +0200 Subject: [IronPython] Crash In-Reply-To: <7AD436E4270DD54A94238001769C2227011CF5C2FA13@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <7AD436E4270DD54A94238001769C2227011CF5C2FA13@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: I'm testing inside the interactive shell, there are no threads created by me but I think the DLL I am using uses threads. I think the this problem is originated from my own error, when I defined the callback function with no return value (it is expecting Int32). When return value is defined it runs fine. The exception is raised after the callback function has been executed first time by library. Here's the output with -X:ExceptionDetail and no return value defined inside the callback function: Unhandled exception: Cannot convert NoneType() to Int32 at IronPython.Runtime.Converter.ConvertToInt32(Object value) at System.Int32(Int32, Double, IntPtr, Int32)##162(Object , Int32 , Double , IntPtr , Int32 ) TypeError: Cannot convert NoneType() to Int32 Unhandled Exception: IronPython.Runtime.Exceptions.ArgumentTypeException: Cannot convert NoneType() to Int32 at IronPython.Runtime.Converter.ConvertToInt32(Object value) at System.Int32(Int32, Double, IntPtr, Int32)##162(Object , Int32 , Double , IntPtr , Int32 ) On 3/7/08, Dino Viehland wrote: > One thing that might help is running w/ -X:ExceptionDetail to get the full .NET stack trace. > > I also suspect this exception must be coming from the finalizer thread or from a newly created thread. Is your app multi-threaded? If you create threads w/ Python's thread module then your threads won't rip the process. In .NET 2.0 the CLR started ripping the process whenever there's an unhandled exception but we wrap new threads w/ an exception handler when starting from thread. > > Other than the fact that it looks like it's on a new thread though it looks like you're calling a method with null as the value and it's expecting an int32. Unfortunately we're not giving you a very useful stack trace. Seeing the full .NET stack trace would be interesting because there's probably something we can do to make this better. > > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Harri Vartiainen > Sent: Friday, March 07, 2008 10:24 AM > To: Discussion of IronPython > Subject: [IronPython] Crash > > Hi, > > I got my callback eventually working and found one bug/problem: > > If the callback function returns invalid type (eg. None), the > IronPython crashes: > > Unhandled exception: > Traceback (most recent call last): > File , line 0, in System.Int32(Int32, Double, IntPtr, Int32)##154 > TypeError: Cannot convert NoneType() to Int32 > > And then Windows displays the "program crashed - report to Microsoft" -dialog. > > _______________________________________________ > 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 fuzzyman at voidspace.org.uk Sun Mar 9 12:42:26 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sun, 09 Mar 2008 11:42:26 +0000 Subject: [IronPython] IronPython and Silverlight 2 Message-ID: <47D3CD22.8050406@voidspace.org.uk> Hello guys, I would like to create Silverlight 2 applications *without* using chiron to create and deploy them. How do I specify the Python application file? I see that I can still use Silverlight.js and the 'createObjectEx' function to initialise the Silverlight control in my html. How do I specify in 'app.xaml' the Python file to load? function createSilverlightEx() { Silverlight.createObjectEx({ source: 'app.xaml', // Source property value. parentElement:parentElement, // DOM reference to hosting DIV tag. id:'myPlugin', // Unique plug-in ID value. properties:{ // Plug-in properties. width:'1024', // Width of rectangular region of plug-in, in pixels. height:'530', // Height of rectangular region of plug-in, in pixels. inplaceInstallPrompt:false, // Determines whether to display in-place install prompt if invalid version is detected. background:'white', // Background color of plug-in. isWindowless:'false', // Determines whether to display plug-in in windowless mode. framerate:'24', // MaxFrameRate property value. version:'1.0'}, // Silverlight version. events:{ onError:null, // OnError property value -- event-handler function name. onLoad:null}, // OnLoad property value -- event-handler function name. initParams:null, // initParams property value -- user-settable string for information passing. context:null}); // Context value -- passed to Silverlight.js onLoad event handlers. } Thanks Michael From redmoon17 at gmail.com Sun Mar 9 13:12:29 2008 From: redmoon17 at gmail.com (Kevin Chu) Date: Sun, 9 Mar 2008 20:12:29 +0800 Subject: [IronPython] IronPython and Silverlight 2 In-Reply-To: <47D3CD22.8050406@voidspace.org.uk> References: <47D3CD22.8050406@voidspace.org.uk> Message-ID: <41d7f4a90803090512x4410a82at5cb9fd21162ffdc9@mail.gmail.com> Hi there is my blog about IronPython and Silverlight 2: http://www.cnblogs.com/redmoon/archive/2008/03/08/1096331.html I write it in Chinese, however you can translate it by Google Language Tool. And this blog contain some useful links. On Sun, Mar 9, 2008 at 7:42 PM, Michael Foord wrote: > Hello guys, > > I would like to create Silverlight 2 applications *without* using chiron > to create and deploy them. How do I specify the Python application file? > > I see that I can still use Silverlight.js and the 'createObjectEx' > function to initialise the Silverlight control in my html. How do I > specify in 'app.xaml' the Python file to load? > > > function createSilverlightEx() > { > Silverlight.createObjectEx({ > source: 'app.xaml', // Source property value. > parentElement:parentElement, // DOM reference to hosting DIV > tag. > id:'myPlugin', // Unique plug-in ID value. > properties:{ // Plug-in properties. > width:'1024', // Width of rectangular region > of plug-in, in pixels. > height:'530', // Height of rectangular region > of plug-in, in pixels. > inplaceInstallPrompt:false, // Determines whether to display > in-place install prompt if invalid version is detected. > background:'white', // Background color of plug-in. > isWindowless:'false', // Determines whether to display > plug-in in windowless mode. > framerate:'24', // MaxFrameRate property value. > version:'1.0'}, // Silverlight version. > events:{ > onError:null, // OnError property value -- > event-handler function name. > onLoad:null}, // OnLoad property value -- > event-handler function name. > initParams:null, // initParams property value -- > user-settable string for information passing. > context:null}); // Context value -- passed to > Silverlight.js onLoad event handlers. > } > > Thanks > > Michael > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- Once in a Redmoon -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Sun Mar 9 13:19:54 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sun, 9 Mar 2008 12:19:54 +0000 Subject: [IronPython] IronPython and Silverlight 2 In-Reply-To: <41d7f4a90803090512x4410a82at5cb9fd21162ffdc9@mail.gmail.com> References: <47D3CD22.8050406@voidspace.org.uk> <41d7f4a90803090512x4410a82at5cb9fd21162ffdc9@mail.gmail.com> Message-ID: <6f4025010803090519s6ba309efve0522b6dbd1a01e4@mail.gmail.com> On 09/03/2008, Kevin Chu wrote: > > Hi > there is my blog about IronPython and Silverlight 2: > http://www.cnblogs.com/redmoon/archive/2008/03/08/1096331.html > I write it in Chinese, however you can translate it by Google Language > Tool. > And this blog contain some useful links. > As far as I can tell (!) your blog only shows how to create a Dynamic Language Silverlight 2 application using 'app.xap' created with Chiron. I want to be able to create an application *without* Chiron which is deployed as text on the server (one of the great advantages of using Dynamic Languages with Silverlight as explained by Jim Hugunin at Mix07...). This means using a 'Silverlight.createObjectEx' call from Javascript in the webpage - where I can pass in the name of the xaml file to load. What I don't know is how in Silverlight 2 do I specify a Python file - either in the 'createObjectEx' call or in the xaml file it loads... I don't want to be dependent on Chiron for creating/deploying dynamic language applications, and I certainly don't want to have to hand roll XML manifest files. Hopefully this isn't necessary I just can't quite work it out yet. Michael On Sun, Mar 9, 2008 at 7:42 PM, Michael Foord > wrote: > > > Hello guys, > > > > I would like to create Silverlight 2 applications *without* using chiron > > to create and deploy them. How do I specify the Python application file? > > > > I see that I can still use Silverlight.js and the 'createObjectEx' > > function to initialise the Silverlight control in my html. How do I > > specify in 'app.xaml' the Python file to load? > > > > > > function createSilverlightEx() > > { > > Silverlight.createObjectEx({ > > source: 'app.xaml', // Source property value. > > parentElement:parentElement, // DOM reference to hosting DIV > > tag. > > id:'myPlugin', // Unique plug-in ID value. > > properties:{ // Plug-in properties. > > width:'1024', // Width of rectangular region > > of plug-in, in pixels. > > height:'530', // Height of rectangular region > > of plug-in, in pixels. > > inplaceInstallPrompt:false, // Determines whether to display > > in-place install prompt if invalid version is detected. > > background:'white', // Background color of plug-in. > > isWindowless:'false', // Determines whether to display > > plug-in in windowless mode. > > framerate:'24', // MaxFrameRate property value. > > version:'1.0'}, // Silverlight version. > > events:{ > > onError:null, // OnError property value -- > > event-handler function name. > > onLoad:null}, // OnLoad property value -- > > event-handler function name. > > initParams:null, // initParams property value -- > > user-settable string for information passing. > > context:null}); // Context value -- passed to > > Silverlight.js onLoad event handlers. > > } > > > > Thanks > > > > Michael > > > > > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > -- > Once in a Redmoon > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -- http://www.manning.com/foord http://www.voidspace.org.uk http://www.ironpython.info -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Sun Mar 9 15:15:52 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sun, 09 Mar 2008 14:15:52 +0000 Subject: [IronPython] Silverlight 2 Controls Message-ID: <47D3F118.8010409@voidspace.org.uk> Hello all, I'm adapting a Silverlight 2 controls example for IronPython. It is based on: http://silverlight.net/Samples/2b1/SilverlightControls/run/default.html It seems that the shiny new controls, like Button, ToggleButton, WatermarkedTextBox (etc) don't come 'out of the box' with Silverlight2. From downloading this example I can see the example includes several dlls - presumably ones that *extend* System.Windows.Controls. As a result XAML that uses elements like these throws parse errors with not-recognised elements. I have these dlls - how do I add them to my IronPython project? If I just add a reference to 'System.Windows.Controls' will it use the new dlls? Thanks Michael http://www.manning.com/foord From dinov at exchange.microsoft.com Sun Mar 9 19:18:17 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Sun, 9 Mar 2008 11:18:17 -0700 Subject: [IronPython] IronPython and Silverlight 2 In-Reply-To: <6f4025010803090519s6ba309efve0522b6dbd1a01e4@mail.gmail.com> References: <47D3CD22.8050406@voidspace.org.uk> <41d7f4a90803090512x4410a82at5cb9fd21162ffdc9@mail.gmail.com>, <6f4025010803090519s6ba309efve0522b6dbd1a01e4@mail.gmail.com> Message-ID: <7AD436E4270DD54A94238001769C2227011CF5A826FE@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Hand rolling XML manifest files is really just create one and re-use it all over the place. This is what it typically looks like: Drop that in a .ZIP file w/ the python file and those DLLs and rename it .xap. Unfortunately I don't believe there's a way to just deploy a .py file. The current model is you have the manfiest which points at DynamicApplication and that in turn loads the language and subsequently the .py file. Somehow the referred assemblies can be somewhere else as well but I'm not sure what that looks like. ________________________________ From: users-bounces at lists.ironpython.com [users-bounces at lists.ironpython.com] On Behalf Of Michael Foord [fuzzyman at voidspace.org.uk] Sent: Sunday, March 09, 2008 5:19 AM To: Discussion of IronPython Subject: Re: [IronPython] IronPython and Silverlight 2 On 09/03/2008, Kevin Chu > wrote: Hi there is my blog about IronPython and Silverlight 2:http://www.cnblogs.com/redmoon/archive/2008/03/08/1096331.html I write it in Chinese, however you can translate it by Google Language Tool. And this blog contain some useful links. As far as I can tell (!) your blog only shows how to create a Dynamic Language Silverlight 2 application using 'app.xap' created with Chiron. I want to be able to create an application *without* Chiron which is deployed as text on the server (one of the great advantages of using Dynamic Languages with Silverlight as explained by Jim Hugunin at Mix07...). This means using a 'Silverlight.createObjectEx' call from Javascript in the webpage - where I can pass in the name of the xaml file to load. What I don't know is how in Silverlight 2 do I specify a Python file - either in the 'createObjectEx' call or in the xaml file it loads... I don't want to be dependent on Chiron for creating/deploying dynamic language applications, and I certainly don't want to have to hand roll XML manifest files. Hopefully this isn't necessary I just can't quite work it out yet. Michael On Sun, Mar 9, 2008 at 7:42 PM, Michael Foord > wrote: Hello guys, I would like to create Silverlight 2 applications *without* using chiron to create and deploy them. How do I specify the Python application file? I see that I can still use Silverlight.js and the 'createObjectEx' function to initialise the Silverlight control in my html. How do I specify in 'app.xaml' the Python file to load? function createSilverlightEx() { Silverlight.createObjectEx({ source: 'app.xaml', // Source property value. parentElement:parentElement, // DOM reference to hosting DIV tag. id:'myPlugin', // Unique plug-in ID value. properties:{ // Plug-in properties. width:'1024', // Width of rectangular region of plug-in, in pixels. height:'530', // Height of rectangular region of plug-in, in pixels. inplaceInstallPrompt:false, // Determines whether to display in-place install prompt if invalid version is detected. background:'white', // Background color of plug-in. isWindowless:'false', // Determines whether to display plug-in in windowless mode. framerate:'24', // MaxFrameRate property value. version:'1.0'}, // Silverlight version. events:{ onError:null, // OnError property value -- event-handler function name. onLoad:null}, // OnLoad property value -- event-handler function name. initParams:null, // initParams property value -- user-settable string for information passing. context:null}); // Context value -- passed to Silverlight.js onLoad event handlers. } Thanks Michael _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- Once in a Redmoon _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- http://www.manning.com/foord http://www.voidspace.org.uk http://www.ironpython.info -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Sun Mar 9 19:18:20 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Sun, 9 Mar 2008 11:18:20 -0700 Subject: [IronPython] Silverlight 2 Controls In-Reply-To: <47D3F118.8010409@voidspace.org.uk> References: <47D3F118.8010409@voidspace.org.uk> Message-ID: <7AD436E4270DD54A94238001769C2227011CF5A826FF@DF-GRTDANE-MSG.exchange.corp.microsoft.com> This comes back to the manifest mentioned in the previous question. You can update the manfiest to contain the additional assemblies which are included w/ the Silverlight SDK. Those assemblies will get loaded allowing the XAML to parse. ________________________________________ From: users-bounces at lists.ironpython.com [users-bounces at lists.ironpython.com] On Behalf Of Michael Foord [fuzzyman at voidspace.org.uk] Sent: Sunday, March 09, 2008 7:15 AM To: Discussion of IronPython Subject: [IronPython] Silverlight 2 Controls Hello all, I'm adapting a Silverlight 2 controls example for IronPython. It is based on: http://silverlight.net/Samples/2b1/SilverlightControls/run/default.html It seems that the shiny new controls, like Button, ToggleButton, WatermarkedTextBox (etc) don't come 'out of the box' with Silverlight2. From downloading this example I can see the example includes several dlls - presumably ones that *extend* System.Windows.Controls. As a result XAML that uses elements like these throws parse errors with not-recognised elements. I have these dlls - how do I add them to my IronPython project? If I just add a reference to 'System.Windows.Controls' will it use the new dlls? Thanks Michael http://www.manning.com/foord _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Sun Mar 9 21:03:52 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sun, 09 Mar 2008 20:03:52 +0000 Subject: [IronPython] IronPython and Silverlight 2 In-Reply-To: <7AD436E4270DD54A94238001769C2227011CF5A826FE@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <47D3CD22.8050406@voidspace.org.uk> <41d7f4a90803090512x4410a82at5cb9fd21162ffdc9@mail.gmail.com>, <6f4025010803090519s6ba309efve0522b6dbd1a01e4@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011CF5A826FE@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <47D442A8.1040507@voidspace.org.uk> Dino Viehland wrote: > Hand rolling XML manifest files is really just create one and re-use > it all over the place. This is what it typically looks like: > > xmlns="http://schemas.microsoft.com/client/2007/deployment" > xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > RuntimeVersion="2.0.30226.00" > EntryPointAssembly="Microsoft.Scripting.Silverlight" > EntryPointType="Microsoft.Scripting.Silverlight.DynamicApplication"> > > > Source="Microsoft.Scripting.Silverlight.dll" /> > > > > > > > Drop that in a .ZIP file w/ the python file and those DLLs and rename > it .xap. Unfortunately I don't believe there's a way to just deploy a > .py file. The current model is you have the manfiest which points at > DynamicApplication and that in turn loads the language and > subsequently the .py file. > > Somehow the referred assemblies can be somewhere else as well but I'm > not sure what that looks like. > Ok. I've been playing with manifest files and still can't use the extra controls. See separate email. Can you confirm that (as far as you know) this means that *every* IronPython Silverlight application has to send the IronPython dlls. Plus if I want to make the standard library available (for a Python interactive interpreter for example) then I have to package the *whole* standard library in the 'xap' file? This is instead of the previous model (fro Silverlight 1.1) where assemblies and Python files would only be fetched from the server if they were actually needed. If what I have just said is true then the new model is *massively* inferior in my opinion. It is also ironic that Jim Hugunin and John Lam (in Mix 07) made much of how the great advantages of working with dynamic languages for Silverlight is that they can be deployed as text. Now of course they need to be 'compiled' with a custom tool (chiron) and deployed in this compiled form - and not deployed as text... Feel free to pass my comments on to those who made these decisions (I'm well aware it isn't you Dino)... On the other hand I may be wrong (and would be both delighted and apologetic). Michael Foord http://www.manning.com/foord > ------------------------------------------------------------------------ > *From:* users-bounces at lists.ironpython.com > [users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > [fuzzyman at voidspace.org.uk] > *Sent:* Sunday, March 09, 2008 5:19 AM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] IronPython and Silverlight 2 > > > > On 09/03/2008, *Kevin Chu* > wrote: > > Hi > there is my blog about IronPython and Silverlight > 2:http://www.cnblogs.com/redmoon/archive/2008/03/08/1096331.html > I write it in Chinese, however you can translate it by Google > Language Tool. > And this blog contain some useful links. > > > > As far as I can tell (!) your blog only shows how to create a Dynamic > Language Silverlight 2 application using 'app.xap' created with > Chiron. I want to be able to create an application *without* Chiron > which is deployed as text on the server (one of the great advantages > of using Dynamic Languages with Silverlight as explained by Jim > Hugunin at Mix07...). > > This means using a 'Silverlight.createObjectEx' call from Javascript > in the webpage - where I can pass in the name of the xaml file to > load. What I don't know is how in Silverlight 2 do I specify a Python > file - either in the 'createObjectEx' call or in the xaml file it loads... > > I don't want to be dependent on Chiron for creating/deploying dynamic > language applications, and I certainly don't want to have to hand roll > XML manifest files. Hopefully this isn't necessary I just can't quite > work it out yet. > > Michael > > > On Sun, Mar 9, 2008 at 7:42 PM, Michael Foord > > wrote: > > Hello guys, > > I would like to create Silverlight 2 applications *without* > using chiron > to create and deploy them. How do I specify the Python > application file? > > I see that I can still use Silverlight.js and the 'createObjectEx' > function to initialise the Silverlight control in my html. How > do I > specify in 'app.xaml' the Python file to load? > > > function createSilverlightEx() > { > Silverlight.createObjectEx({ > source: 'app.xaml', // Source property value. > parentElement:parentElement, // DOM reference to > hosting DIV tag. > id:'myPlugin', // Unique plug-in ID value. > properties:{ // Plug-in properties. > width:'1024', // Width of rectangular > region > of plug-in, in pixels. > height:'530', // Height of > rectangular region > of plug-in, in pixels. > inplaceInstallPrompt:false, // Determines whether > to display > in-place install prompt if invalid version is detected. > background:'white', // Background color of > plug-in. > isWindowless:'false', // Determines whether > to display > plug-in in windowless mode. > framerate:'24', // MaxFrameRate > property value. > version:'1.0'}, // Silverlight version. > events:{ > onError:null, // OnError property > value -- > event-handler function name. > onLoad:null}, // OnLoad property value -- > event-handler function name. > initParams:null, // initParams property > value -- > user-settable string for information passing. > context:null}); // Context value -- > passed to > Silverlight.js onLoad event handlers. > } > > Thanks > > Michael > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > -- > Once in a Redmoon > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > -- > http://www.manning.com/foord > http://www.voidspace.org.uk > http://www.ironpython.info > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From fuzzyman at voidspace.org.uk Sun Mar 9 21:09:58 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sun, 09 Mar 2008 20:09:58 +0000 Subject: [IronPython] Silverlight 2 Controls In-Reply-To: <7AD436E4270DD54A94238001769C2227011CF5A826FF@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <47D3F118.8010409@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011CF5A826FF@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <47D44416.5090005@voidspace.org.uk> Dino Viehland wrote: > This comes back to the manifest mentioned in the previous question. You can update the manfiest to contain the additional assemblies which are included w/ the Silverlight SDK. Those assemblies will get loaded allowing the XAML to parse. > If I add the following to the XML manifest: (Taken from the Silveright controls examples) I *still* can't import WatermarkTextBox or Button... I know that it is using this manifest because errors in it are reported - or crash IE! :-o Any other suggestions? Michael htt://www.manning.com/foord > ________________________________________ > From: users-bounces at lists.ironpython.com [users-bounces at lists.ironpython.com] On Behalf Of Michael Foord [fuzzyman at voidspace.org.uk] > Sent: Sunday, March 09, 2008 7:15 AM > To: Discussion of IronPython > Subject: [IronPython] Silverlight 2 Controls > > Hello all, > > I'm adapting a Silverlight 2 controls example for IronPython. It is > based on: > > http://silverlight.net/Samples/2b1/SilverlightControls/run/default.html > > It seems that the shiny new controls, like Button, ToggleButton, > WatermarkedTextBox (etc) don't come 'out of the box' with Silverlight2. > From downloading this example I can see the example includes several > dlls - presumably ones that *extend* System.Windows.Controls. > > As a result XAML that uses elements like these throws parse errors with > not-recognised elements. I have these dlls - how do I add them to my > IronPython project? If I just add a reference to > 'System.Windows.Controls' will it use the new dlls? > > Thanks > > Michael > http://www.manning.com/foord > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From dinov at exchange.microsoft.com Mon Mar 10 01:02:47 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Sun, 9 Mar 2008 17:02:47 -0700 Subject: [IronPython] Silverlight 2 Controls In-Reply-To: <47D44416.5090005@voidspace.org.uk> References: <47D3F118.8010409@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011CF5A826FF@DF-GRTDANE-MSG.exchange.corp.microsoft.com>, <47D44416.5090005@voidspace.org.uk> Message-ID: <7AD436E4270DD54A94238001769C2227011CF5A82700@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Importing I haven't actually tried, I've only used those controls from XAML. But you might be able to do clr.AddReference once it's in your manifest and then be able to import. If that works I think it's something we can probably make automatic. ________________________________________ From: users-bounces at lists.ironpython.com [users-bounces at lists.ironpython.com] On Behalf Of Michael Foord [fuzzyman at voidspace.org.uk] Sent: Sunday, March 09, 2008 1:09 PM To: Discussion of IronPython Subject: Re: [IronPython] Silverlight 2 Controls Dino Viehland wrote: > This comes back to the manifest mentioned in the previous question. You can update the manfiest to contain the additional assemblies which are included w/ the Silverlight SDK. Those assemblies will get loaded allowing the XAML to parse. > If I add the following to the XML manifest: (Taken from the Silveright controls examples) I *still* can't import WatermarkTextBox or Button... I know that it is using this manifest because errors in it are reported - or crash IE! :-o Any other suggestions? Michael htt://www.manning.com/foord > ________________________________________ > From: users-bounces at lists.ironpython.com [users-bounces at lists.ironpython.com] On Behalf Of Michael Foord [fuzzyman at voidspace.org.uk] > Sent: Sunday, March 09, 2008 7:15 AM > To: Discussion of IronPython > Subject: [IronPython] Silverlight 2 Controls > > Hello all, > > I'm adapting a Silverlight 2 controls example for IronPython. It is > based on: > > http://silverlight.net/Samples/2b1/SilverlightControls/run/default.html > > It seems that the shiny new controls, like Button, ToggleButton, > WatermarkedTextBox (etc) don't come 'out of the box' with Silverlight2. > From downloading this example I can see the example includes several > dlls - presumably ones that *extend* System.Windows.Controls. > > As a result XAML that uses elements like these throws parse errors with > not-recognised elements. I have these dlls - how do I add them to my > IronPython project? If I just add a reference to > 'System.Windows.Controls' will it use the new dlls? > > Thanks > > Michael > http://www.manning.com/foord > _______________________________________________ > 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 fuzzyman at voidspace.org.uk Mon Mar 10 01:21:36 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 10 Mar 2008 00:21:36 +0000 Subject: [IronPython] Silverlight 2 Controls In-Reply-To: <7AD436E4270DD54A94238001769C2227011CF5A82700@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <47D3F118.8010409@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011CF5A826FF@DF-GRTDANE-MSG.exchange.corp.microsoft.com>, <47D44416.5090005@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011CF5A82700@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <47D47F10.5080305@voidspace.org.uk> Dino Viehland wrote: > Importing I haven't actually tried, I've only used those controls from XAML. But you might be able to do clr.AddReference once it's in your manifest and then be able to import. If that works I think it's something we can probably make automatic. > If I add them to the manifest *and* add the following magic to the XAML then I can read them from XAML: xmlns:c="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" xmlns:e="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Extended" I *really* do want to use these from code though. I tried both of the following forms to add references to the new assemblies: import clr clr.AddReference('System.Windows.Controls') clr.AddReference('System.Windows.Controls.Extended') from System.Windows.Controls import Button import clr clr.AddReference('System.Windows.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') clr.AddReference('System.Windows.Controls.Extended, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') from System.Windows.Controls import Button Both raised the following exception: IOException: Could not add reference to assembly System.Windows.Controls Any further suggestions? Michael > ________________________________________ > From: users-bounces at lists.ironpython.com [users-bounces at lists.ironpython.com] On Behalf Of Michael Foord [fuzzyman at voidspace.org.uk] > Sent: Sunday, March 09, 2008 1:09 PM > To: Discussion of IronPython > Subject: Re: [IronPython] Silverlight 2 Controls > > Dino Viehland wrote: > >> This comes back to the manifest mentioned in the previous question. You can update the manfiest to contain the additional assemblies which are included w/ the Silverlight SDK. Those assemblies will get loaded allowing the XAML to parse. >> >> > If I add the following to the XML manifest: > > Source="System.Windows.Controls.Data.dll" /> > Source="System.Windows.Controls.dll" /> > Source="System.Windows.Controls.Extended.dll" /> > > (Taken from the Silveright controls examples) I *still* can't import > WatermarkTextBox or Button... I know that it is using this manifest > because errors in it are reported - or crash IE! :-o > > Any other suggestions? > > Michael > htt://www.manning.com/foord > > > >> ________________________________________ >> From: users-bounces at lists.ironpython.com [users-bounces at lists.ironpython.com] On Behalf Of Michael Foord [fuzzyman at voidspace.org.uk] >> Sent: Sunday, March 09, 2008 7:15 AM >> To: Discussion of IronPython >> Subject: [IronPython] Silverlight 2 Controls >> >> Hello all, >> >> I'm adapting a Silverlight 2 controls example for IronPython. It is >> based on: >> >> http://silverlight.net/Samples/2b1/SilverlightControls/run/default.html >> >> It seems that the shiny new controls, like Button, ToggleButton, >> WatermarkedTextBox (etc) don't come 'out of the box' with Silverlight2. >> From downloading this example I can see the example includes several >> dlls - presumably ones that *extend* System.Windows.Controls. >> >> As a result XAML that uses elements like these throws parse errors with >> not-recognised elements. I have these dlls - how do I add them to my >> IronPython project? If I just add a reference to >> 'System.Windows.Controls' will it use the new dlls? >> >> Thanks >> >> Michael >> http://www.manning.com/foord >> _______________________________________________ >> 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 jdhardy at gmail.com Mon Mar 10 01:46:33 2008 From: jdhardy at gmail.com (Jeff Hardy) Date: Sun, 9 Mar 2008 18:46:33 -0600 Subject: [IronPython] SCons on IronPython Message-ID: Hi all, I've been experimenting recently with getting SCons to run using IronPython. Unfortunately, it doesn't work yet. I've written up my progress so far at http://www.ironpython.info/index.php/SCons_on_IronPython. SCons is a pretty tough workout, so getting it working would be good for IronPython. If anyone's interested I can supply a patch, but it will be pretty rough. -Jeff From fuzzyman at voidspace.org.uk Mon Mar 10 02:02:27 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 10 Mar 2008 01:02:27 +0000 Subject: [IronPython] Silverlight 2 and app.xap layout Message-ID: <47D488A3.1070906@voidspace.org.uk> Hello all, An issue with chiron and the directory layout you need to create an 'app.xap'. (Note - I am doing this on a machine without the SDK or Visual Studio installed so that I can test on a machine similar to the ones I will use the Silverlight apps from.) In order for chiron to serve an application from the filesystem you need to create an 'app' subdirectory and place your Python files (etc) in this. If you then run 'chiron /x:app.xap' on this folder it creates a zip file with the same directory structure - but Silverlight is then *unable* to use the resulting app.xap (it fails with a error message 'the application must have an entry point app.*' - it is unable to find app.py from the app subdirectory). If you copy the files into a flat directory structure then chiron will generate an app.xap that Silverlight can use - but chiron is *unable* to serve the application from this folder *until* you have generated app.xap. This means that you cannot use the same folder layout for testing your apps and for creating them... Michael From srivatsn at microsoft.com Mon Mar 10 02:09:31 2008 From: srivatsn at microsoft.com (Srivatsn Narayanan) Date: Sun, 9 Mar 2008 18:09:31 -0700 Subject: [IronPython] Silverlight 2 and app.xap layout In-Reply-To: <47D488A3.1070906@voidspace.org.uk> References: <47D488A3.1070906@voidspace.org.uk> Message-ID: <3FA51E96F92363468CF062D992DC846818CB77DA92@NA-EXMSG-C106.redmond.corp.microsoft.com> I was running into the same issue but you can specifically ask Chiron to zip the app folder by doing: Chiron /d:app /z:app.xap. The /z switch adds the dlr assemblies as well. This xap runs from cassini. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Sunday, March 09, 2008 6:02 PM To: Discussion of IronPython Subject: [IronPython] Silverlight 2 and app.xap layout Hello all, An issue with chiron and the directory layout you need to create an 'app.xap'. (Note - I am doing this on a machine without the SDK or Visual Studio installed so that I can test on a machine similar to the ones I will use the Silverlight apps from.) In order for chiron to serve an application from the filesystem you need to create an 'app' subdirectory and place your Python files (etc) in this. If you then run 'chiron /x:app.xap' on this folder it creates a zip file with the same directory structure - but Silverlight is then *unable* to use the resulting app.xap (it fails with a error message 'the application must have an entry point app.*' - it is unable to find app.py from the app subdirectory). If you copy the files into a flat directory structure then chiron will generate an app.xap that Silverlight can use - but chiron is *unable* to serve the application from this folder *until* you have generated app.xap. This means that you cannot use the same folder layout for testing your apps and for creating them... Michael _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From felciano at yahoo.com Mon Mar 10 07:09:11 2008 From: felciano at yahoo.com (Ramon M. Felciano @ Yahoo) Date: Sun, 09 Mar 2008 23:09:11 -0700 Subject: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? Message-ID: <47D4D087.4050301@yahoo.com> Hi -- I'm trying to hook up IronPython to web services secured by Web Services Enhancements (WSE) 3.0. I have some C# sample code that I'm trying to convert to Python and am running into some trouble. I'm a C# and Windows ..NET newbie (using IronPython from the commmandline), so the libraries in question are foreign to me, so I was hoping someone could help me resolve this. The sample code shows: -------------------------- using Microsoft.Web.Services3; using Microsoft.Web.Services3.Design; using Microsoft.Web.Services3.Security; using Microsoft.Web.Services3.Security.Tokens; namespace TpIntegration { public class TpPolicy : Policy { public TpPolicy() { Assertions.Add(new UsernameOverTransportAssertion()); } public static UsernameToken GetUsernameToken(string username, string password, PasswordOption passwordOption) { UsernameToken token = new UsernameToken(username, password, passwordOption); ISecurityTokenManager securityTokenManager = SecurityTokenManager.GetSecurityTokenManagerByTokenType(WSTrust.TokenTypes.UsernameToken); securityTokenManager.CacheSecurityToken(token); return token; } public static void ApplyAutheticationTicket(WebServicesClientProtocol protocol, string userName, string password) { UsernameToken token = GetUsernameToken(userName, password, PasswordOption.SendPlainText); protocol.SetClientCredential(token); protocol.SetPolicy(new TpPolicy()); } } } -------------------------- This is then called using something like this: -------------------------- UserServiceWse userService = new UserServiceWse(); TpPolicy.ApplyAutheticationTicket(userService, "admin", "admin"); -------------------------- I've taken a swing at converting it: -------------------------- import Microsoft.Web.Services3 import Microsoft.Web.Services3.Design import Microsoft.Web.Services3.Security import Microsoft.Web.Services3.Security.Tokens def getUsernameToken(username, password, passwordOption): token = Microsoft.Web.Services3.Security.Tokens.UsernameToken(username, password, passwordOption) securityTokenManager = Microsoft.Web.Services3.Security.Tokens.SecurityTokenManager.GetSecurityTokenManagerByTokenType(Microsoft.Web.Services3.Security.WSTrust.TokenTypes.UsernameToken) securityTokenManager.CacheSecurityToken(token) return token def applyAutheticationTicket(protocol, userName, password): token = getUsernameToken(userName, password, Microsoft.Web.Services3.Security.Tokens.PasswordOption.SendPlainText) protocol.SetClientCredential(token) protocol.SetPolicy(TpPolicy()) -------------------------- but when calling it: -------------------------- userService = WebService.Load('http://www.example.com/Services/UserService.asmx') username = "test" password = "test" applyAutheticationTicket(userService, username, password) -------------------------- I get the following error: AttributeError: 'UserService' object has no attribute 'SetClientCredential' Any suggestions on how to debug this further? In case it matters, this is code from http://www.targetprocess.com/download/tp20/TP_2_Web_Services_Guide.pdf. Thanks! Ramon From srivatsn at microsoft.com Mon Mar 10 07:27:09 2008 From: srivatsn at microsoft.com (Srivatsn Narayanan) Date: Sun, 9 Mar 2008 23:27:09 -0700 Subject: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? In-Reply-To: <47D4D087.4050301@yahoo.com> References: <47D4D087.4050301@yahoo.com> Message-ID: <3FA51E96F92363468CF062D992DC846818CB77DB04@NA-EXMSG-C106.redmond.corp.microsoft.com> Looks like Webservice.Load is not returning a WebServicesClientProtocol. In the C# world you are instantiating a UserServiceWse. You could do the same in python so: userService = UserServiceWse() I assume the definition of that class would look like this: def UserServiceWse(WebServicesClientProtocol): def __init__(self): #The constructor. self.blah = foo ... -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ramon M. Felciano @ Yahoo Sent: Sunday, March 09, 2008 11:09 PM To: users at lists.ironpython.com Cc: Ramon Felciano Subject: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? Hi -- I'm trying to hook up IronPython to web services secured by Web Services Enhancements (WSE) 3.0. I have some C# sample code that I'm trying to convert to Python and am running into some trouble. I'm a C# and Windows ..NET newbie (using IronPython from the commmandline), so the libraries in question are foreign to me, so I was hoping someone could help me resolve this. The sample code shows: -------------------------- using Microsoft.Web.Services3; using Microsoft.Web.Services3.Design; using Microsoft.Web.Services3.Security; using Microsoft.Web.Services3.Security.Tokens; namespace TpIntegration { public class TpPolicy : Policy { public TpPolicy() { Assertions.Add(new UsernameOverTransportAssertion()); } public static UsernameToken GetUsernameToken(string username, string password, PasswordOption passwordOption) { UsernameToken token = new UsernameToken(username, password, passwordOption); ISecurityTokenManager securityTokenManager = SecurityTokenManager.GetSecurityTokenManagerByTokenType(WSTrust.TokenTypes.UsernameToken); securityTokenManager.CacheSecurityToken(token); return token; } public static void ApplyAutheticationTicket(WebServicesClientProtocol protocol, string userName, string password) { UsernameToken token = GetUsernameToken(userName, password, PasswordOption.SendPlainText); protocol.SetClientCredential(token); protocol.SetPolicy(new TpPolicy()); } } } -------------------------- This is then called using something like this: -------------------------- UserServiceWse userService = new UserServiceWse(); TpPolicy.ApplyAutheticationTicket(userService, "admin", "admin"); -------------------------- I've taken a swing at converting it: -------------------------- import Microsoft.Web.Services3 import Microsoft.Web.Services3.Design import Microsoft.Web.Services3.Security import Microsoft.Web.Services3.Security.Tokens def getUsernameToken(username, password, passwordOption): token = Microsoft.Web.Services3.Security.Tokens.UsernameToken(username, password, passwordOption) securityTokenManager = Microsoft.Web.Services3.Security.Tokens.SecurityTokenManager.GetSecurityTokenManagerByTokenType(Microsoft.Web.Services3.Security.WSTrust.TokenTypes.UsernameToken) securityTokenManager.CacheSecurityToken(token) return token def applyAutheticationTicket(protocol, userName, password): token = getUsernameToken(userName, password, Microsoft.Web.Services3.Security.Tokens.PasswordOption.SendPlainText) protocol.SetClientCredential(token) protocol.SetPolicy(TpPolicy()) -------------------------- but when calling it: -------------------------- userService = WebService.Load('http://www.example.com/Services/UserService.asmx') username = "test" password = "test" applyAutheticationTicket(userService, username, password) -------------------------- I get the following error: AttributeError: 'UserService' object has no attribute 'SetClientCredential' Any suggestions on how to debug this further? In case it matters, this is code from http://www.targetprocess.com/download/tp20/TP_2_Web_Services_Guide.pdf. Thanks! Ramon _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Mon Mar 10 12:43:43 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 10 Mar 2008 11:43:43 +0000 Subject: [IronPython] Silverlight 2 and app.xap layout In-Reply-To: <3FA51E96F92363468CF062D992DC846818CB77DA92@NA-EXMSG-C106.redmond.corp.microsoft.com> References: <47D488A3.1070906@voidspace.org.uk> <3FA51E96F92363468CF062D992DC846818CB77DA92@NA-EXMSG-C106.redmond.corp.microsoft.com> Message-ID: <47D51EEF.7020100@voidspace.org.uk> Srivatsn Narayanan wrote: > I was running into the same issue but you can specifically ask Chiron to zip the app folder by doing: > Chiron /d:app /z:app.xap. The /z switch adds the dlr assemblies as well. This xap runs from cassini. > Ah great. So in this case it is my fault! (And I'm just being a complainer...) Thanks! Michael > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Sunday, March 09, 2008 6:02 PM > To: Discussion of IronPython > Subject: [IronPython] Silverlight 2 and app.xap layout > > Hello all, > > An issue with chiron and the directory layout you need to create an > 'app.xap'. > > (Note - I am doing this on a machine without the SDK or Visual Studio > installed so that I can test on a machine similar to the ones I will use > the Silverlight apps from.) > > In order for chiron to serve an application from the filesystem you need > to create an > 'app' subdirectory and place your Python files (etc) in this. > > If you then run 'chiron /x:app.xap' on this folder it creates a zip file > with the same directory structure - but Silverlight is then *unable* to > use the resulting app.xap (it fails with a error message 'the > application must have an entry point app.*' - it is unable to find > app.py from the app subdirectory). > > If you copy the files into a flat directory structure then chiron will > generate an app.xap that Silverlight can use - but chiron is *unable* to > serve the application from this folder *until* you > have generated app.xap. > > This means that you cannot use the same folder layout for testing your > apps and for creating them... > > Michael > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From dinov at exchange.microsoft.com Mon Mar 10 16:51:34 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 10 Mar 2008 08:51:34 -0700 Subject: [IronPython] Silverlight 2 Controls In-Reply-To: <47D47F10.5080305@voidspace.org.uk> References: <47D3F118.8010409@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011CF5A826FF@DF-GRTDANE-MSG.exchange.corp.microsoft.com>, <47D44416.5090005@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011CF5A82700@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <47D47F10.5080305@voidspace.org.uk> Message-ID: <7AD436E4270DD54A94238001769C2227011CF5C2FC6C@DF-GRTDANE-MSG.exchange.corp.microsoft.com> This is a horrible workaround but I think it should work. You can create the object in XAML, then get the XAML and find the object, then call GetType().Assembly on it, and then pass that off to clr.AddReference. I'll follow up with the Silverlight guys on our team to make sure we can do better. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Sunday, March 09, 2008 5:22 PM To: Discussion of IronPython Subject: Re: [IronPython] Silverlight 2 Controls Dino Viehland wrote: > Importing I haven't actually tried, I've only used those controls from XAML. But you might be able to do clr.AddReference once it's in your manifest and then be able to import. If that works I think it's something we can probably make automatic. > If I add them to the manifest *and* add the following magic to the XAML then I can read them from XAML: xmlns:c="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" xmlns:e="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Extended" I *really* do want to use these from code though. I tried both of the following forms to add references to the new assemblies: import clr clr.AddReference('System.Windows.Controls') clr.AddReference('System.Windows.Controls.Extended') from System.Windows.Controls import Button import clr clr.AddReference('System.Windows.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') clr.AddReference('System.Windows.Controls.Extended, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') from System.Windows.Controls import Button Both raised the following exception: IOException: Could not add reference to assembly System.Windows.Controls Any further suggestions? Michael > ________________________________________ > From: users-bounces at lists.ironpython.com [users-bounces at lists.ironpython.com] On Behalf Of Michael Foord [fuzzyman at voidspace.org.uk] > Sent: Sunday, March 09, 2008 1:09 PM > To: Discussion of IronPython > Subject: Re: [IronPython] Silverlight 2 Controls > > Dino Viehland wrote: > >> This comes back to the manifest mentioned in the previous question. You can update the manfiest to contain the additional assemblies which are included w/ the Silverlight SDK. Those assemblies will get loaded allowing the XAML to parse. >> >> > If I add the following to the XML manifest: > > Source="System.Windows.Controls.Data.dll" /> > Source="System.Windows.Controls.dll" /> > Source="System.Windows.Controls.Extended.dll" /> > > (Taken from the Silveright controls examples) I *still* can't import > WatermarkTextBox or Button... I know that it is using this manifest > because errors in it are reported - or crash IE! :-o > > Any other suggestions? > > Michael > htt://www.manning.com/foord > > > >> ________________________________________ >> From: users-bounces at lists.ironpython.com [users-bounces at lists.ironpython.com] On Behalf Of Michael Foord [fuzzyman at voidspace.org.uk] >> Sent: Sunday, March 09, 2008 7:15 AM >> To: Discussion of IronPython >> Subject: [IronPython] Silverlight 2 Controls >> >> Hello all, >> >> I'm adapting a Silverlight 2 controls example for IronPython. It is >> based on: >> >> http://silverlight.net/Samples/2b1/SilverlightControls/run/default.html >> >> It seems that the shiny new controls, like Button, ToggleButton, >> WatermarkedTextBox (etc) don't come 'out of the box' with Silverlight2. >> From downloading this example I can see the example includes several >> dlls - presumably ones that *extend* System.Windows.Controls. >> >> As a result XAML that uses elements like these throws parse errors with >> not-recognised elements. I have these dlls - how do I add them to my >> IronPython project? If I just add a reference to >> 'System.Windows.Controls' will it use the new dlls? >> >> Thanks >> >> Michael >> http://www.manning.com/foord >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at exchange.microsoft.com Mon Mar 10 17:01:49 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 10 Mar 2008 09:01:49 -0700 Subject: [IronPython] Silverlight 2 Controls In-Reply-To: <7AD436E4270DD54A94238001769C2227011CF5C2FC6C@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <47D3F118.8010409@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011CF5A826FF@DF-GRTDANE-MSG.exchange.corp.microsoft.com>, <47D44416.5090005@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011CF5A82700@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <47D47F10.5080305@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011CF5C2FC6C@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <7AD436E4270DD54A94238001769C2227011CF5C2FC71@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Two more possibilities which are little less ugly: 1. AddReference to the fully qualified type name including strong name 2. The bits at http://dynamicsilverlight.net/ - I'm told we should recognize the assemblies for you with some changes made there -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: Monday, March 10, 2008 8:52 AM To: Discussion of IronPython Subject: Re: [IronPython] Silverlight 2 Controls This is a horrible workaround but I think it should work. You can create the object in XAML, then get the XAML and find the object, then call GetType().Assembly on it, and then pass that off to clr.AddReference. I'll follow up with the Silverlight guys on our team to make sure we can do better. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Sunday, March 09, 2008 5:22 PM To: Discussion of IronPython Subject: Re: [IronPython] Silverlight 2 Controls Dino Viehland wrote: > Importing I haven't actually tried, I've only used those controls from XAML. But you might be able to do clr.AddReference once it's in your manifest and then be able to import. If that works I think it's something we can probably make automatic. > If I add them to the manifest *and* add the following magic to the XAML then I can read them from XAML: xmlns:c="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" xmlns:e="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Extended" I *really* do want to use these from code though. I tried both of the following forms to add references to the new assemblies: import clr clr.AddReference('System.Windows.Controls') clr.AddReference('System.Windows.Controls.Extended') from System.Windows.Controls import Button import clr clr.AddReference('System.Windows.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') clr.AddReference('System.Windows.Controls.Extended, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') from System.Windows.Controls import Button Both raised the following exception: IOException: Could not add reference to assembly System.Windows.Controls Any further suggestions? Michael > ________________________________________ > From: users-bounces at lists.ironpython.com [users-bounces at lists.ironpython.com] On Behalf Of Michael Foord [fuzzyman at voidspace.org.uk] > Sent: Sunday, March 09, 2008 1:09 PM > To: Discussion of IronPython > Subject: Re: [IronPython] Silverlight 2 Controls > > Dino Viehland wrote: > >> This comes back to the manifest mentioned in the previous question. You can update the manfiest to contain the additional assemblies which are included w/ the Silverlight SDK. Those assemblies will get loaded allowing the XAML to parse. >> >> > If I add the following to the XML manifest: > > Source="System.Windows.Controls.Data.dll" /> > Source="System.Windows.Controls.dll" /> > Source="System.Windows.Controls.Extended.dll" /> > > (Taken from the Silveright controls examples) I *still* can't import > WatermarkTextBox or Button... I know that it is using this manifest > because errors in it are reported - or crash IE! :-o > > Any other suggestions? > > Michael > htt://www.manning.com/foord > > > >> ________________________________________ >> From: users-bounces at lists.ironpython.com [users-bounces at lists.ironpython.com] On Behalf Of Michael Foord [fuzzyman at voidspace.org.uk] >> Sent: Sunday, March 09, 2008 7:15 AM >> To: Discussion of IronPython >> Subject: [IronPython] Silverlight 2 Controls >> >> Hello all, >> >> I'm adapting a Silverlight 2 controls example for IronPython. It is >> based on: >> >> http://silverlight.net/Samples/2b1/SilverlightControls/run/default.html >> >> It seems that the shiny new controls, like Button, ToggleButton, >> WatermarkedTextBox (etc) don't come 'out of the box' with Silverlight2. >> From downloading this example I can see the example includes several >> dlls - presumably ones that *extend* System.Windows.Controls. >> >> As a result XAML that uses elements like these throws parse errors with >> not-recognised elements. I have these dlls - how do I add them to my >> IronPython project? If I just add a reference to >> 'System.Windows.Controls' will it use the new dlls? >> >> Thanks >> >> Michael >> http://www.manning.com/foord >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Mon Mar 10 17:22:27 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 10 Mar 2008 16:22:27 +0000 Subject: [IronPython] Silverlight 2 Controls In-Reply-To: <7AD436E4270DD54A94238001769C2227011CF5C2FC71@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <47D3F118.8010409@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011CF5A826FF@DF-GRTDANE-MSG.exchange.corp.microsoft.com>, <47D44416.5090005@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011CF5A82700@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <47D47F10.5080305@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011CF5C2FC6C@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <7AD436E4270DD54A94238001769C2227011CF5C2FC71@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <47D56043.9090102@voidspace.org.uk> Thanks Dino, I really appreciate your help. Dino Viehland wrote: > Two more possibilities which are little less ugly: > 1. AddReference to the fully qualified type name including strong name > I'm sorry to be dense - can you remind me how to get this strong name? I now have Visual Studio 2008 and the Silverlight tools installed. I have success with using these shiny new controls from XAML *and* with the following code: xaml = Application.Current.LoadRootVisual(Canvas(), "app.xaml") something = xaml.FindName('watermark') import clr assembly = something.GetType().Assembly clr.AddReference(assembly) from System.Windows.Controls import Button As you say, this is ugly and using the strong names would be better. :-) > 2. The bits at http://dynamicsilverlight.net/ - I'm told we should recognize the assemblies for you with some changes made there > That is what I'm using. If anyone has success with these binaries then let me know what you did! Michael > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland > Sent: Monday, March 10, 2008 8:52 AM > To: Discussion of IronPython > Subject: Re: [IronPython] Silverlight 2 Controls > > This is a horrible workaround but I think it should work. You can create the object in XAML, then get the XAML and find the object, then call GetType().Assembly on it, and then pass that off to clr.AddReference. > > I'll follow up with the Silverlight guys on our team to make sure we can do better. > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Sunday, March 09, 2008 5:22 PM > To: Discussion of IronPython > Subject: Re: [IronPython] Silverlight 2 Controls > > Dino Viehland wrote: > >> Importing I haven't actually tried, I've only used those controls from XAML. But you might be able to do clr.AddReference once it's in your manifest and then be able to import. If that works I think it's something we can probably make automatic. >> >> > If I add them to the manifest *and* add the following magic to the XAML > then I can read them from XAML: > > > > xmlns:c="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" > > xmlns:e="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Extended" > > > I *really* do want to use these from code though. I tried both of the > following forms to add references to the new assemblies: > > import clr > clr.AddReference('System.Windows.Controls') > clr.AddReference('System.Windows.Controls.Extended') > from System.Windows.Controls import Button > > import clr > clr.AddReference('System.Windows.Controls, Version=1.0.0.0, > Culture=neutral, PublicKeyToken=null') > clr.AddReference('System.Windows.Controls.Extended, Version=1.0.0.0, > Culture=neutral, PublicKeyToken=null') > from System.Windows.Controls import Button > > Both raised the following exception: > > IOException: Could not add reference to assembly System.Windows.Controls > > > Any further suggestions? > > Michael > > > >> ________________________________________ >> From: users-bounces at lists.ironpython.com [users-bounces at lists.ironpython.com] On Behalf Of Michael Foord [fuzzyman at voidspace.org.uk] >> Sent: Sunday, March 09, 2008 1:09 PM >> To: Discussion of IronPython >> Subject: Re: [IronPython] Silverlight 2 Controls >> >> Dino Viehland wrote: >> >> >>> This comes back to the manifest mentioned in the previous question. You can update the manfiest to contain the additional assemblies which are included w/ the Silverlight SDK. Those assemblies will get loaded allowing the XAML to parse. >>> >>> >>> >> If I add the following to the XML manifest: >> >> > Source="System.Windows.Controls.Data.dll" /> >> > Source="System.Windows.Controls.dll" /> >> > Source="System.Windows.Controls.Extended.dll" /> >> >> (Taken from the Silveright controls examples) I *still* can't import >> WatermarkTextBox or Button... I know that it is using this manifest >> because errors in it are reported - or crash IE! :-o >> >> Any other suggestions? >> >> Michael >> htt://www.manning.com/foord >> >> >> >> >>> ________________________________________ >>> From: users-bounces at lists.ironpython.com [users-bounces at lists.ironpython.com] On Behalf Of Michael Foord [fuzzyman at voidspace.org.uk] >>> Sent: Sunday, March 09, 2008 7:15 AM >>> To: Discussion of IronPython >>> Subject: [IronPython] Silverlight 2 Controls >>> >>> Hello all, >>> >>> I'm adapting a Silverlight 2 controls example for IronPython. It is >>> based on: >>> >>> http://silverlight.net/Samples/2b1/SilverlightControls/run/default.html >>> >>> It seems that the shiny new controls, like Button, ToggleButton, >>> WatermarkedTextBox (etc) don't come 'out of the box' with Silverlight2. >>> From downloading this example I can see the example includes several >>> dlls - presumably ones that *extend* System.Windows.Controls. >>> >>> As a result XAML that uses elements like these throws parse errors with >>> not-recognised elements. I have these dlls - how do I add them to my >>> IronPython project? If I just add a reference to >>> 'System.Windows.Controls' will it use the new dlls? >>> >>> Thanks >>> >>> Michael >>> http://www.manning.com/foord >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >>> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From dinov at exchange.microsoft.com Mon Mar 10 17:31:51 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 10 Mar 2008 09:31:51 -0700 Subject: [IronPython] Silverlight 2 Controls In-Reply-To: <47D56043.9090102@voidspace.org.uk> References: <47D3F118.8010409@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011CF5A826FF@DF-GRTDANE-MSG.exchange.corp.microsoft.com>, <47D44416.5090005@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011CF5A82700@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <47D47F10.5080305@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011CF5C2FC6C@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <7AD436E4270DD54A94238001769C2227011CF5C2FC71@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <47D56043.9090102@voidspace.org.uk> Message-ID: <7AD436E4270DD54A94238001769C2227011CF5C2FC7E@DF-GRTDANE-MSG.exchange.corp.microsoft.com> sn -T System.Windows.Controls.dll gets you the public key token name... But the only other way to get the entire thing is to put it in the GAC and do gacutil /l. Alternately now that you've got the types in Silverlight you could display Type.AssemblyQualifiedName or Assembly.FullName. It'd be the Silverlight strong name viewer app :). -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Monday, March 10, 2008 9:22 AM To: Discussion of IronPython Subject: Re: [IronPython] Silverlight 2 Controls Thanks Dino, I really appreciate your help. Dino Viehland wrote: > Two more possibilities which are little less ugly: > 1. AddReference to the fully qualified type name including strong name > I'm sorry to be dense - can you remind me how to get this strong name? I now have Visual Studio 2008 and the Silverlight tools installed. I have success with using these shiny new controls from XAML *and* with the following code: xaml = Application.Current.LoadRootVisual(Canvas(), "app.xaml") something = xaml.FindName('watermark') import clr assembly = something.GetType().Assembly clr.AddReference(assembly) from System.Windows.Controls import Button As you say, this is ugly and using the strong names would be better. :-) > 2. The bits at http://dynamicsilverlight.net/ - I'm told we should recognize the assemblies for you with some changes made there > That is what I'm using. If anyone has success with these binaries then let me know what you did! Michael > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland > Sent: Monday, March 10, 2008 8:52 AM > To: Discussion of IronPython > Subject: Re: [IronPython] Silverlight 2 Controls > > This is a horrible workaround but I think it should work. You can create the object in XAML, then get the XAML and find the object, then call GetType().Assembly on it, and then pass that off to clr.AddReference. > > I'll follow up with the Silverlight guys on our team to make sure we can do better. > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Sunday, March 09, 2008 5:22 PM > To: Discussion of IronPython > Subject: Re: [IronPython] Silverlight 2 Controls > > Dino Viehland wrote: > >> Importing I haven't actually tried, I've only used those controls from XAML. But you might be able to do clr.AddReference once it's in your manifest and then be able to import. If that works I think it's something we can probably make automatic. >> >> > If I add them to the manifest *and* add the following magic to the XAML > then I can read them from XAML: > > > > xmlns:c="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" > > xmlns:e="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Extended" > > > I *really* do want to use these from code though. I tried both of the > following forms to add references to the new assemblies: > > import clr > clr.AddReference('System.Windows.Controls') > clr.AddReference('System.Windows.Controls.Extended') > from System.Windows.Controls import Button > > import clr > clr.AddReference('System.Windows.Controls, Version=1.0.0.0, > Culture=neutral, PublicKeyToken=null') > clr.AddReference('System.Windows.Controls.Extended, Version=1.0.0.0, > Culture=neutral, PublicKeyToken=null') > from System.Windows.Controls import Button > > Both raised the following exception: > > IOException: Could not add reference to assembly System.Windows.Controls > > > Any further suggestions? > > Michael > > > >> ________________________________________ >> From: users-bounces at lists.ironpython.com [users-bounces at lists.ironpython.com] On Behalf Of Michael Foord [fuzzyman at voidspace.org.uk] >> Sent: Sunday, March 09, 2008 1:09 PM >> To: Discussion of IronPython >> Subject: Re: [IronPython] Silverlight 2 Controls >> >> Dino Viehland wrote: >> >> >>> This comes back to the manifest mentioned in the previous question. You can update the manfiest to contain the additional assemblies which are included w/ the Silverlight SDK. Those assemblies will get loaded allowing the XAML to parse. >>> >>> >>> >> If I add the following to the XML manifest: >> >> > Source="System.Windows.Controls.Data.dll" /> >> > Source="System.Windows.Controls.dll" /> >> > Source="System.Windows.Controls.Extended.dll" /> >> >> (Taken from the Silveright controls examples) I *still* can't import >> WatermarkTextBox or Button... I know that it is using this manifest >> because errors in it are reported - or crash IE! :-o >> >> Any other suggestions? >> >> Michael >> htt://www.manning.com/foord >> >> >> >> >>> ________________________________________ >>> From: users-bounces at lists.ironpython.com [users-bounces at lists.ironpython.com] On Behalf Of Michael Foord [fuzzyman at voidspace.org.uk] >>> Sent: Sunday, March 09, 2008 7:15 AM >>> To: Discussion of IronPython >>> Subject: [IronPython] Silverlight 2 Controls >>> >>> Hello all, >>> >>> I'm adapting a Silverlight 2 controls example for IronPython. It is >>> based on: >>> >>> http://silverlight.net/Samples/2b1/SilverlightControls/run/default.html >>> >>> It seems that the shiny new controls, like Button, ToggleButton, >>> WatermarkedTextBox (etc) don't come 'out of the box' with Silverlight2. >>> From downloading this example I can see the example includes several >>> dlls - presumably ones that *extend* System.Windows.Controls. >>> >>> As a result XAML that uses elements like these throws parse errors with >>> not-recognised elements. I have these dlls - how do I add them to my >>> IronPython project? If I just add a reference to >>> 'System.Windows.Controls' will it use the new dlls? >>> >>> Thanks >>> >>> Michael >>> http://www.manning.com/foord >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >>> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > 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 fuzzyman at voidspace.org.uk Mon Mar 10 17:36:55 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 10 Mar 2008 16:36:55 +0000 Subject: [IronPython] Silverlight 2 Controls In-Reply-To: <7AD436E4270DD54A94238001769C2227011CF5C2FC7E@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <47D3F118.8010409@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011CF5A826FF@DF-GRTDANE-MSG.exchange.corp.microsoft.com>, <47D44416.5090005@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011CF5A82700@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <47D47F10.5080305@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011CF5C2FC6C@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <7AD436E4270DD54A94238001769C2227011CF5C2FC71@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <47D56043.9090102@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011CF5C2FC7E@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <47D563A7.9010603@voidspace.org.uk> Dino Viehland wrote: > sn -T System.Windows.Controls.dll gets you the public key token name... But the only other way to get the entire thing is to put it in the GAC and do gacutil /l. Alternately now that you've got the types in Silverlight you could display Type.AssemblyQualifiedName or Assembly.FullName. It'd be the Silverlight strong name viewer app :). > > Just worked out the 'sn.exe' path myself. The following seems to work: import clr clr.AddReference('System.Windows.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35') Great!! Michael > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Monday, March 10, 2008 9:22 AM > To: Discussion of IronPython > Subject: Re: [IronPython] Silverlight 2 Controls > > Thanks Dino, I really appreciate your help. > > Dino Viehland wrote: > >> Two more possibilities which are little less ugly: >> 1. AddReference to the fully qualified type name including strong name >> >> > > I'm sorry to be dense - can you remind me how to get this strong name? I > now have Visual Studio 2008 and the Silverlight tools installed. > > I have success with using these shiny new controls from XAML *and* with > the following code: > > > xaml = Application.Current.LoadRootVisual(Canvas(), "app.xaml") > something = xaml.FindName('watermark') > > import clr > assembly = something.GetType().Assembly > clr.AddReference(assembly) > from System.Windows.Controls import Button > > As you say, this is ugly and using the strong names would be better. :-) > > >> 2. The bits at http://dynamicsilverlight.net/ - I'm told we should recognize the assemblies for you with some changes made there >> >> > > That is what I'm using. If anyone has success with these binaries then > let me know what you did! > > Michael > > >> -----Original Message----- >> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland >> Sent: Monday, March 10, 2008 8:52 AM >> To: Discussion of IronPython >> Subject: Re: [IronPython] Silverlight 2 Controls >> >> This is a horrible workaround but I think it should work. You can create the object in XAML, then get the XAML and find the object, then call GetType().Assembly on it, and then pass that off to clr.AddReference. >> >> I'll follow up with the Silverlight guys on our team to make sure we can do better. >> >> -----Original Message----- >> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord >> Sent: Sunday, March 09, 2008 5:22 PM >> To: Discussion of IronPython >> Subject: Re: [IronPython] Silverlight 2 Controls >> >> Dino Viehland wrote: >> >> >>> Importing I haven't actually tried, I've only used those controls from XAML. But you might be able to do clr.AddReference once it's in your manifest and then be able to import. If that works I think it's something we can probably make automatic. >>> >>> >>> >> If I add them to the manifest *and* add the following magic to the XAML >> then I can read them from XAML: >> >> >> >> xmlns:c="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" >> >> xmlns:e="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Extended" >> >> >> I *really* do want to use these from code though. I tried both of the >> following forms to add references to the new assemblies: >> >> import clr >> clr.AddReference('System.Windows.Controls') >> clr.AddReference('System.Windows.Controls.Extended') >> from System.Windows.Controls import Button >> >> import clr >> clr.AddReference('System.Windows.Controls, Version=1.0.0.0, >> Culture=neutral, PublicKeyToken=null') >> clr.AddReference('System.Windows.Controls.Extended, Version=1.0.0.0, >> Culture=neutral, PublicKeyToken=null') >> from System.Windows.Controls import Button >> >> Both raised the following exception: >> >> IOException: Could not add reference to assembly System.Windows.Controls >> >> >> Any further suggestions? >> >> Michael >> >> >> >> >>> ________________________________________ >>> From: users-bounces at lists.ironpython.com [users-bounces at lists.ironpython.com] On Behalf Of Michael Foord [fuzzyman at voidspace.org.uk] >>> Sent: Sunday, March 09, 2008 1:09 PM >>> To: Discussion of IronPython >>> Subject: Re: [IronPython] Silverlight 2 Controls >>> >>> Dino Viehland wrote: >>> >>> >>> >>>> This comes back to the manifest mentioned in the previous question. You can update the manfiest to contain the additional assemblies which are included w/ the Silverlight SDK. Those assemblies will get loaded allowing the XAML to parse. >>>> >>>> >>>> >>>> >>> If I add the following to the XML manifest: >>> >>> >> Source="System.Windows.Controls.Data.dll" /> >>> >> Source="System.Windows.Controls.dll" /> >>> >> Source="System.Windows.Controls.Extended.dll" /> >>> >>> (Taken from the Silveright controls examples) I *still* can't import >>> WatermarkTextBox or Button... I know that it is using this manifest >>> because errors in it are reported - or crash IE! :-o >>> >>> Any other suggestions? >>> >>> Michael >>> htt://www.manning.com/foord >>> >>> >>> >>> >>> >>>> ________________________________________ >>>> From: users-bounces at lists.ironpython.com [users-bounces at lists.ironpython.com] On Behalf Of Michael Foord [fuzzyman at voidspace.org.uk] >>>> Sent: Sunday, March 09, 2008 7:15 AM >>>> To: Discussion of IronPython >>>> Subject: [IronPython] Silverlight 2 Controls >>>> >>>> Hello all, >>>> >>>> I'm adapting a Silverlight 2 controls example for IronPython. It is >>>> based on: >>>> >>>> http://silverlight.net/Samples/2b1/SilverlightControls/run/default.html >>>> >>>> It seems that the shiny new controls, like Button, ToggleButton, >>>> WatermarkedTextBox (etc) don't come 'out of the box' with Silverlight2. >>>> From downloading this example I can see the example includes several >>>> dlls - presumably ones that *extend* System.Windows.Controls. >>>> >>>> As a result XAML that uses elements like these throws parse errors with >>>> not-recognised elements. I have these dlls - how do I add them to my >>>> IronPython project? If I just add a reference to >>>> 'System.Windows.Controls' will it use the new dlls? >>>> >>>> Thanks >>>> >>>> Michael >>>> http://www.manning.com/foord >>>> _______________________________________________ >>>> Users mailing list >>>> Users at lists.ironpython.com >>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>>> _______________________________________________ >>>> Users mailing list >>>> Users at lists.ironpython.com >>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>>> >>>> >>>> >>>> >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >>> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> _______________________________________________ >> 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 felciano at yahoo.com Mon Mar 10 18:04:55 2008 From: felciano at yahoo.com (Ramon M. Felciano @ Yahoo) Date: Mon, 10 Mar 2008 10:04:55 -0700 Subject: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? In-Reply-To: <3FA51E96F92363468CF062D992DC846818CB77DB04@NA-EXMSG-C106.redmond.corp.microsoft.com> References: <47D4D087.4050301@yahoo.com> <3FA51E96F92363468CF062D992DC846818CB77DB04@NA-EXMSG-C106.redmond.corp.microsoft.com> Message-ID: <47D56A37.7060806@yahoo.com> Hi Srivatsn -- Thanks for the quick reply. I don't actually have UserServiceWse defined on the python side; I assumed that would be dynamically-generated from the WSDL call and that the appropriate methods would be found through introspectino. Is that incorrect? Is there some sort of stub-generator I need to run in order to auto-generate the UserService client class? Ramon Srivatsn Narayanan wrote: > Looks like Webservice.Load is not returning a WebServicesClientProtocol. In the C# world you are instantiating a UserServiceWse. You could do the same in python so: > userService = UserServiceWse() > > I assume the definition of that class would look like this: > def UserServiceWse(WebServicesClientProtocol): > def __init__(self): #The constructor. > self.blah = foo > ... > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ramon M. Felciano @ Yahoo > Sent: Sunday, March 09, 2008 11:09 PM > To: users at lists.ironpython.com > Cc: Ramon Felciano > Subject: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? > > Hi -- > > I'm trying to hook up IronPython to web services secured by Web Services > Enhancements (WSE) 3.0. I have some C# sample code that I'm trying to > convert to Python and am running into some trouble. I'm a C# and Windows > ..NET newbie (using IronPython from the commmandline), so the libraries > in question are foreign to me, so I was hoping someone could help me > resolve this. The sample code shows: > > -------------------------- > using Microsoft.Web.Services3; > using Microsoft.Web.Services3.Design; > using Microsoft.Web.Services3.Security; > using Microsoft.Web.Services3.Security.Tokens; > namespace TpIntegration > { > public class TpPolicy : Policy { > public TpPolicy() { > Assertions.Add(new UsernameOverTransportAssertion()); > } > public static UsernameToken GetUsernameToken(string username, string > password, PasswordOption passwordOption) { > UsernameToken token = new UsernameToken(username, password, > passwordOption); > ISecurityTokenManager securityTokenManager = > > SecurityTokenManager.GetSecurityTokenManagerByTokenType(WSTrust.TokenTypes.UsernameToken); > securityTokenManager.CacheSecurityToken(token); > return token; > } > public static void ApplyAutheticationTicket(WebServicesClientProtocol > protocol, string userName, string password) { > UsernameToken token = GetUsernameToken(userName, password, > PasswordOption.SendPlainText); > protocol.SetClientCredential(token); > protocol.SetPolicy(new TpPolicy()); > } > } > } > -------------------------- > > This is then called using something like this: > > -------------------------- > UserServiceWse userService = new UserServiceWse(); > TpPolicy.ApplyAutheticationTicket(userService, "admin", "admin"); > -------------------------- > > I've taken a swing at converting it: > > -------------------------- > import Microsoft.Web.Services3 > import Microsoft.Web.Services3.Design > import Microsoft.Web.Services3.Security > import Microsoft.Web.Services3.Security.Tokens > > def getUsernameToken(username, password, passwordOption): > token = > Microsoft.Web.Services3.Security.Tokens.UsernameToken(username, > password, passwordOption) > securityTokenManager = > Microsoft.Web.Services3.Security.Tokens.SecurityTokenManager.GetSecurityTokenManagerByTokenType(Microsoft.Web.Services3.Security.WSTrust.TokenTypes.UsernameToken) > securityTokenManager.CacheSecurityToken(token) > return token > > def applyAutheticationTicket(protocol, userName, password): > token = getUsernameToken(userName, password, > Microsoft.Web.Services3.Security.Tokens.PasswordOption.SendPlainText) > protocol.SetClientCredential(token) > protocol.SetPolicy(TpPolicy()) > -------------------------- > > but when calling it: > > -------------------------- > userService = > WebService.Load('http://www.example.com/Services/UserService.asmx') > username = "test" > password = "test" > applyAutheticationTicket(userService, username, password) > -------------------------- > > I get the following error: > > AttributeError: 'UserService' object has no attribute 'SetClientCredential' > > Any suggestions on how to debug this further? In case it matters, this > is code from > http://www.targetprocess.com/download/tp20/TP_2_Web_Services_Guide.pdf. > > Thanks! > > Ramon > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > From srivatsn at microsoft.com Mon Mar 10 19:13:53 2008 From: srivatsn at microsoft.com (Srivatsn Narayanan) Date: Mon, 10 Mar 2008 11:13:53 -0700 Subject: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? In-Reply-To: <47D56A37.7060806@yahoo.com> References: <47D4D087.4050301@yahoo.com> <3FA51E96F92363468CF062D992DC846818CB77DB04@NA-EXMSG-C106.redmond.corp.microsoft.com> <47D56A37.7060806@yahoo.com> Message-ID: <3FA51E96F92363468CF062D992DC84681F894E85B5@NA-EXMSG-C106.redmond.corp.microsoft.com> Well, if the WebService.Load method returned an object that this method then yes this should work. You can use wsdl.exe to generate the proxy in C# (or if u already have the code for UserServiceWse) then you can find out how the call is being made inside the UserServiceWse constructor and translate that to python. -----Original Message----- From: Ramon M. Felciano @ Yahoo [mailto:felciano at yahoo.com] Sent: Monday, March 10, 2008 10:05 AM To: Srivatsn Narayanan Cc: Discussion of IronPython Subject: Re: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? Hi Srivatsn -- Thanks for the quick reply. I don't actually have UserServiceWse defined on the python side; I assumed that would be dynamically-generated from the WSDL call and that the appropriate methods would be found through introspectino. Is that incorrect? Is there some sort of stub-generator I need to run in order to auto-generate the UserService client class? Ramon Srivatsn Narayanan wrote: > Looks like Webservice.Load is not returning a WebServicesClientProtocol. In the C# world you are instantiating a UserServiceWse. You could do the same in python so: > userService = UserServiceWse() > > I assume the definition of that class would look like this: > def UserServiceWse(WebServicesClientProtocol): > def __init__(self): #The constructor. > self.blah = foo > ... > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ramon M. Felciano @ Yahoo > Sent: Sunday, March 09, 2008 11:09 PM > To: users at lists.ironpython.com > Cc: Ramon Felciano > Subject: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? > > Hi -- > > I'm trying to hook up IronPython to web services secured by Web Services > Enhancements (WSE) 3.0. I have some C# sample code that I'm trying to > convert to Python and am running into some trouble. I'm a C# and Windows > ..NET newbie (using IronPython from the commmandline), so the libraries > in question are foreign to me, so I was hoping someone could help me > resolve this. The sample code shows: > > -------------------------- > using Microsoft.Web.Services3; > using Microsoft.Web.Services3.Design; > using Microsoft.Web.Services3.Security; > using Microsoft.Web.Services3.Security.Tokens; > namespace TpIntegration > { > public class TpPolicy : Policy { > public TpPolicy() { > Assertions.Add(new UsernameOverTransportAssertion()); > } > public static UsernameToken GetUsernameToken(string username, string > password, PasswordOption passwordOption) { > UsernameToken token = new UsernameToken(username, password, > passwordOption); > ISecurityTokenManager securityTokenManager = > > SecurityTokenManager.GetSecurityTokenManagerByTokenType(WSTrust.TokenTypes.UsernameToken); > securityTokenManager.CacheSecurityToken(token); > return token; > } > public static void ApplyAutheticationTicket(WebServicesClientProtocol > protocol, string userName, string password) { > UsernameToken token = GetUsernameToken(userName, password, > PasswordOption.SendPlainText); > protocol.SetClientCredential(token); > protocol.SetPolicy(new TpPolicy()); > } > } > } > -------------------------- > > This is then called using something like this: > > -------------------------- > UserServiceWse userService = new UserServiceWse(); > TpPolicy.ApplyAutheticationTicket(userService, "admin", "admin"); > -------------------------- > > I've taken a swing at converting it: > > -------------------------- > import Microsoft.Web.Services3 > import Microsoft.Web.Services3.Design > import Microsoft.Web.Services3.Security > import Microsoft.Web.Services3.Security.Tokens > > def getUsernameToken(username, password, passwordOption): > token = > Microsoft.Web.Services3.Security.Tokens.UsernameToken(username, > password, passwordOption) > securityTokenManager = > Microsoft.Web.Services3.Security.Tokens.SecurityTokenManager.GetSecurityTokenManagerByTokenType(Microsoft.Web.Services3.Security.WSTrust.TokenTypes.UsernameToken) > securityTokenManager.CacheSecurityToken(token) > return token > > def applyAutheticationTicket(protocol, userName, password): > token = getUsernameToken(userName, password, > Microsoft.Web.Services3.Security.Tokens.PasswordOption.SendPlainText) > protocol.SetClientCredential(token) > protocol.SetPolicy(TpPolicy()) > -------------------------- > > but when calling it: > > -------------------------- > userService = > WebService.Load('http://www.example.com/Services/UserService.asmx') > username = "test" > password = "test" > applyAutheticationTicket(userService, username, password) > -------------------------- > > I get the following error: > > AttributeError: 'UserService' object has no attribute 'SetClientCredential' > > Any suggestions on how to debug this further? In case it matters, this > is code from > http://www.targetprocess.com/download/tp20/TP_2_Web_Services_Guide.pdf. > > Thanks! > > Ramon > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > From felciano at yahoo.com Mon Mar 10 22:53:02 2008 From: felciano at yahoo.com (Ramon M. Felciano @ Yahoo) Date: Mon, 10 Mar 2008 14:53:02 -0700 Subject: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? In-Reply-To: <3FA51E96F92363468CF062D992DC84681F894E85B5@NA-EXMSG-C106.redmond.corp.microsoft.com> References: <47D4D087.4050301@yahoo.com> <3FA51E96F92363468CF062D992DC846818CB77DB04@NA-EXMSG-C106.redmond.corp.microsoft.com> <47D56A37.7060806@yahoo.com> <3FA51E96F92363468CF062D992DC84681F894E85B5@NA-EXMSG-C106.redmond.corp.microsoft.com> Message-ID: <47D5ADBE.4010308@yahoo.com> Got it -- that may be the problem. I generated the stubs as you suggested using WseWsdl3.exe (which I assume is the same as the tool you mention): ---------------------------------------- C:\Program Files\Microsoft WSE\v3.0\Tools>WseWsdl3.exe /type:webClient http://www.example.com/Services/UserService.asmx?wsdl Web Services Enhancements 3.0 for Microsoft .NET. Copyright (c) Microsoft Corporation. Microsoft (R) Web Services Description Language Utility [Microsoft (R) .NET Framework, Version 2.0.50727.42] Copyright (C) Microsoft Corporation. All rights reserved. Writing file 'C:\Program Files\Microsoft WSE\v3.0\Tools\UserService.cs'. ---------------------------------------- The generated C# code does extend the right class: ---------------------------------------- public partial class UserService : Microsoft.Web.Services3.WebServicesClientProtocol { ---------------------------------------- but this code does not contain the SetClientCredential or SetPolicy methods, which is maybe not surprising giving the partial keyword. I can't figure out how to do the equivalent in IronPython. If I check the type of the returned object, it is of type UserService, and I can't introspect it to find it's superclass. Am I correct in assuming that there is no equivalent to wsdl.exe for IronPython? I.e. there is no way I can use WebServicesHelpers to dump out Python code so I can inspect this more directly? Ramon Srivatsn Narayanan wrote: > Well, if the WebService.Load method returned an object that this method then yes this should work. You can use wsdl.exe to generate the proxy in C# (or if u already have the code for UserServiceWse) then you can find out how the call is being made inside the UserServiceWse constructor and translate that to python. > > > -----Original Message----- > From: Ramon M. Felciano @ Yahoo [mailto:felciano at yahoo.com] > Sent: Monday, March 10, 2008 10:05 AM > To: Srivatsn Narayanan > Cc: Discussion of IronPython > Subject: Re: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? > > Hi Srivatsn -- > > Thanks for the quick reply. I don't actually have UserServiceWse defined > on the python side; I assumed that would be dynamically-generated from > the WSDL call and that the appropriate methods would be found through > introspectino. Is that incorrect? Is there some sort of stub-generator I > need to run in order to auto-generate the UserService client class? > > Ramon > > Srivatsn Narayanan wrote: > >> Looks like Webservice.Load is not returning a WebServicesClientProtocol. In the C# world you are instantiating a UserServiceWse. You could do the same in python so: >> userService = UserServiceWse() >> >> I assume the definition of that class would look like this: >> def UserServiceWse(WebServicesClientProtocol): >> def __init__(self): #The constructor. >> self.blah = foo >> ... >> >> -----Original Message----- >> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ramon M. Felciano @ Yahoo >> Sent: Sunday, March 09, 2008 11:09 PM >> To: users at lists.ironpython.com >> Cc: Ramon Felciano >> Subject: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? >> >> Hi -- >> >> I'm trying to hook up IronPython to web services secured by Web Services >> Enhancements (WSE) 3.0. I have some C# sample code that I'm trying to >> convert to Python and am running into some trouble. I'm a C# and Windows >> ..NET newbie (using IronPython from the commmandline), so the libraries >> in question are foreign to me, so I was hoping someone could help me >> resolve this. The sample code shows: >> >> -------------------------- >> using Microsoft.Web.Services3; >> using Microsoft.Web.Services3.Design; >> using Microsoft.Web.Services3.Security; >> using Microsoft.Web.Services3.Security.Tokens; >> namespace TpIntegration >> { >> public class TpPolicy : Policy { >> public TpPolicy() { >> Assertions.Add(new UsernameOverTransportAssertion()); >> } >> public static UsernameToken GetUsernameToken(string username, string >> password, PasswordOption passwordOption) { >> UsernameToken token = new UsernameToken(username, password, >> passwordOption); >> ISecurityTokenManager securityTokenManager = >> >> SecurityTokenManager.GetSecurityTokenManagerByTokenType(WSTrust.TokenTypes.UsernameToken); >> securityTokenManager.CacheSecurityToken(token); >> return token; >> } >> public static void ApplyAutheticationTicket(WebServicesClientProtocol >> protocol, string userName, string password) { >> UsernameToken token = GetUsernameToken(userName, password, >> PasswordOption.SendPlainText); >> protocol.SetClientCredential(token); >> protocol.SetPolicy(new TpPolicy()); >> } >> } >> } >> -------------------------- >> >> This is then called using something like this: >> >> -------------------------- >> UserServiceWse userService = new UserServiceWse(); >> TpPolicy.ApplyAutheticationTicket(userService, "admin", "admin"); >> -------------------------- >> >> I've taken a swing at converting it: >> >> -------------------------- >> import Microsoft.Web.Services3 >> import Microsoft.Web.Services3.Design >> import Microsoft.Web.Services3.Security >> import Microsoft.Web.Services3.Security.Tokens >> >> def getUsernameToken(username, password, passwordOption): >> token = >> Microsoft.Web.Services3.Security.Tokens.UsernameToken(username, >> password, passwordOption) >> securityTokenManager = >> Microsoft.Web.Services3.Security.Tokens.SecurityTokenManager.GetSecurityTokenManagerByTokenType(Microsoft.Web.Services3.Security.WSTrust.TokenTypes.UsernameToken) >> securityTokenManager.CacheSecurityToken(token) >> return token >> >> def applyAutheticationTicket(protocol, userName, password): >> token = getUsernameToken(userName, password, >> Microsoft.Web.Services3.Security.Tokens.PasswordOption.SendPlainText) >> protocol.SetClientCredential(token) >> protocol.SetPolicy(TpPolicy()) >> -------------------------- >> >> but when calling it: >> >> -------------------------- >> userService = >> WebService.Load('http://www.example.com/Services/UserService.asmx') >> username = "test" >> password = "test" >> applyAutheticationTicket(userService, username, password) >> -------------------------- >> >> I get the following error: >> >> AttributeError: 'UserService' object has no attribute 'SetClientCredential' >> >> Any suggestions on how to debug this further? In case it matters, this >> is code from >> http://www.targetprocess.com/download/tp20/TP_2_Web_Services_Guide.pdf. >> >> Thanks! >> >> Ramon >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> >> > > > From srivatsn at microsoft.com Mon Mar 10 23:04:58 2008 From: srivatsn at microsoft.com (Srivatsn Narayanan) Date: Mon, 10 Mar 2008 15:04:58 -0700 Subject: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? In-Reply-To: <47D5ADBE.4010308@yahoo.com> References: <47D4D087.4050301@yahoo.com> <3FA51E96F92363468CF062D992DC846818CB77DB04@NA-EXMSG-C106.redmond.corp.microsoft.com> <47D56A37.7060806@yahoo.com> <3FA51E96F92363468CF062D992DC84681F894E85B5@NA-EXMSG-C106.redmond.corp.microsoft.com> <47D5ADBE.4010308@yahoo.com> Message-ID: <3FA51E96F92363468CF062D992DC84681F894E87EE@NA-EXMSG-C106.redmond.corp.microsoft.com> In the C# side you are using the constructor of UserService to create an instance of WebServicesClientProtocol. In the python side, you don't seem to be creating an instance of this. You can have a look at the constructor of the generated C# UserService and see how the instance is created and translate that to python. If you are having trouble with that post the constructor code here. Srivatsn -----Original Message----- From: Ramon M. Felciano @ Yahoo [mailto:felciano at yahoo.com] Sent: Monday, March 10, 2008 2:53 PM To: Srivatsn Narayanan Cc: Discussion of IronPython Subject: Re: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? Got it -- that may be the problem. I generated the stubs as you suggested using WseWsdl3.exe (which I assume is the same as the tool you mention): ---------------------------------------- C:\Program Files\Microsoft WSE\v3.0\Tools>WseWsdl3.exe /type:webClient http://www.example.com/Services/UserService.asmx?wsdl Web Services Enhancements 3.0 for Microsoft .NET. Copyright (c) Microsoft Corporation. Microsoft (R) Web Services Description Language Utility [Microsoft (R) .NET Framework, Version 2.0.50727.42] Copyright (C) Microsoft Corporation. All rights reserved. Writing file 'C:\Program Files\Microsoft WSE\v3.0\Tools\UserService.cs'. ---------------------------------------- The generated C# code does extend the right class: ---------------------------------------- public partial class UserService : Microsoft.Web.Services3.WebServicesClientProtocol { ---------------------------------------- but this code does not contain the SetClientCredential or SetPolicy methods, which is maybe not surprising giving the partial keyword. I can't figure out how to do the equivalent in IronPython. If I check the type of the returned object, it is of type UserService, and I can't introspect it to find it's superclass. Am I correct in assuming that there is no equivalent to wsdl.exe for IronPython? I.e. there is no way I can use WebServicesHelpers to dump out Python code so I can inspect this more directly? Ramon Srivatsn Narayanan wrote: > Well, if the WebService.Load method returned an object that this method then yes this should work. You can use wsdl.exe to generate the proxy in C# (or if u already have the code for UserServiceWse) then you can find out how the call is being made inside the UserServiceWse constructor and translate that to python. > > > -----Original Message----- > From: Ramon M. Felciano @ Yahoo [mailto:felciano at yahoo.com] > Sent: Monday, March 10, 2008 10:05 AM > To: Srivatsn Narayanan > Cc: Discussion of IronPython > Subject: Re: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? > > Hi Srivatsn -- > > Thanks for the quick reply. I don't actually have UserServiceWse defined > on the python side; I assumed that would be dynamically-generated from > the WSDL call and that the appropriate methods would be found through > introspectino. Is that incorrect? Is there some sort of stub-generator I > need to run in order to auto-generate the UserService client class? > > Ramon > > Srivatsn Narayanan wrote: > >> Looks like Webservice.Load is not returning a WebServicesClientProtocol. In the C# world you are instantiating a UserServiceWse. You could do the same in python so: >> userService = UserServiceWse() >> >> I assume the definition of that class would look like this: >> def UserServiceWse(WebServicesClientProtocol): >> def __init__(self): #The constructor. >> self.blah = foo >> ... >> >> -----Original Message----- >> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ramon M. Felciano @ Yahoo >> Sent: Sunday, March 09, 2008 11:09 PM >> To: users at lists.ironpython.com >> Cc: Ramon Felciano >> Subject: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? >> >> Hi -- >> >> I'm trying to hook up IronPython to web services secured by Web Services >> Enhancements (WSE) 3.0. I have some C# sample code that I'm trying to >> convert to Python and am running into some trouble. I'm a C# and Windows >> ..NET newbie (using IronPython from the commmandline), so the libraries >> in question are foreign to me, so I was hoping someone could help me >> resolve this. The sample code shows: >> >> -------------------------- >> using Microsoft.Web.Services3; >> using Microsoft.Web.Services3.Design; >> using Microsoft.Web.Services3.Security; >> using Microsoft.Web.Services3.Security.Tokens; >> namespace TpIntegration >> { >> public class TpPolicy : Policy { >> public TpPolicy() { >> Assertions.Add(new UsernameOverTransportAssertion()); >> } >> public static UsernameToken GetUsernameToken(string username, string >> password, PasswordOption passwordOption) { >> UsernameToken token = new UsernameToken(username, password, >> passwordOption); >> ISecurityTokenManager securityTokenManager = >> >> SecurityTokenManager.GetSecurityTokenManagerByTokenType(WSTrust.TokenTypes.UsernameToken); >> securityTokenManager.CacheSecurityToken(token); >> return token; >> } >> public static void ApplyAutheticationTicket(WebServicesClientProtocol >> protocol, string userName, string password) { >> UsernameToken token = GetUsernameToken(userName, password, >> PasswordOption.SendPlainText); >> protocol.SetClientCredential(token); >> protocol.SetPolicy(new TpPolicy()); >> } >> } >> } >> -------------------------- >> >> This is then called using something like this: >> >> -------------------------- >> UserServiceWse userService = new UserServiceWse(); >> TpPolicy.ApplyAutheticationTicket(userService, "admin", "admin"); >> -------------------------- >> >> I've taken a swing at converting it: >> >> -------------------------- >> import Microsoft.Web.Services3 >> import Microsoft.Web.Services3.Design >> import Microsoft.Web.Services3.Security >> import Microsoft.Web.Services3.Security.Tokens >> >> def getUsernameToken(username, password, passwordOption): >> token = >> Microsoft.Web.Services3.Security.Tokens.UsernameToken(username, >> password, passwordOption) >> securityTokenManager = >> Microsoft.Web.Services3.Security.Tokens.SecurityTokenManager.GetSecurityTokenManagerByTokenType(Microsoft.Web.Services3.Security.WSTrust.TokenTypes.UsernameToken) >> securityTokenManager.CacheSecurityToken(token) >> return token >> >> def applyAutheticationTicket(protocol, userName, password): >> token = getUsernameToken(userName, password, >> Microsoft.Web.Services3.Security.Tokens.PasswordOption.SendPlainText) >> protocol.SetClientCredential(token) >> protocol.SetPolicy(TpPolicy()) >> -------------------------- >> >> but when calling it: >> >> -------------------------- >> userService = >> WebService.Load('http://www.example.com/Services/UserService.asmx') >> username = "test" >> password = "test" >> applyAutheticationTicket(userService, username, password) >> -------------------------- >> >> I get the following error: >> >> AttributeError: 'UserService' object has no attribute 'SetClientCredential' >> >> Any suggestions on how to debug this further? In case it matters, this >> is code from >> http://www.targetprocess.com/download/tp20/TP_2_Web_Services_Guide.pdf. >> >> Thanks! >> >> Ramon >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> >> > > > From Jimmy.Schementi at microsoft.com Tue Mar 11 00:21:32 2008 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Mon, 10 Mar 2008 16:21:32 -0700 Subject: [IronPython] how to use IronPython in Silverlight 2 In-Reply-To: <7AD436E4270DD54A94238001769C2227011CF5C2FA25@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <41d7f4a90803061938v3e9c9fabna0cc270b1f14e640@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011CF5C2F949@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <41d7f4a90803070931t174d5dc3k72310411ad0dece9@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011CF5C2FA25@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <5283CA0A4168DF4FBBD71AE9ECA5A32844F4E0E399@NA-EXMSG-C116.redmond.corp.microsoft.com> To load a XAML file and set the RootVisual, you can do this: Application.Current.LoadRootVisual("file.xaml") It's how we do it in the python samples on http://dynamicsilverlight.net ~Jimmy From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: Friday, March 07, 2008 11:25 AM To: Discussion of IronPython Subject: Re: [IronPython] how to use IronPython in Silverlight 2 One problem is that XamlReader.Load takes the string of XAML and not a filename. But there's something about the XAML that isn't working right too. I'm no XAML expert but simplifying it to the code below works, you can probably build something up from that. Personally for my Silverlight hacking I've just been building up the tree programmatically from Python code even though that's uncool :). from System.Windows import Application from System.Windows.Markup import XamlReader Application.Current.RootVisual = XamlReader.Load(""" """) From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kevin Chu Sent: Friday, March 07, 2008 9:32 AM To: Discussion of IronPython Subject: Re: [IronPython] how to use IronPython in Silverlight 2 hi Dino Thanks for your reply. But I try my sample (look attachment), It can't run! Is my code mistake ? IronPython code: from System.Windows import Application from System.Windows.Markup import XamlReader class App: def __init__(self): Application.Current.RootVisual = XamlReader.Load("app.xaml") self.scene = Application.Current.RootVisual.grid def start(self): # TO DO: Replace this with your application start logic. self.scene.message.Content = "Welcome to Silverlight and IronPython!" App().start() XAML code: On Fri, Mar 7, 2008 at 11:55 AM, Dino Viehland > wrote: You'll need to download the Silverlight 2 SDK. After installing that you'll get all the necessary components installed into something like C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Client. Also installed is an extremely useful tool called Chiron which you'll find somewhere around C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Tools\Chiron. Chiron can take your .py file and produce a .xap which includes the IronPython & DLR DLLs using the /zipdlr command line option. You can also use it to serve http requests and automatically serve up the .xap and let you just edit the files. So once you're ready to make your xap the directory you point at should contain a .py file (I'm not sure what the multi .py file experience is like, but w/ a single file the it doesn't seem the name matters). The simplest thing to put in there is: from System.Windows import Application from System.Windows.Markup import XamlReader Application.Current.RootVisual = XamlReader.Load("someXaml") You can see this from the Ruby perspective over at http://www.iunknown.com/2008/03/dynamic-silverl.html There's various options on how to deploy the DLLs, and you can get into manifest files to deploy additional DLLs, but hopefully that'll get you started. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kevin Chu Sent: Thursday, March 06, 2008 7:39 PM To: Discussion of IronPython Subject: [IronPython] how to use IronPython in Silverlight 2 Silverlight 2 beta1 tools for VS2008 only create C# code file, How to create a IronPython code file? -- Once in a Redmoon _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- Once in a Redmoon -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Tue Mar 11 00:32:06 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 10 Mar 2008 23:32:06 +0000 Subject: [IronPython] how to use IronPython in Silverlight 2 In-Reply-To: <5283CA0A4168DF4FBBD71AE9ECA5A32844F4E0E399@NA-EXMSG-C116.redmond.corp.microsoft.com> References: <41d7f4a90803061938v3e9c9fabna0cc270b1f14e640@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011CF5C2F949@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <41d7f4a90803070931t174d5dc3k72310411ad0dece9@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011CF5C2FA25@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <5283CA0A4168DF4FBBD71AE9ECA5A32844F4E0E399@NA-EXMSG-C116.redmond.corp.microsoft.com> Message-ID: <47D5C4F6.2040606@voidspace.org.uk> Jimmy Schementi wrote: > > To load a XAML file and set the RootVisual, you can do this: > > Application.Current.LoadRootVisual(?file.xaml?) > > It?s how we do it in the python samples on http://dynamicsilverlight.net > Suppose you don't want to load a XAML file - how do you do that (but say set a 'Canvas' instance you have created programatically) ? Michael > ~Jimmy > > *From:* users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Dino Viehland > *Sent:* Friday, March 07, 2008 11:25 AM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] how to use IronPython in Silverlight 2 > > One problem is that XamlReader.Load takes the string of XAML and not a > filename. But there?s something about the XAML that isn?t working > right too. I?m no XAML expert but simplifying it to the code below > works, you can probably build something up from that. Personally for > my Silverlight hacking I?ve just been building up the tree > programmatically from Python code even though that?s uncool J. > > from System.Windows import Application > > from System.Windows.Markup import XamlReader > > Application.Current.RootVisual = XamlReader.Load(""" > > xmlns="http://schemas.microsoft.com/client/2007" > xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> > > > > """) > > *From:* users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Kevin Chu > *Sent:* Friday, March 07, 2008 9:32 AM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] how to use IronPython in Silverlight 2 > > hi Dino > > Thanks for your reply. > > But I try my sample (look attachment), It can't run! Is my code mistake ? > > *IronPython code:* > > from System.Windows import Application > from System.Windows.Markup import XamlReader > > class App: > def __init__(self): > Application.Current.RootVisual = XamlReader.Load("app.xaml") > self.scene = Application.Current.RootVisual.grid > def start(self): > # TO DO: Replace this with your application start logic. > self.scene.message.Content = "Welcome to Silverlight and IronPython!" > > App().start() > > *XAML code:* > > xmlns="http://schemas.microsoft.com/client/2007" > xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> > > > > > > > > On Fri, Mar 7, 2008 at 11:55 AM, Dino Viehland > > > wrote: > > You'll need to download the Silverlight 2 SDK. After installing that > you'll get all the necessary components installed into something like > C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Client. > Also installed is an extremely useful tool called Chiron which you'll > find somewhere around C:\Program Files\Microsoft > SDKs\Silverlight\v2.0\Tools\Chiron. Chiron can take your .py file and > produce a .xap which includes the IronPython & DLR DLLs using the > /zipdlr command line option. You can also use it to serve http > requests and automatically serve up the .xap and let you just edit the > files. > > So once you're ready to make your xap the directory you point at > should contain a .py file (I'm not sure what the multi .py file > experience is like, but w/ a single file the it doesn't seem the name > matters). The simplest thing to put in there is: > > from System.Windows import Application > > from System.Windows.Markup import XamlReader > > Application.Current.RootVisual = XamlReader.Load("someXaml") > > You can see this from the Ruby perspective over at > http://www.iunknown.com/2008/03/dynamic-silverl.html > > There's various options on how to deploy the DLLs, and you can get > into manifest files to deploy additional DLLs, but hopefully that'll > get you started. > > *From:* users-bounces at lists.ironpython.com > > [mailto:users-bounces at lists.ironpython.com > ] *On Behalf Of *Kevin Chu > *Sent:* Thursday, March 06, 2008 7:39 PM > *To:* Discussion of IronPython > *Subject:* [IronPython] how to use IronPython in Silverlight 2 > > Silverlight 2 beta1 tools for VS2008 only create C# code file, > > How to create a IronPython code file? > > -- > Once in a Redmoon > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > -- > Once in a Redmoon > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From dinov at exchange.microsoft.com Tue Mar 11 01:11:40 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 10 Mar 2008 17:11:40 -0700 Subject: [IronPython] how to use IronPython in Silverlight 2 In-Reply-To: <47D5C4F6.2040606@voidspace.org.uk> References: <41d7f4a90803061938v3e9c9fabna0cc270b1f14e640@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011CF5C2F949@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <41d7f4a90803070931t174d5dc3k72310411ad0dece9@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011CF5C2FA25@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <5283CA0A4168DF4FBBD71AE9ECA5A32844F4E0E399@NA-EXMSG-C116.redmond.corp.microsoft.com> <47D5C4F6.2040606@voidspace.org.uk> Message-ID: <7AD436E4270DD54A94238001769C2227011CF5C2FE1F@DF-GRTDANE-MSG.exchange.corp.microsoft.com> That's just Application.Current.RootVisual = myCanvas This is what I've been doing in my own Silverlight experiments, but I suck at using XAML and Blend :) -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Monday, March 10, 2008 4:32 PM To: Discussion of IronPython Subject: Re: [IronPython] how to use IronPython in Silverlight 2 Jimmy Schementi wrote: > > To load a XAML file and set the RootVisual, you can do this: > > Application.Current.LoadRootVisual("file.xaml") > > It's how we do it in the python samples on http://dynamicsilverlight.net > Suppose you don't want to load a XAML file - how do you do that (but say set a 'Canvas' instance you have created programatically) ? Michael > ~Jimmy > > *From:* users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Dino Viehland > *Sent:* Friday, March 07, 2008 11:25 AM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] how to use IronPython in Silverlight 2 > > One problem is that XamlReader.Load takes the string of XAML and not a > filename. But there's something about the XAML that isn't working > right too. I'm no XAML expert but simplifying it to the code below > works, you can probably build something up from that. Personally for > my Silverlight hacking I've just been building up the tree > programmatically from Python code even though that's uncool J. > > from System.Windows import Application > > from System.Windows.Markup import XamlReader > > Application.Current.RootVisual = XamlReader.Load(""" > > xmlns="http://schemas.microsoft.com/client/2007" > xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> > > > > """) > > *From:* users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Kevin Chu > *Sent:* Friday, March 07, 2008 9:32 AM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] how to use IronPython in Silverlight 2 > > hi Dino > > Thanks for your reply. > > But I try my sample (look attachment), It can't run! Is my code mistake ? > > *IronPython code:* > > from System.Windows import Application > from System.Windows.Markup import XamlReader > > class App: > def __init__(self): > Application.Current.RootVisual = XamlReader.Load("app.xaml") > self.scene = Application.Current.RootVisual.grid > def start(self): > # TO DO: Replace this with your application start logic. > self.scene.message.Content = "Welcome to Silverlight and IronPython!" > > App().start() > > *XAML code:* > > xmlns="http://schemas.microsoft.com/client/2007" > xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> > > > > > > > > On Fri, Mar 7, 2008 at 11:55 AM, Dino Viehland > > > wrote: > > You'll need to download the Silverlight 2 SDK. After installing that > you'll get all the necessary components installed into something like > C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Client. > Also installed is an extremely useful tool called Chiron which you'll > find somewhere around C:\Program Files\Microsoft > SDKs\Silverlight\v2.0\Tools\Chiron. Chiron can take your .py file and > produce a .xap which includes the IronPython & DLR DLLs using the > /zipdlr command line option. You can also use it to serve http > requests and automatically serve up the .xap and let you just edit the > files. > > So once you're ready to make your xap the directory you point at > should contain a .py file (I'm not sure what the multi .py file > experience is like, but w/ a single file the it doesn't seem the name > matters). The simplest thing to put in there is: > > from System.Windows import Application > > from System.Windows.Markup import XamlReader > > Application.Current.RootVisual = XamlReader.Load("someXaml") > > You can see this from the Ruby perspective over at > http://www.iunknown.com/2008/03/dynamic-silverl.html > > There's various options on how to deploy the DLLs, and you can get > into manifest files to deploy additional DLLs, but hopefully that'll > get you started. > > *From:* users-bounces at lists.ironpython.com > > [mailto:users-bounces at lists.ironpython.com > ] *On Behalf Of *Kevin Chu > *Sent:* Thursday, March 06, 2008 7:39 PM > *To:* Discussion of IronPython > *Subject:* [IronPython] how to use IronPython in Silverlight 2 > > Silverlight 2 beta1 tools for VS2008 only create C# code file, > > How to create a IronPython code file? > > -- > Once in a Redmoon > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > -- > Once in a Redmoon > > ------------------------------------------------------------------------ > > _______________________________________________ > 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 Jimmy.Schementi at microsoft.com Tue Mar 11 01:15:54 2008 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Mon, 10 Mar 2008 17:15:54 -0700 Subject: [IronPython] how to use IronPython in Silverlight 2 In-Reply-To: <7AD436E4270DD54A94238001769C2227011CF5C2FE1F@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <41d7f4a90803061938v3e9c9fabna0cc270b1f14e640@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011CF5C2F949@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <41d7f4a90803070931t174d5dc3k72310411ad0dece9@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011CF5C2FA25@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <5283CA0A4168DF4FBBD71AE9ECA5A32844F4E0E399@NA-EXMSG-C116.redmond.corp.microsoft.com> <47D5C4F6.2040606@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011CF5C2FE1F@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <5283CA0A4168DF4FBBD71AE9ECA5A32844F4E0E3F9@NA-EXMSG-C116.redmond.corp.microsoft.com> Yep, that's the way to do it =) Ideally, this would be abstracted away in a silverlight.py utility module ... which I see as largely community driven ... so feel free to share anything you think would be great to reuse across all python Silverlight apps. ~js > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Dino Viehland > Sent: Monday, March 10, 2008 5:12 PM > To: Discussion of IronPython > Subject: Re: [IronPython] how to use IronPython in Silverlight 2 > > That's just Application.Current.RootVisual = myCanvas > > This is what I've been doing in my own Silverlight experiments, but I > suck at using XAML and Blend :) > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Monday, March 10, 2008 4:32 PM > To: Discussion of IronPython > Subject: Re: [IronPython] how to use IronPython in Silverlight 2 > > Jimmy Schementi wrote: > > > > To load a XAML file and set the RootVisual, you can do this: > > > > Application.Current.LoadRootVisual("file.xaml") > > > > It's how we do it in the python samples on > http://dynamicsilverlight.net > > > > Suppose you don't want to load a XAML file - how do you do that (but > say > set a 'Canvas' instance you have created programatically) ? > > Michael > > > > ~Jimmy > > > > *From:* users-bounces at lists.ironpython.com > > [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Dino > Viehland > > *Sent:* Friday, March 07, 2008 11:25 AM > > *To:* Discussion of IronPython > > *Subject:* Re: [IronPython] how to use IronPython in Silverlight 2 > > > > One problem is that XamlReader.Load takes the string of XAML and not > a > > filename. But there's something about the XAML that isn't working > > right too. I'm no XAML expert but simplifying it to the code below > > works, you can probably build something up from that. Personally for > > my Silverlight hacking I've just been building up the tree > > programmatically from Python code even though that's uncool J. > > > > from System.Windows import Application > > > > from System.Windows.Markup import XamlReader > > > > Application.Current.RootVisual = XamlReader.Load(""" > > > > > xmlns="http://schemas.microsoft.com/client/2007" > > xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> > > > > > > > > """) > > > > *From:* users-bounces at lists.ironpython.com > > [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Kevin Chu > > *Sent:* Friday, March 07, 2008 9:32 AM > > *To:* Discussion of IronPython > > *Subject:* Re: [IronPython] how to use IronPython in Silverlight 2 > > > > hi Dino > > > > Thanks for your reply. > > > > But I try my sample (look attachment), It can't run! Is my code > mistake ? > > > > *IronPython code:* > > > > from System.Windows import Application > > from System.Windows.Markup import XamlReader > > > > class App: > > def __init__(self): > > Application.Current.RootVisual = XamlReader.Load("app.xaml") > > self.scene = Application.Current.RootVisual.grid > > def start(self): > > # TO DO: Replace this with your application start logic. > > self.scene.message.Content = "Welcome to Silverlight and IronPython!" > > > > App().start() > > > > *XAML code:* > > > > > xmlns="http://schemas.microsoft.com/client/2007" > > xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> > > > > > > > > > > > > > > > > On Fri, Mar 7, 2008 at 11:55 AM, Dino Viehland > > > > > wrote: > > > > You'll need to download the Silverlight 2 SDK. After installing that > > you'll get all the necessary components installed into something like > > C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Client. > > Also installed is an extremely useful tool called Chiron which you'll > > find somewhere around C:\Program Files\Microsoft > > SDKs\Silverlight\v2.0\Tools\Chiron. Chiron can take your .py file and > > produce a .xap which includes the IronPython & DLR DLLs using the > > /zipdlr command line option. You can also use it to serve http > > requests and automatically serve up the .xap and let you just edit > the > > files. > > > > So once you're ready to make your xap the directory you point at > > should contain a .py file (I'm not sure what the multi .py file > > experience is like, but w/ a single file the it doesn't seem the name > > matters). The simplest thing to put in there is: > > > > from System.Windows import Application > > > > from System.Windows.Markup import XamlReader > > > > Application.Current.RootVisual = XamlReader.Load("someXaml") > > > > You can see this from the Ruby perspective over at > > http://www.iunknown.com/2008/03/dynamic-silverl.html > > > > There's various options on how to deploy the DLLs, and you can get > > into manifest files to deploy additional DLLs, but hopefully that'll > > get you started. > > > > *From:* users-bounces at lists.ironpython.com > > > > [mailto:users-bounces at lists.ironpython.com > > ] *On Behalf Of *Kevin Chu > > *Sent:* Thursday, March 06, 2008 7:39 PM > > *To:* Discussion of IronPython > > *Subject:* [IronPython] how to use IronPython in Silverlight 2 > > > > Silverlight 2 beta1 tools for VS2008 only create C# code file, > > > > How to create a IronPython code file? > > > > -- > > Once in a Redmoon > > > > > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > > > > > -- > > Once in a Redmoon > > > > --------------------------------------------------------------------- > --- > > > > _______________________________________________ > > 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 redmoon17 at gmail.com Tue Mar 11 04:52:21 2008 From: redmoon17 at gmail.com (Kevin Chu) Date: Tue, 11 Mar 2008 11:52:21 +0800 Subject: [IronPython] how to use IronPython in Silverlight 2 In-Reply-To: <5283CA0A4168DF4FBBD71AE9ECA5A32844F4E0E3F9@NA-EXMSG-C116.redmond.corp.microsoft.com> References: <41d7f4a90803061938v3e9c9fabna0cc270b1f14e640@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011CF5C2F949@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <41d7f4a90803070931t174d5dc3k72310411ad0dece9@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011CF5C2FA25@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <5283CA0A4168DF4FBBD71AE9ECA5A32844F4E0E399@NA-EXMSG-C116.redmond.corp.microsoft.com> <47D5C4F6.2040606@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011CF5C2FE1F@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <5283CA0A4168DF4FBBD71AE9ECA5A32844F4E0E3F9@NA-EXMSG-C116.redmond.corp.microsoft.com> Message-ID: <41d7f4a90803102052m10aae43as3f9bb54c77495ac3@mail.gmail.com> I write a blog about this topic, link: http://www.cnblogs.com/redmoon/archive/2008/03/08/1096331.html It is be writed in Chinese. On Tue, Mar 11, 2008 at 8:15 AM, Jimmy Schementi < Jimmy.Schementi at microsoft.com> wrote: > Yep, that's the way to do it =) > > Ideally, this would be abstracted away in a silverlight.py utility module > ... which I see as largely community driven ... so feel free to share > anything you think would be great to reuse across all python Silverlight > apps. > > ~js > > > -----Original Message----- > > From: users-bounces at lists.ironpython.com [mailto:users- > > bounces at lists.ironpython.com] On Behalf Of Dino Viehland > > Sent: Monday, March 10, 2008 5:12 PM > > To: Discussion of IronPython > > Subject: Re: [IronPython] how to use IronPython in Silverlight 2 > > > > That's just Application.Current.RootVisual = myCanvas > > > > This is what I've been doing in my own Silverlight experiments, but I > > suck at using XAML and Blend :) > > > > -----Original Message----- > > From: users-bounces at lists.ironpython.com [mailto:users- > > bounces at lists.ironpython.com] On Behalf Of Michael Foord > > Sent: Monday, March 10, 2008 4:32 PM > > To: Discussion of IronPython > > Subject: Re: [IronPython] how to use IronPython in Silverlight 2 > > > > Jimmy Schementi wrote: > > > > > > To load a XAML file and set the RootVisual, you can do this: > > > > > > Application.Current.LoadRootVisual("file.xaml") > > > > > > It's how we do it in the python samples on > > http://dynamicsilverlight.net > > > > > > > Suppose you don't want to load a XAML file - how do you do that (but > > say > > set a 'Canvas' instance you have created programatically) ? > > > > Michael > > > > > > > ~Jimmy > > > > > > *From:* users-bounces at lists.ironpython.com > > > [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Dino > > Viehland > > > *Sent:* Friday, March 07, 2008 11:25 AM > > > *To:* Discussion of IronPython > > > *Subject:* Re: [IronPython] how to use IronPython in Silverlight 2 > > > > > > One problem is that XamlReader.Load takes the string of XAML and not > > a > > > filename. But there's something about the XAML that isn't working > > > right too. I'm no XAML expert but simplifying it to the code below > > > works, you can probably build something up from that. Personally for > > > my Silverlight hacking I've just been building up the tree > > > programmatically from Python code even though that's uncool J. > > > > > > from System.Windows import Application > > > > > > from System.Windows.Markup import XamlReader > > > > > > Application.Current.RootVisual = XamlReader.Load(""" > > > > > > > > xmlns="http://schemas.microsoft.com/client/2007" > > > xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> > > > > > > > > > > > > """) > > > > > > *From:* users-bounces at lists.ironpython.com > > > [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Kevin Chu > > > *Sent:* Friday, March 07, 2008 9:32 AM > > > *To:* Discussion of IronPython > > > *Subject:* Re: [IronPython] how to use IronPython in Silverlight 2 > > > > > > hi Dino > > > > > > Thanks for your reply. > > > > > > But I try my sample (look attachment), It can't run! Is my code > > mistake ? > > > > > > *IronPython code:* > > > > > > from System.Windows import Application > > > from System.Windows.Markup import XamlReader > > > > > > class App: > > > def __init__(self): > > > Application.Current.RootVisual = XamlReader.Load("app.xaml") > > > self.scene = Application.Current.RootVisual.grid > > > def start(self): > > > # TO DO: Replace this with your application start logic. > > > self.scene.message.Content = "Welcome to Silverlight and IronPython!" > > > > > > App().start() > > > > > > *XAML code:* > > > > > > > > xmlns="http://schemas.microsoft.com/client/2007" > > > xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> > > > > > > > > > > > > > > > > > > > > > > > > On Fri, Mar 7, 2008 at 11:55 AM, Dino Viehland > > > > > > > wrote: > > > > > > You'll need to download the Silverlight 2 SDK. After installing that > > > you'll get all the necessary components installed into something like > > > C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Client. > > > Also installed is an extremely useful tool called Chiron which you'll > > > find somewhere around C:\Program Files\Microsoft > > > SDKs\Silverlight\v2.0\Tools\Chiron. Chiron can take your .py file and > > > produce a .xap which includes the IronPython & DLR DLLs using the > > > /zipdlr command line option. You can also use it to serve http > > > requests and automatically serve up the .xap and let you just edit > > the > > > files. > > > > > > So once you're ready to make your xap the directory you point at > > > should contain a .py file (I'm not sure what the multi .py file > > > experience is like, but w/ a single file the it doesn't seem the name > > > matters). The simplest thing to put in there is: > > > > > > from System.Windows import Application > > > > > > from System.Windows.Markup import XamlReader > > > > > > Application.Current.RootVisual = XamlReader.Load("someXaml") > > > > > > You can see this from the Ruby perspective over at > > > http://www.iunknown.com/2008/03/dynamic-silverl.html > > > > > > There's various options on how to deploy the DLLs, and you can get > > > into manifest files to deploy additional DLLs, but hopefully that'll > > > get you started. > > > > > > *From:* users-bounces at lists.ironpython.com > > > > > > [mailto:users-bounces at lists.ironpython.com > > > ] *On Behalf Of *Kevin Chu > > > *Sent:* Thursday, March 06, 2008 7:39 PM > > > *To:* Discussion of IronPython > > > *Subject:* [IronPython] how to use IronPython in Silverlight 2 > > > > > > Silverlight 2 beta1 tools for VS2008 only create C# code file, > > > > > > How to create a IronPython code file? > > > > > > -- > > > Once in a Redmoon > > > > > > > > > _______________________________________________ > > > Users mailing list > > > Users at lists.ironpython.com > > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > > > > > > > > > > -- > > > Once in a Redmoon > > > > > > --------------------------------------------------------------------- > > --- > > > > > > _______________________________________________ > > > 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 > -- Once in a Redmoon -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Tue Mar 11 15:45:35 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 11 Mar 2008 14:45:35 +0000 Subject: [IronPython] how to use IronPython in Silverlight 2 In-Reply-To: <7AD436E4270DD54A94238001769C2227011CF5C2FE1F@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <41d7f4a90803061938v3e9c9fabna0cc270b1f14e640@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011CF5C2F949@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <41d7f4a90803070931t174d5dc3k72310411ad0dece9@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011CF5C2FA25@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <5283CA0A4168DF4FBBD71AE9ECA5A32844F4E0E399@NA-EXMSG-C116.redmond.corp.microsoft.com> <47D5C4F6.2040606@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011CF5C2FE1F@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <47D69B0F.8000502@voidspace.org.uk> Dino Viehland wrote: > That's just Application.Current.RootVisual = myCanvas > > Cool - for some reason this didn't work for me the first time I tried it (I must have done something wrong). My minimal IronPython/Silverlight example is now a single Python file (app.py) containing: from System.Windows import Application from System.Windows.Controls import Canvas, TextBlock canvas = Canvas() textblock = TextBlock() textblock.FontSize = 24 textblock.Text = 'Hello world from IronPython' canvas.Children.Add(textblock) Application.Current.RootVisual = canvas > This is what I've been doing in my own Silverlight experiments, but I suck at using XAML and Blend :) > Me too. :-) Michael http://www.manning.com/foord > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Monday, March 10, 2008 4:32 PM > To: Discussion of IronPython > Subject: Re: [IronPython] how to use IronPython in Silverlight 2 > > Jimmy Schementi wrote: > >> To load a XAML file and set the RootVisual, you can do this: >> >> Application.Current.LoadRootVisual("file.xaml") >> >> It's how we do it in the python samples on http://dynamicsilverlight.net >> >> > > Suppose you don't want to load a XAML file - how do you do that (but say > set a 'Canvas' instance you have created programatically) ? > > Michael > > > >> ~Jimmy >> >> *From:* users-bounces at lists.ironpython.com >> [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Dino Viehland >> *Sent:* Friday, March 07, 2008 11:25 AM >> *To:* Discussion of IronPython >> *Subject:* Re: [IronPython] how to use IronPython in Silverlight 2 >> >> One problem is that XamlReader.Load takes the string of XAML and not a >> filename. But there's something about the XAML that isn't working >> right too. I'm no XAML expert but simplifying it to the code below >> works, you can probably build something up from that. Personally for >> my Silverlight hacking I've just been building up the tree >> programmatically from Python code even though that's uncool J. >> >> from System.Windows import Application >> >> from System.Windows.Markup import XamlReader >> >> Application.Current.RootVisual = XamlReader.Load(""" >> >> > xmlns="http://schemas.microsoft.com/client/2007" >> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> >> >> >> >> """) >> >> *From:* users-bounces at lists.ironpython.com >> [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Kevin Chu >> *Sent:* Friday, March 07, 2008 9:32 AM >> *To:* Discussion of IronPython >> *Subject:* Re: [IronPython] how to use IronPython in Silverlight 2 >> >> hi Dino >> >> Thanks for your reply. >> >> But I try my sample (look attachment), It can't run! Is my code mistake ? >> >> *IronPython code:* >> >> from System.Windows import Application >> from System.Windows.Markup import XamlReader >> >> class App: >> def __init__(self): >> Application.Current.RootVisual = XamlReader.Load("app.xaml") >> self.scene = Application.Current.RootVisual.grid >> def start(self): >> # TO DO: Replace this with your application start logic. >> self.scene.message.Content = "Welcome to Silverlight and IronPython!" >> >> App().start() >> >> *XAML code:* >> >> > xmlns="http://schemas.microsoft.com/client/2007" >> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> >> >> >> >> >> >> >> >> On Fri, Mar 7, 2008 at 11:55 AM, Dino Viehland >> > >> wrote: >> >> You'll need to download the Silverlight 2 SDK. After installing that >> you'll get all the necessary components installed into something like >> C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Client. >> Also installed is an extremely useful tool called Chiron which you'll >> find somewhere around C:\Program Files\Microsoft >> SDKs\Silverlight\v2.0\Tools\Chiron. Chiron can take your .py file and >> produce a .xap which includes the IronPython & DLR DLLs using the >> /zipdlr command line option. You can also use it to serve http >> requests and automatically serve up the .xap and let you just edit the >> files. >> >> So once you're ready to make your xap the directory you point at >> should contain a .py file (I'm not sure what the multi .py file >> experience is like, but w/ a single file the it doesn't seem the name >> matters). The simplest thing to put in there is: >> >> from System.Windows import Application >> >> from System.Windows.Markup import XamlReader >> >> Application.Current.RootVisual = XamlReader.Load("someXaml") >> >> You can see this from the Ruby perspective over at >> http://www.iunknown.com/2008/03/dynamic-silverl.html >> >> There's various options on how to deploy the DLLs, and you can get >> into manifest files to deploy additional DLLs, but hopefully that'll >> get you started. >> >> *From:* users-bounces at lists.ironpython.com >> >> [mailto:users-bounces at lists.ironpython.com >> ] *On Behalf Of *Kevin Chu >> *Sent:* Thursday, March 06, 2008 7:39 PM >> *To:* Discussion of IronPython >> *Subject:* [IronPython] how to use IronPython in Silverlight 2 >> >> Silverlight 2 beta1 tools for VS2008 only create C# code file, >> >> How to create a IronPython code file? >> >> -- >> Once in a Redmoon >> >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> >> >> >> -- >> Once in a Redmoon >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> 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 fuzzyman at voidspace.org.uk Tue Mar 11 23:09:31 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 11 Mar 2008 22:09:31 +0000 Subject: [IronPython] compile bug Message-ID: <47D7031B.7030207@voidspace.org.uk> Hello guys, There is a bug in the Python compile function relating to the 'PyCF_DONT_IMPLY_DEDENT' flag (which was added to support the standard library 'code' module. Python 2.5: >>> compile('def f():\n print "hi"\n\n', '', 'single', PyCF_DONT_IMPLY_DEDENT) at 011572F0, file "", line 1> IronPython 2a8 >>> compile('def f():\n print "hi"\n\n', '', 'single', PyCF_DONT_IMPLY_DEDENT) File "", line 4 ^ SyntaxError: invalid syntax Unfortunately this prevents me implementing an interactive interpreter in Silverlight 2 using code.InteractiveConsole. :-( If there is *any* way this can be fixed in a version of dynamic silverlight then we can still have this for PyCon. ;-) All the best, Michael Foord http://www.manning.com/foord From fuzzyman at voidspace.org.uk Tue Mar 11 23:16:24 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 11 Mar 2008 22:16:24 +0000 Subject: [IronPython] __dict__ of exception instances Message-ID: <47D704B8.5040808@voidspace.org.uk> Hello guys, Attempting to access the '__dict__' attribute of a SyntaxError exception in IP2a8 *returns* an 'OperationFailed' object. The codeop module (Python standard library) compiles source code and *compares* the __dict__ attribute of SyntaxError exception instances... (I can work around this bug for the interactive interpreter...) Michael Foord http://www.manning.com/foord From dfugate at microsoft.com Tue Mar 11 23:24:29 2008 From: dfugate at microsoft.com (Dave Fugate) Date: Tue, 11 Mar 2008 15:24:29 -0700 Subject: [IronPython] __dict__ of exception instances In-Reply-To: <47D704B8.5040808@voidspace.org.uk> References: <47D704B8.5040808@voidspace.org.uk> Message-ID: <7346A825E148B049A9AD1D3ED46A2D91259EC8D5F8@NA-EXMSG-C106.redmond.corp.microsoft.com> Strange... Filed as http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=15571 and thanks for reporting this! -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Tuesday, March 11, 2008 3:16 PM To: Discussion of IronPython Subject: [IronPython] __dict__ of exception instances Hello guys, Attempting to access the '__dict__' attribute of a SyntaxError exception in IP2a8 *returns* an 'OperationFailed' object. The codeop module (Python standard library) compiles source code and *compares* the __dict__ attribute of SyntaxError exception instances... (I can work around this bug for the interactive interpreter...) Michael Foord http://www.manning.com/foord _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Wed Mar 12 00:17:07 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 11 Mar 2008 23:17:07 +0000 Subject: [IronPython] No OpenReadCompleted Event for WebClient in Silverlight 2 Message-ID: <47D712F3.6060008@voidspace.org.uk> Hello guys, With the following code executed in Silverlight2 I find I get the 'DownloadProgressChanged' event fired 3 times and the 'OpenReadCompleted' not at all. :-( The changed event shows 100% completed every time it is fired... from System import Uri, UriKind from System.Net import WebClient uri = Uri('/', UriKind.Relative) web = WebClient() def completed(s, e): print 'Completed' print e.Error print e.Cancelled print e.Result def changed(s, e): print 'Bytes Recieved', e.BytesReceived print 'Progress Percentage', e.ProgressPercentage web.OpenReadCompleted += completed web.DownloadProgressChanged += changed web.DownloadStringAsync(uri) Anyone got any clues? Thanks Michael http://www.manning.com/foord From dinov at exchange.microsoft.com Wed Mar 12 01:05:18 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Tue, 11 Mar 2008 17:05:18 -0700 Subject: [IronPython] compile bug In-Reply-To: <47D7031B.7030207@voidspace.org.uk> References: <47D7031B.7030207@voidspace.org.uk> Message-ID: <7AD436E4270DD54A94238001769C2227011D8038249F@DF-GRTDANE-MSG.exchange.corp.microsoft.com> I'll take a look and get back to you. Recompiling the dynamic silverlight bits might be a bit of a pain though (there's a bunch of internal process required to ship out binaries). One option might be to use the Parser class directly but I don't know if that'll help you too much. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Tuesday, March 11, 2008 3:10 PM To: Discussion of IronPython Subject: [IronPython] compile bug Hello guys, There is a bug in the Python compile function relating to the 'PyCF_DONT_IMPLY_DEDENT' flag (which was added to support the standard library 'code' module. Python 2.5: >>> compile('def f():\n print "hi"\n\n', '', 'single', PyCF_DONT_IMPLY_DEDENT) at 011572F0, file "", line 1> IronPython 2a8 >>> compile('def f():\n print "hi"\n\n', '', 'single', PyCF_DONT_IMPLY_DEDENT) File "", line 4 ^ SyntaxError: invalid syntax Unfortunately this prevents me implementing an interactive interpreter in Silverlight 2 using code.InteractiveConsole. :-( If there is *any* way this can be fixed in a version of dynamic silverlight then we can still have this for PyCon. ;-) All the best, Michael Foord http://www.manning.com/foord _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at exchange.microsoft.com Wed Mar 12 01:08:26 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Tue, 11 Mar 2008 17:08:26 -0700 Subject: [IronPython] __dict__ of exception instances In-Reply-To: <7346A825E148B049A9AD1D3ED46A2D91259EC8D5F8@NA-EXMSG-C106.redmond.corp.microsoft.com> References: <47D704B8.5040808@voidspace.org.uk> <7346A825E148B049A9AD1D3ED46A2D91259EC8D5F8@NA-EXMSG-C106.redmond.corp.microsoft.com> Message-ID: <7AD436E4270DD54A94238001769C2227011D803824A3@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Interestingly it happens for any exception class with any property: >>> BaseException().abc This is somehow related to the new-style exception support for 2.5 compatibility. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dave Fugate Sent: Tuesday, March 11, 2008 3:24 PM To: Discussion of IronPython Subject: Re: [IronPython] __dict__ of exception instances Strange... Filed as http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=15571 and thanks for reporting this! -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Tuesday, March 11, 2008 3:16 PM To: Discussion of IronPython Subject: [IronPython] __dict__ of exception instances Hello guys, Attempting to access the '__dict__' attribute of a SyntaxError exception in IP2a8 *returns* an 'OperationFailed' object. The codeop module (Python standard library) compiles source code and *compares* the __dict__ attribute of SyntaxError exception instances... (I can work around this bug for the interactive interpreter...) Michael Foord http://www.manning.com/foord _______________________________________________ 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 fuzzyman at voidspace.org.uk Wed Mar 12 01:19:07 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Wed, 12 Mar 2008 00:19:07 +0000 Subject: [IronPython] compile bug In-Reply-To: <7AD436E4270DD54A94238001769C2227011D8038249F@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <47D7031B.7030207@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011D8038249F@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <47D7217B.4030801@voidspace.org.uk> Dino Viehland wrote: > I'll take a look and get back to you. Recompiling the dynamic silverlight bits might be a bit of a pain though (there's a bunch of internal process required to ship out binaries). > > One option might be to use the Parser class directly but I don't know if that'll help you too much. > Well - if you can suggest some code. ;-) Oh well. Michael > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Tuesday, March 11, 2008 3:10 PM > To: Discussion of IronPython > Subject: [IronPython] compile bug > > Hello guys, > > There is a bug in the Python compile function relating to the > 'PyCF_DONT_IMPLY_DEDENT' flag (which was added to support the standard > library 'code' module. > > > Python 2.5: > > >>>> compile('def f():\n print "hi"\n\n', '', 'single', >>>> > PyCF_DONT_IMPLY_DEDENT) > at 011572F0, file "", line 1> > > IronPython 2a8 > >>>> compile('def f():\n print "hi"\n\n', '', 'single', >>>> > PyCF_DONT_IMPLY_DEDENT) > File "", line 4 > > ^ > SyntaxError: invalid syntax > > Unfortunately this prevents me implementing an interactive interpreter > in Silverlight 2 using code.InteractiveConsole. :-( > > If there is *any* way this can be fixed in a version of dynamic > silverlight then we can still have this for PyCon. ;-) > > All the best, > > Michael Foord > http://www.manning.com/foord > > _______________________________________________ > 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 fuzzyman at voidspace.org.uk Wed Mar 12 01:21:28 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Wed, 12 Mar 2008 00:21:28 +0000 Subject: [IronPython] Exception Handling in Silverlight 2 Message-ID: <47D72208.6080208@voidspace.org.uk> Hello guys, I'm seeing some oddness in exception handling in asynchronous callbacks (including handlers attached to HTML events). If I have the following code for example which raises an exception in a 'click handler' on a xaml animation: canvas = XamlReader.Load(xaml) storyboard = canvas.FindName('Example') storyboard.AutoReverse = True def OnClick(sender, event): storyboard.Begin() print 'before' x = None try: x = int('hi') except Exception, e: print 'oops', e x = 3 print 'after', x canvas.MouseLeftButtonDown += OnClick When I click I see the 'before' and 'after' prints (I have diverted stdout) - but the exception handling code never seems to be executed. Michael http://www.manning.com/foord From felciano at yahoo.com Wed Mar 12 05:10:51 2008 From: felciano at yahoo.com (Ramon M. Felciano @ Yahoo) Date: Tue, 11 Mar 2008 21:10:51 -0700 Subject: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? In-Reply-To: <3FA51E96F92363468CF062D992DC84681F894E87EE@NA-EXMSG-C106.redmond.corp.microsoft.com> References: <47D4D087.4050301@yahoo.com> <3FA51E96F92363468CF062D992DC846818CB77DB04@NA-EXMSG-C106.redmond.corp.microsoft.com> <47D56A37.7060806@yahoo.com> <3FA51E96F92363468CF062D992DC84681F894E85B5@NA-EXMSG-C106.redmond.corp.microsoft.com> <47D5ADBE.4010308@yahoo.com> <3FA51E96F92363468CF062D992DC84681F894E87EE@NA-EXMSG-C106.redmond.corp.microsoft.com> Message-ID: <47D757CB.7080608@yahoo.com> Hi Srivatsn -- Thanks! Here's the constructor for the C# code: ------------------------ using System; using System.ComponentModel; using System.Diagnostics; using System.Web.Services; using System.Web.Services.Protocols; using System.Xml.Serialization; // // This source code was auto-generated by wsdl, Version=2.0.50727.42. // /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Web.Services.WebServiceBindingAttribute(Name="UserServiceSoap", Namespace="http://targetprocess.com")] [System.Xml.Serialization.XmlIncludeAttribute(typeof(DataTransferObject))] [System.Xml.Serialization.XmlIncludeAttribute(typeof(object[]))] public partial class UserService : Microsoft.Web.Services3.WebServicesClientProtocol { private System.Threading.SendOrPostCallback RetrieveAllForDefaultRoleOperationCompleted; private System.Threading.SendOrPostCallback GetByIDOperationCompleted; private System.Threading.SendOrPostCallback CreateOperationCompleted; private System.Threading.SendOrPostCallback UpdateOperationCompleted; private System.Threading.SendOrPostCallback DeleteOperationCompleted; private System.Threading.SendOrPostCallback RetrieveAllOperationCompleted; private System.Threading.SendOrPostCallback RetrieveOperationCompleted; private System.Threading.SendOrPostCallback RetrievePageOperationCompleted; private System.Threading.SendOrPostCallback RetrieveCountOperationCompleted; /// public UserService() { this.Url = "http://ingenuity.tpondemand.com/Services/UserService.asmx"; } ------------------------ On the python side, I'm trying to generate this dynamically using ------------------------ import clr clr.AddReference("DynamicWebServiceHelpers.dll") from DynamicWebServiceHelpers import * userService = WebService.Load('http://www.example.com/Services/UserService.asmx') ------------------------ Any ideas? Ramon Srivatsn Narayanan wrote: > In the C# side you are using the constructor of UserService to create an instance of WebServicesClientProtocol. In the python side, you don't seem to be creating an instance of this. You can have a look at the constructor of the generated C# UserService and see how the instance is created and translate that to python. If you are having trouble with that post the constructor code here. > > Srivatsn > > -----Original Message----- > From: Ramon M. Felciano @ Yahoo [mailto:felciano at yahoo.com] > Sent: Monday, March 10, 2008 2:53 PM > To: Srivatsn Narayanan > Cc: Discussion of IronPython > Subject: Re: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? > > Got it -- that may be the problem. I generated the stubs as you > suggested using WseWsdl3.exe (which I assume is the same as the tool you > mention): > > ---------------------------------------- > C:\Program Files\Microsoft WSE\v3.0\Tools>WseWsdl3.exe /type:webClient > http://www.example.com/Services/UserService.asmx?wsdl > Web Services Enhancements 3.0 for Microsoft .NET. > Copyright (c) Microsoft Corporation. > > Microsoft (R) Web Services Description Language Utility > [Microsoft (R) .NET Framework, Version 2.0.50727.42] > Copyright (C) Microsoft Corporation. All rights reserved. > Writing file 'C:\Program Files\Microsoft WSE\v3.0\Tools\UserService.cs'. > ---------------------------------------- > > The generated C# code does extend the right class: > > ---------------------------------------- > public partial class UserService : > Microsoft.Web.Services3.WebServicesClientProtocol { > ---------------------------------------- > > but this code does not contain the SetClientCredential or SetPolicy > methods, which is maybe not surprising giving the partial keyword. > > I can't figure out how to do the equivalent in IronPython. If I check > the type of the returned object, it is of type UserService, and I can't > introspect it to find it's superclass. Am I correct in assuming that > there is no equivalent to wsdl.exe for IronPython? I.e. there is no way > I can use WebServicesHelpers to dump out Python code so I can inspect > this more directly? > > Ramon > > Srivatsn Narayanan wrote: > >> Well, if the WebService.Load method returned an object that this method then yes this should work. You can use wsdl.exe to generate the proxy in C# (or if u already have the code for UserServiceWse) then you can find out how the call is being made inside the UserServiceWse constructor and translate that to python. >> >> >> -----Original Message----- >> From: Ramon M. Felciano @ Yahoo [mailto:felciano at yahoo.com] >> Sent: Monday, March 10, 2008 10:05 AM >> To: Srivatsn Narayanan >> Cc: Discussion of IronPython >> Subject: Re: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? >> >> Hi Srivatsn -- >> >> Thanks for the quick reply. I don't actually have UserServiceWse defined >> on the python side; I assumed that would be dynamically-generated from >> the WSDL call and that the appropriate methods would be found through >> introspectino. Is that incorrect? Is there some sort of stub-generator I >> need to run in order to auto-generate the UserService client class? >> >> Ramon >> >> Srivatsn Narayanan wrote: >> >> >>> Looks like Webservice.Load is not returning a WebServicesClientProtocol. In the C# world you are instantiating a UserServiceWse. You could do the same in python so: >>> userService = UserServiceWse() >>> >>> I assume the definition of that class would look like this: >>> def UserServiceWse(WebServicesClientProtocol): >>> def __init__(self): #The constructor. >>> self.blah = foo >>> ... >>> >>> -----Original Message----- >>> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ramon M. Felciano @ Yahoo >>> Sent: Sunday, March 09, 2008 11:09 PM >>> To: users at lists.ironpython.com >>> Cc: Ramon Felciano >>> Subject: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? >>> >>> Hi -- >>> >>> I'm trying to hook up IronPython to web services secured by Web Services >>> Enhancements (WSE) 3.0. I have some C# sample code that I'm trying to >>> convert to Python and am running into some trouble. I'm a C# and Windows >>> ..NET newbie (using IronPython from the commmandline), so the libraries >>> in question are foreign to me, so I was hoping someone could help me >>> resolve this. The sample code shows: >>> >>> -------------------------- >>> using Microsoft.Web.Services3; >>> using Microsoft.Web.Services3.Design; >>> using Microsoft.Web.Services3.Security; >>> using Microsoft.Web.Services3.Security.Tokens; >>> namespace TpIntegration >>> { >>> public class TpPolicy : Policy { >>> public TpPolicy() { >>> Assertions.Add(new UsernameOverTransportAssertion()); >>> } >>> public static UsernameToken GetUsernameToken(string username, string >>> password, PasswordOption passwordOption) { >>> UsernameToken token = new UsernameToken(username, password, >>> passwordOption); >>> ISecurityTokenManager securityTokenManager = >>> >>> SecurityTokenManager.GetSecurityTokenManagerByTokenType(WSTrust.TokenTypes.UsernameToken); >>> securityTokenManager.CacheSecurityToken(token); >>> return token; >>> } >>> public static void ApplyAutheticationTicket(WebServicesClientProtocol >>> protocol, string userName, string password) { >>> UsernameToken token = GetUsernameToken(userName, password, >>> PasswordOption.SendPlainText); >>> protocol.SetClientCredential(token); >>> protocol.SetPolicy(new TpPolicy()); >>> } >>> } >>> } >>> -------------------------- >>> >>> This is then called using something like this: >>> >>> -------------------------- >>> UserServiceWse userService = new UserServiceWse(); >>> TpPolicy.ApplyAutheticationTicket(userService, "admin", "admin"); >>> -------------------------- >>> >>> I've taken a swing at converting it: >>> >>> -------------------------- >>> import Microsoft.Web.Services3 >>> import Microsoft.Web.Services3.Design >>> import Microsoft.Web.Services3.Security >>> import Microsoft.Web.Services3.Security.Tokens >>> >>> def getUsernameToken(username, password, passwordOption): >>> token = >>> Microsoft.Web.Services3.Security.Tokens.UsernameToken(username, >>> password, passwordOption) >>> securityTokenManager = >>> Microsoft.Web.Services3.Security.Tokens.SecurityTokenManager.GetSecurityTokenManagerByTokenType(Microsoft.Web.Services3.Security.WSTrust.TokenTypes.UsernameToken) >>> securityTokenManager.CacheSecurityToken(token) >>> return token >>> >>> def applyAutheticationTicket(protocol, userName, password): >>> token = getUsernameToken(userName, password, >>> Microsoft.Web.Services3.Security.Tokens.PasswordOption.SendPlainText) >>> protocol.SetClientCredential(token) >>> protocol.SetPolicy(TpPolicy()) >>> -------------------------- >>> >>> but when calling it: >>> >>> -------------------------- >>> userService = >>> WebService.Load('http://www.example.com/Services/UserService.asmx') >>> username = "test" >>> password = "test" >>> applyAutheticationTicket(userService, username, password) >>> -------------------------- >>> >>> I get the following error: >>> >>> AttributeError: 'UserService' object has no attribute 'SetClientCredential' >>> >>> Any suggestions on how to debug this further? In case it matters, this >>> is code from >>> http://www.targetprocess.com/download/tp20/TP_2_Web_Services_Guide.pdf. >>> >>> Thanks! >>> >>> Ramon >>> >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >>> >>> >> >> > > > From srivatsn at microsoft.com Wed Mar 12 07:58:30 2008 From: srivatsn at microsoft.com (Srivatsn Narayanan) Date: Tue, 11 Mar 2008 23:58:30 -0700 Subject: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? In-Reply-To: <47D757CB.7080608@yahoo.com> References: <47D4D087.4050301@yahoo.com> <3FA51E96F92363468CF062D992DC846818CB77DB04@NA-EXMSG-C106.redmond.corp.microsoft.com> <47D56A37.7060806@yahoo.com> <3FA51E96F92363468CF062D992DC84681F894E85B5@NA-EXMSG-C106.redmond.corp.microsoft.com> <47D5ADBE.4010308@yahoo.com> <3FA51E96F92363468CF062D992DC84681F894E87EE@NA-EXMSG-C106.redmond.corp.microsoft.com> <47D757CB.7080608@yahoo.com> Message-ID: <3FA51E96F92363468CF062D992DC84681F894E9219@NA-EXMSG-C106.redmond.corp.microsoft.com> I looked at the code for the DynamicWebServiceHelpers sample on codeplex and it doesn't seem to deal with WSE3.0. So I guess the proxy that is generated by WebService.Load will not derive from WebServicesClientProtocol but from whatever is the base class for the old web services(I think it's SOAPHttpClientProtocol). I guess you could do one of two things. Compile your generated proxy(UserService.cs) into a dll and then use that from python Or port UserService.cs to python. You probably don't need the entire thing. My guess is that if u just set the url it might actually work - something like: userService = WebServicesClientProtocol() userService.Url = "http://www.example.com/Services/UserService.asmx" TpPolicy.ApplyAutheticationTicket(userService, "admin", "admin") -----Original Message----- From: Ramon M. Felciano @ Yahoo [mailto:felciano at yahoo.com] Sent: Tuesday, March 11, 2008 9:11 PM To: Srivatsn Narayanan Cc: Discussion of IronPython Subject: Re: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? Hi Srivatsn -- Thanks! Here's the constructor for the C# code: ------------------------ using System; using System.ComponentModel; using System.Diagnostics; using System.Web.Services; using System.Web.Services.Protocols; using System.Xml.Serialization; // // This source code was auto-generated by wsdl, Version=2.0.50727.42. // /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Web.Services.WebServiceBindingAttribute(Name="UserServiceSoap", Namespace="http://targetprocess.com")] [System.Xml.Serialization.XmlIncludeAttribute(typeof(DataTransferObject))] [System.Xml.Serialization.XmlIncludeAttribute(typeof(object[]))] public partial class UserService : Microsoft.Web.Services3.WebServicesClientProtocol { private System.Threading.SendOrPostCallback RetrieveAllForDefaultRoleOperationCompleted; private System.Threading.SendOrPostCallback GetByIDOperationCompleted; private System.Threading.SendOrPostCallback CreateOperationCompleted; private System.Threading.SendOrPostCallback UpdateOperationCompleted; private System.Threading.SendOrPostCallback DeleteOperationCompleted; private System.Threading.SendOrPostCallback RetrieveAllOperationCompleted; private System.Threading.SendOrPostCallback RetrieveOperationCompleted; private System.Threading.SendOrPostCallback RetrievePageOperationCompleted; private System.Threading.SendOrPostCallback RetrieveCountOperationCompleted; /// public UserService() { this.Url = "http://ingenuity.tpondemand.com/Services/UserService.asmx"; } ------------------------ On the python side, I'm trying to generate this dynamically using ------------------------ import clr clr.AddReference("DynamicWebServiceHelpers.dll") from DynamicWebServiceHelpers import * userService = WebService.Load('http://www.example.com/Services/UserService.asmx') ------------------------ Any ideas? Ramon Srivatsn Narayanan wrote: > In the C# side you are using the constructor of UserService to create an instance of WebServicesClientProtocol. In the python side, you don't seem to be creating an instance of this. You can have a look at the constructor of the generated C# UserService and see how the instance is created and translate that to python. If you are having trouble with that post the constructor code here. > > Srivatsn > > -----Original Message----- > From: Ramon M. Felciano @ Yahoo [mailto:felciano at yahoo.com] > Sent: Monday, March 10, 2008 2:53 PM > To: Srivatsn Narayanan > Cc: Discussion of IronPython > Subject: Re: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? > > Got it -- that may be the problem. I generated the stubs as you > suggested using WseWsdl3.exe (which I assume is the same as the tool you > mention): > > ---------------------------------------- > C:\Program Files\Microsoft WSE\v3.0\Tools>WseWsdl3.exe /type:webClient > http://www.example.com/Services/UserService.asmx?wsdl > Web Services Enhancements 3.0 for Microsoft .NET. > Copyright (c) Microsoft Corporation. > > Microsoft (R) Web Services Description Language Utility > [Microsoft (R) .NET Framework, Version 2.0.50727.42] > Copyright (C) Microsoft Corporation. All rights reserved. > Writing file 'C:\Program Files\Microsoft WSE\v3.0\Tools\UserService.cs'. > ---------------------------------------- > > The generated C# code does extend the right class: > > ---------------------------------------- > public partial class UserService : > Microsoft.Web.Services3.WebServicesClientProtocol { > ---------------------------------------- > > but this code does not contain the SetClientCredential or SetPolicy > methods, which is maybe not surprising giving the partial keyword. > > I can't figure out how to do the equivalent in IronPython. If I check > the type of the returned object, it is of type UserService, and I can't > introspect it to find it's superclass. Am I correct in assuming that > there is no equivalent to wsdl.exe for IronPython? I.e. there is no way > I can use WebServicesHelpers to dump out Python code so I can inspect > this more directly? > > Ramon > > Srivatsn Narayanan wrote: > >> Well, if the WebService.Load method returned an object that this method then yes this should work. You can use wsdl.exe to generate the proxy in C# (or if u already have the code for UserServiceWse) then you can find out how the call is being made inside the UserServiceWse constructor and translate that to python. >> >> >> -----Original Message----- >> From: Ramon M. Felciano @ Yahoo [mailto:felciano at yahoo.com] >> Sent: Monday, March 10, 2008 10:05 AM >> To: Srivatsn Narayanan >> Cc: Discussion of IronPython >> Subject: Re: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? >> >> Hi Srivatsn -- >> >> Thanks for the quick reply. I don't actually have UserServiceWse defined >> on the python side; I assumed that would be dynamically-generated from >> the WSDL call and that the appropriate methods would be found through >> introspectino. Is that incorrect? Is there some sort of stub-generator I >> need to run in order to auto-generate the UserService client class? >> >> Ramon >> >> Srivatsn Narayanan wrote: >> >> >>> Looks like Webservice.Load is not returning a WebServicesClientProtocol. In the C# world you are instantiating a UserServiceWse. You could do the same in python so: >>> userService = UserServiceWse() >>> >>> I assume the definition of that class would look like this: >>> def UserServiceWse(WebServicesClientProtocol): >>> def __init__(self): #The constructor. >>> self.blah = foo >>> ... >>> >>> -----Original Message----- >>> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ramon M. Felciano @ Yahoo >>> Sent: Sunday, March 09, 2008 11:09 PM >>> To: users at lists.ironpython.com >>> Cc: Ramon Felciano >>> Subject: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? >>> >>> Hi -- >>> >>> I'm trying to hook up IronPython to web services secured by Web Services >>> Enhancements (WSE) 3.0. I have some C# sample code that I'm trying to >>> convert to Python and am running into some trouble. I'm a C# and Windows >>> ..NET newbie (using IronPython from the commmandline), so the libraries >>> in question are foreign to me, so I was hoping someone could help me >>> resolve this. The sample code shows: >>> >>> -------------------------- >>> using Microsoft.Web.Services3; >>> using Microsoft.Web.Services3.Design; >>> using Microsoft.Web.Services3.Security; >>> using Microsoft.Web.Services3.Security.Tokens; >>> namespace TpIntegration >>> { >>> public class TpPolicy : Policy { >>> public TpPolicy() { >>> Assertions.Add(new UsernameOverTransportAssertion()); >>> } >>> public static UsernameToken GetUsernameToken(string username, string >>> password, PasswordOption passwordOption) { >>> UsernameToken token = new UsernameToken(username, password, >>> passwordOption); >>> ISecurityTokenManager securityTokenManager = >>> >>> SecurityTokenManager.GetSecurityTokenManagerByTokenType(WSTrust.TokenTypes.UsernameToken); >>> securityTokenManager.CacheSecurityToken(token); >>> return token; >>> } >>> public static void ApplyAutheticationTicket(WebServicesClientProtocol >>> protocol, string userName, string password) { >>> UsernameToken token = GetUsernameToken(userName, password, >>> PasswordOption.SendPlainText); >>> protocol.SetClientCredential(token); >>> protocol.SetPolicy(new TpPolicy()); >>> } >>> } >>> } >>> -------------------------- >>> >>> This is then called using something like this: >>> >>> -------------------------- >>> UserServiceWse userService = new UserServiceWse(); >>> TpPolicy.ApplyAutheticationTicket(userService, "admin", "admin"); >>> -------------------------- >>> >>> I've taken a swing at converting it: >>> >>> -------------------------- >>> import Microsoft.Web.Services3 >>> import Microsoft.Web.Services3.Design >>> import Microsoft.Web.Services3.Security >>> import Microsoft.Web.Services3.Security.Tokens >>> >>> def getUsernameToken(username, password, passwordOption): >>> token = >>> Microsoft.Web.Services3.Security.Tokens.UsernameToken(username, >>> password, passwordOption) >>> securityTokenManager = >>> Microsoft.Web.Services3.Security.Tokens.SecurityTokenManager.GetSecurityTokenManagerByTokenType(Microsoft.Web.Services3.Security.WSTrust.TokenTypes.UsernameToken) >>> securityTokenManager.CacheSecurityToken(token) >>> return token >>> >>> def applyAutheticationTicket(protocol, userName, password): >>> token = getUsernameToken(userName, password, >>> Microsoft.Web.Services3.Security.Tokens.PasswordOption.SendPlainText) >>> protocol.SetClientCredential(token) >>> protocol.SetPolicy(TpPolicy()) >>> -------------------------- >>> >>> but when calling it: >>> >>> -------------------------- >>> userService = >>> WebService.Load('http://www.example.com/Services/UserService.asmx') >>> username = "test" >>> password = "test" >>> applyAutheticationTicket(userService, username, password) >>> -------------------------- >>> >>> I get the following error: >>> >>> AttributeError: 'UserService' object has no attribute 'SetClientCredential' >>> >>> Any suggestions on how to debug this further? In case it matters, this >>> is code from >>> http://www.targetprocess.com/download/tp20/TP_2_Web_Services_Guide.pdf. >>> >>> Thanks! >>> >>> Ramon >>> >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >>> >>> >> >> > > > From fernandoacorreia at gmail.com Wed Mar 12 15:53:51 2008 From: fernandoacorreia at gmail.com (Fernando Correia) Date: Wed, 12 Mar 2008 11:53:51 -0300 Subject: [IronPython] InvalidProgramException testing hosting under NUnit Message-ID: <8140eff40803120753s3d74b8afw4a8a15f55095d664@mail.gmail.com> I have a small hosting class that works on a WinForms app. But it gives an InvalidProgramException when called from a NUnit test. The test project is within the IronPython solution and I've referenced IronPython, IronPython.Modules and Microsoft.Scripting. I'd like to know if other people were able to test hosting using NUnit. Thanks. ********** This is the error report: ********** ------ Test started: Assembly: HostingTest.dll ------ TestCase 'HostingTest.Class1.TestHosting' failed: Microsoft.Scripting.InvalidImplementationException : Type ' IronPython.Runtime.PythonContext' doesn't provide a suitable public constructor or its implementation is faulty. ----> System.TypeInitializationException : O inicializador de tipo de ' IronPython.Runtime.Importer' acionou uma exce??o. ----> System.InvalidProgramException : Common Language Runtime detectou um programa inv?lido. C:\Temp\IronPython v2.0 Alpha 8\IronPython- 2.0A8-Src\IronPython-2.0A8\Src\Microsoft.Scripting\Utils\ReflectionUtils.cs(129,0): em Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type actualType, Object[] args) C:\Temp\IronPython v2.0 Alpha 8\IronPython- 2.0A8-Src\IronPython-2.0A8\Src\Microsoft.Scripting\ScriptDomainManager.cs(276,0): em Microsoft.Scripting.ScriptDomainManager.LanguageRegistration.LoadLanguageContext(ScriptDomainManager manager) C:\Temp\IronPython v2.0 Alpha 8\IronPython- 2.0A8-Src\IronPython-2.0A8\Src\Microsoft.Scripting\ScriptDomainManager.cs(387,0): em Microsoft.Scripting.ScriptDomainManager.TryGetLanguageContext(String languageId, LanguageContext& languageContext) C:\Temp\IronPython v2.0 Alpha 8\IronPython- 2.0A8-Src\IronPython-2.0A8\Src\Microsoft.Scripting\ScriptDomainManager.cs(437,0): em Microsoft.Scripting.ScriptDomainManager.GetEngine(String languageId) C:\Temp\IronPython v2.0 Alpha 8\IronPython- 2.0A8-Src\IronPython-2.0A8\Src\Microsoft.Scripting\Hosting\ScriptEnvironment.cs(156,0): em Microsoft.Scripting.Hosting.ScriptEnvironment.GetEngine(String languageId) C:\Temp\IronPython v2.0 Alpha 8\IronPython- 2.0A8-Src\IronPython-2.0A8\Src\HostingTest\Host.cs(11,0): em HostingTest.Host.Teste() C:\Temp\IronPython v2.0 Alpha 8\IronPython- 2.0A8-Src\IronPython-2.0A8\Src\HostingTest\Class1.cs(12,0): em HostingTest.Class1.TestHosting() --TypeInitializationException em IronPython.Runtime.Importer..ctor(PythonContext context) C:\Temp\IronPython v2.0 Alpha 8\IronPython- 2.0A8-Src\IronPython-2.0A8\Src\IronPython\Runtime\PythonContext.cs(120,0): em IronPython.Runtime.PythonContext..ctor(ScriptDomainManager manager) --InvalidProgramException em Microsoft.Scripting.RuntimeHelpers.CreateSimpleCallSite [T0,T1,T2,T3,T4,R]() C:\Temp\IronPython v2.0 Alpha 8\IronPython- 2.0A8-Src\IronPython-2.0A8\Src\IronPython\Runtime\Importer.cs(74,0): em IronPython.Runtime.Importer.MakeImportSite() C:\Temp\IronPython v2.0 Alpha 8\IronPython- 2.0A8-Src\IronPython-2.0A8\Src\IronPython\Runtime\Importer.cs(49,0): em IronPython.Runtime.Importer..cctor() 0 passed, 1 failed, 0 skipped, took 2,11 seconds. ********** Class1.cs ********** using NUnit.Framework; namespace HostingTest { [TestFixture] public class Class1 { [Test] public void TestHosting() { Host host = new Host(); string x = host.Test(); Assert.AreEqual("Hosting", x); } } } ********** Host.cs ********** using Microsoft.Scripting; using Microsoft.Scripting.Hosting; namespace HostingTest { public class Host { public string Test() { IScriptEnvironment env = ScriptEnvironment.GetEnvironment(); IScriptEngine pe = env.GetEngine("py"); IScriptScope scope = env.CreateScope(); SourceUnit script = pe.CreateScriptSourceFromString(@" def Test(): return 'Hosting' ", SourceCodeKind.Statements); CompiledCode codigo = (CompiledCode)pe.Compile(script); codigo.Execute(scope); SourceUnit function = pe.CreateScriptSourceFromString("Test()"); CompiledCode funcao = (CompiledCode)pe.Compile(function); return funcao.Evaluate(scope).ToString(); } } } -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Wed Mar 12 17:02:04 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Wed, 12 Mar 2008 09:02:04 -0700 Subject: [IronPython] InvalidProgramException testing hosting under NUnit In-Reply-To: <8140eff40803120753s3d74b8afw4a8a15f55095d664@mail.gmail.com> References: <8140eff40803120753s3d74b8afw4a8a15f55095d664@mail.gmail.com> Message-ID: <7AD436E4270DD54A94238001769C2227011D80382523@DF-GRTDANE-MSG.exchange.corp.microsoft.com> There's an inner exception here (probably from Importer.cs in MakeImportSite) but there isn't much info on it. Could you run it under a debugger and get that original stack trace? It's not clear to me why we would blow up there. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Fernando Correia Sent: Wednesday, March 12, 2008 7:54 AM To: users at lists.ironpython.com Subject: [IronPython] InvalidProgramException testing hosting under NUnit I have a small hosting class that works on a WinForms app. But it gives an InvalidProgramException when called from a NUnit test. The test project is within the IronPython solution and I've referenced IronPython, IronPython.Modules and Microsoft.Scripting. I'd like to know if other people were able to test hosting using NUnit. Thanks. ********** This is the error report: ********** ------ Test started: Assembly: HostingTest.dll ------ TestCase 'HostingTest.Class1.TestHosting' failed: Microsoft.Scripting.InvalidImplementationException : Type 'IronPython.Runtime.PythonContext' doesn't provide a suitable public constructor or its implementation is faulty. ----> System.TypeInitializationException : O inicializador de tipo de 'IronPython.Runtime.Importer' acionou uma exce??o. ----> System.InvalidProgramException : Common Language Runtime detectou um programa inv?lido. C:\Temp\IronPython v2.0 Alpha 8\IronPython-2.0A8-Src\IronPython-2.0A8\Src\Microsoft.Scripting\Utils\ReflectionUtils.cs(129,0): em Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type actualType, Object[] args) C:\Temp\IronPython v2.0 Alpha 8\IronPython-2.0A8-Src\IronPython-2.0A8\Src\Microsoft.Scripting\ScriptDomainManager.cs(276,0): em Microsoft.Scripting.ScriptDomainManager.LanguageRegistration.LoadLanguageContext(ScriptDomainManager manager) C:\Temp\IronPython v2.0 Alpha 8\IronPython-2.0A8-Src\IronPython-2.0A8\Src\Microsoft.Scripting\ScriptDomainManager.cs(387,0): em Microsoft.Scripting.ScriptDomainManager.TryGetLanguageContext(String languageId, LanguageContext& languageContext) C:\Temp\IronPython v2.0 Alpha 8\IronPython-2.0A8-Src\IronPython-2.0A8\Src\Microsoft.Scripting\ScriptDomainManager.cs(437,0): em Microsoft.Scripting.ScriptDomainManager.GetEngine(String languageId) C:\Temp\IronPython v2.0 Alpha 8\IronPython-2.0A8-Src\IronPython-2.0A8\Src\Microsoft.Scripting\Hosting\ScriptEnvironment.cs(156,0): em Microsoft.Scripting.Hosting.ScriptEnvironment.GetEngine(String languageId) C:\Temp\IronPython v2.0 Alpha 8\IronPython-2.0A8-Src\IronPython-2.0A8\Src\HostingTest\Host.cs(11,0): em HostingTest.Host.Teste() C:\Temp\IronPython v2.0 Alpha 8\IronPython-2.0A8-Src\IronPython-2.0A8\Src\HostingTest\Class1.cs(12,0): em HostingTest.Class1.TestHosting() --TypeInitializationException em IronPython.Runtime.Importer..ctor(PythonContext context) C:\Temp\IronPython v2.0 Alpha 8\IronPython-2.0A8-Src\IronPython-2.0A8\Src\IronPython\Runtime\PythonContext.cs(120,0): em IronPython.Runtime.PythonContext..ctor(ScriptDomainManager manager) --InvalidProgramException em Microsoft.Scripting.RuntimeHelpers.CreateSimpleCallSite[T0,T1,T2,T3,T4,R]() C:\Temp\IronPython v2.0 Alpha 8\IronPython-2.0A8-Src\IronPython-2.0A8\Src\IronPython\Runtime\Importer.cs(74,0): em IronPython.Runtime.Importer.MakeImportSite() C:\Temp\IronPython v2.0 Alpha 8\IronPython-2.0A8-Src\IronPython-2.0A8\Src\IronPython\Runtime\Importer.cs(49,0): em IronPython.Runtime.Importer..cctor() 0 passed, 1 failed, 0 skipped, took 2,11 seconds. ********** Class1.cs ********** using NUnit.Framework; namespace HostingTest { [TestFixture] public class Class1 { [Test] public void TestHosting() { Host host = new Host(); string x = host.Test(); Assert.AreEqual("Hosting", x); } } } ********** Host.cs ********** using Microsoft.Scripting; using Microsoft.Scripting.Hosting; namespace HostingTest { public class Host { public string Test() { IScriptEnvironment env = ScriptEnvironment.GetEnvironment(); IScriptEngine pe = env.GetEngine("py"); IScriptScope scope = env.CreateScope(); SourceUnit script = pe.CreateScriptSourceFromString(@" def Test(): return 'Hosting' ", SourceCodeKind.Statements); CompiledCode codigo = (CompiledCode)pe.Compile(script); codigo.Execute(scope); SourceUnit function = pe.CreateScriptSourceFromString("Test()"); CompiledCode funcao = (CompiledCode)pe.Compile(function); return funcao.Evaluate(scope).ToString(); } } } -------------- next part -------------- An HTML attachment was scrubbed... URL: From fernandoacorreia at gmail.com Wed Mar 12 17:57:59 2008 From: fernandoacorreia at gmail.com (Fernando Correia) Date: Wed, 12 Mar 2008 13:57:59 -0300 Subject: [IronPython] InvalidProgramException testing hosting under NUnit In-Reply-To: <7AD436E4270DD54A94238001769C2227011D80382523@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <8140eff40803120753s3d74b8afw4a8a15f55095d664@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011D80382523@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <8140eff40803120957x6d7420dboa157384c9bb73821@mail.gmail.com> 2008/3/12, Dino Viehland : > There's an inner exception here (probably from Importer.cs in MakeImportSite) but there isn't much info on it. Could you run it under a debugger and get that original stack trace? It's not clear to me why we would blow up there. Thanks for your help. Sorry for some text in Portuguese below. I hope it doesn't get in the way. The exception occurs within class ReflectionUtils, method CreateInstance. Line 127 is: return (T)Activator.CreateInstance(actualType, args); This in turns ends up calling the constructor public PythonContext(ScriptDomainManager/*!*/ manager) in class PythonContext. Line 120 is: _importer = new Importer(this); A step into this line will cause the exception. The stack trace of the innermost exception ([System.InvalidProgramException] = {"Common Language Runtime detectou um programa inv?lido."}) is: em Microsoft.Scripting.RuntimeHelpers.CreateSimpleCallSite[T0,T1,T2,T3,T4,R]() em IronPython.Runtime.Importer.MakeImportSite() na C:\Temp\IronPython v2.0 Alpha 8\IronPython-2.0A8-Src\IronPython-2.0A8\Src\IronPython\Runtime\Importer.cs:linha 74 em IronPython.Runtime.Importer..cctor() na C:\Temp\IronPython v2.0 Alpha 8\IronPython-2.0A8-Src\IronPython-2.0A8\Src\IronPython\Runtime\Importer.cs:linha 49 The stack trace of the outermost exception (base {System.ApplicationException} = {"Uma exce??o foi acionada pelo destino de uma chamada."}) is: em System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType) em System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType) em System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) em System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) em System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) em System.Activator.CreateInstance(Type type, Object[] args) em Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type actualType, Object[] args) na C:\Temp\IronPython v2.0 Alpha 8\IronPython-2.0A8-Src\IronPython-2.0A8\Src\Microsoft.Scripting\Utils\ReflectionUtils.cs:linha 127 From fuzzyman at gmail.com Wed Mar 12 21:18:26 2008 From: fuzzyman at gmail.com (Michael Foord) Date: Wed, 12 Mar 2008 13:18:26 -0700 (PDT) Subject: [IronPython] No OpenReadCompleted Event for WebClient in Silverlight 2 In-Reply-To: <47D712F3.6060008@voidspace.org.uk> References: <47D712F3.6060008@voidspace.org.uk> Message-ID: <1b5288ba-f19f-4069-8cbb-5445c0399fce@e10g2000prf.googlegroups.com> The correct thing to do is [to not follow the example in the Silverlight docs, but instead] either use: web = WebClient() web.DownloadStringCompleted += completed web.DownloadStringAsync(uri) *or* web = WebClient() web.OpenReadCompleted += completed web.OpenReadAsync(uri) Depending on whether you want to fetch a server resource as a string or as a stream. :-) Michael http://www.manning.com/foord On Mar 11, 11:17 pm, Michael Foord wrote: > Hello guys, > > With the following code executed in Silverlight2 I find I get the > 'DownloadProgressChanged' event fired 3 times and the > 'OpenReadCompleted' not at all. :-( > > The changed event shows 100% completed every time it is fired... > > from System import Uri, UriKind > from System.Net import WebClient > > uri = Uri('/', UriKind.Relative) > web = WebClient() > > def completed(s, e): > print 'Completed' > print e.Error > print e.Cancelled > print e.Result > > def changed(s, e): > print 'Bytes Recieved', e.BytesReceived > print 'Progress Percentage', e.ProgressPercentage > > web.OpenReadCompleted += completed > web.DownloadProgressChanged += changed > web.DownloadStringAsync(uri) > > Anyone got any clues? > > Thanks > > Michaelhttp://www.manning.com/foord > _______________________________________________ > Users mailing list > Us... at lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users-ironpython.com From wildert at gmail.com Wed Mar 12 22:18:50 2008 From: wildert at gmail.com (Todd Wilder) Date: Wed, 12 Mar 2008 15:18:50 -0600 Subject: [IronPython] Access to CLR System namespace when python is executed inside C# Message-ID: I am struggling to get IP to honor the System module when the IP is executed inside C#. I am using Silverlight 2.0 Beta 1. I have the following code. ScriptEnvironment.GetEnvironment().ExecuteSourceUnit( PythonEngine.CurrentEngine.CreateScriptSourceFromString(@" import clr import System", SourceCodeKind.File)); <-- I've also tried SourceCodeKind.Statements and SourceCodeKind.InteractiveCode This code throws a "The method or operation is not implemented" exception. It seems that any reference to System or any of its classes throws the exception. I was hoping to have my custom assemblies executing in IP through C# by now, and I can't even get the CLR assemblies to execute. Please Help! Todd Wilder -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Wed Mar 12 23:14:17 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Wed, 12 Mar 2008 15:14:17 -0700 Subject: [IronPython] Access to CLR System namespace when python is executed inside C# In-Reply-To: References: Message-ID: <7AD436E4270DD54A94238001769C2227011D803826BE@DF-GRTDANE-MSG.exchange.corp.microsoft.com> What's likely happening is that you're getting a different ScriptEnvironment than the one which "normal" script code is running under. You could get the current runtime by: Microsoft.Scripting.Silverlight.DynamicApplication.Current.Environment And then use that because it'll already have System.dll loaded. Alternately you can add the references yourself: ScriptEnvironment.GetEnvironment().LoadAssembly(typeof(string).Assembly); // mscorlib ScriptEnvironment.GetEnvironment().LoadAssembly(typeof(System.Diagnostics.Debug).Assembly); // System.dll From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Todd Wilder Sent: Wednesday, March 12, 2008 2:19 PM To: users at lists.ironpython.com Subject: [IronPython] Access to CLR System namespace when python is executed inside C# I am struggling to get IP to honor the System module when the IP is executed inside C#. I am using Silverlight 2.0 Beta 1. I have the following code. ScriptEnvironment.GetEnvironment().ExecuteSourceUnit(PythonEngine.CurrentEngine.CreateScriptSourceFromString(@" import clr import System", SourceCodeKind.File)); <-- I've also tried SourceCodeKind.Statements and SourceCodeKind.InteractiveCode This code throws a "The method or operation is not implemented" exception. It seems that any reference to System or any of its classes throws the exception. I was hoping to have my custom assemblies executing in IP through C# by now, and I can't even get the CLR assemblies to execute. Please Help! Todd Wilder -------------- next part -------------- An HTML attachment was scrubbed... URL: From felciano at yahoo.com Thu Mar 13 04:25:54 2008 From: felciano at yahoo.com (Ramon M. Felciano @ Yahoo) Date: Wed, 12 Mar 2008 20:25:54 -0700 Subject: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? In-Reply-To: <3FA51E96F92363468CF062D992DC84681F894E9219@NA-EXMSG-C106.redmond.corp.microsoft.com> References: <47D4D087.4050301@yahoo.com> <3FA51E96F92363468CF062D992DC846818CB77DB04@NA-EXMSG-C106.redmond.corp.microsoft.com> <47D56A37.7060806@yahoo.com> <3FA51E96F92363468CF062D992DC84681F894E85B5@NA-EXMSG-C106.redmond.corp.microsoft.com> <47D5ADBE.4010308@yahoo.com> <3FA51E96F92363468CF062D992DC84681F894E87EE@NA-EXMSG-C106.redmond.corp.microsoft.com> <47D757CB.7080608@yahoo.com> <3FA51E96F92363468CF062D992DC84681F894E9219@NA-EXMSG-C106.redmond.corp.microsoft.com> Message-ID: <47D89EC2.4070305@yahoo.com> Nope, no such luck. Here's my test code: -------------------------------- import clr clr.AddReference("DynamicWebServiceHelpers.dll") from DynamicWebServiceHelpers import * clr.AddReference("Microsoft.Web.Services3.dll") import Microsoft.Web.Services3.WebServicesClientProtocol userService = Microsoft.Web.Services3.WebServicesClientProtocol() userService.Url = "http://www.example.com/Services/UserService.asmx" print "Done!" -------------------------------- This produces the following exception: -------------------------------- C:\IronPython-1.1.1\Samples\DynamicWebServiceHelpers\samples>ipy test.py Traceback (most recent call last): File C:\Documents and Settings\felciano\My Documents\LocalWorkspace\Active Projects\Target Process Scripting\IronPython-1.1.1\Samples\DynamicWebServiceHelpers \samples\test.py, line 7, in Initialize File , line 0, in DefaultNew##14 File , line 0, in .ctor##18 File Microsoft.Web.Services3, line unknown, in .ctor File System.Web.Services, line unknown, in .ctor File System.Web.Services, line unknown, in .ctor SystemError: WebServiceBindingAttribute is required on proxy classes. C:\IronPython-1.1.1\Samples\DynamicWebServiceHelpers\samples> -------------------------------- Ramon Srivatsn Narayanan wrote: > I looked at the code for the DynamicWebServiceHelpers sample on codeplex and it doesn't seem to deal with WSE3.0. So I guess the proxy that is generated by WebService.Load will not derive from WebServicesClientProtocol but from whatever is the base class for the old web services(I think it's SOAPHttpClientProtocol). I guess you could do one of two things. Compile your generated proxy(UserService.cs) into a dll and then use that from python > Or port UserService.cs to python. You probably don't need the entire thing. My guess is that if u just set the url it might actually work - something like: > userService = WebServicesClientProtocol() > userService.Url = "http://www.example.com/Services/UserService.asmx" > TpPolicy.ApplyAutheticationTicket(userService, "admin", "admin") > > > -----Original Message----- > From: Ramon M. Felciano @ Yahoo [mailto:felciano at yahoo.com] > Sent: Tuesday, March 11, 2008 9:11 PM > To: Srivatsn Narayanan > Cc: Discussion of IronPython > Subject: Re: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? > > Hi Srivatsn -- > > Thanks! Here's the constructor for the C# code: > > ------------------------ > using System; > using System.ComponentModel; > using System.Diagnostics; > using System.Web.Services; > using System.Web.Services.Protocols; > using System.Xml.Serialization; > > // > // This source code was auto-generated by wsdl, Version=2.0.50727.42. > // > > /// > [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] > [System.Diagnostics.DebuggerStepThroughAttribute()] > [System.ComponentModel.DesignerCategoryAttribute("code")] > [System.Web.Services.WebServiceBindingAttribute(Name="UserServiceSoap", > Namespace="http://targetprocess.com")] > [System.Xml.Serialization.XmlIncludeAttribute(typeof(DataTransferObject))] > [System.Xml.Serialization.XmlIncludeAttribute(typeof(object[]))] > public partial class UserService : > Microsoft.Web.Services3.WebServicesClientProtocol { > private System.Threading.SendOrPostCallback > RetrieveAllForDefaultRoleOperationCompleted; > private System.Threading.SendOrPostCallback GetByIDOperationCompleted; > private System.Threading.SendOrPostCallback CreateOperationCompleted; > private System.Threading.SendOrPostCallback UpdateOperationCompleted; > private System.Threading.SendOrPostCallback DeleteOperationCompleted; > private System.Threading.SendOrPostCallback > RetrieveAllOperationCompleted; > private System.Threading.SendOrPostCallback RetrieveOperationCompleted; > private System.Threading.SendOrPostCallback > RetrievePageOperationCompleted; > private System.Threading.SendOrPostCallback > RetrieveCountOperationCompleted; > > /// > public UserService() { > this.Url = > "http://ingenuity.tpondemand.com/Services/UserService.asmx"; > } > ------------------------ > > On the python side, I'm trying to generate this dynamically using > > ------------------------ > import clr > clr.AddReference("DynamicWebServiceHelpers.dll") > from DynamicWebServiceHelpers import * > userService = > WebService.Load('http://www.example.com/Services/UserService.asmx') > ------------------------ > > Any ideas? > > Ramon > > > > Srivatsn Narayanan wrote: > >> In the C# side you are using the constructor of UserService to create an instance of WebServicesClientProtocol. In the python side, you don't seem to be creating an instance of this. You can have a look at the constructor of the generated C# UserService and see how the instance is created and translate that to python. If you are having trouble with that post the constructor code here. >> >> Srivatsn >> >> -----Original Message----- >> From: Ramon M. Felciano @ Yahoo [mailto:felciano at yahoo.com] >> Sent: Monday, March 10, 2008 2:53 PM >> To: Srivatsn Narayanan >> Cc: Discussion of IronPython >> Subject: Re: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? >> >> Got it -- that may be the problem. I generated the stubs as you >> suggested using WseWsdl3.exe (which I assume is the same as the tool you >> mention): >> >> ---------------------------------------- >> C:\Program Files\Microsoft WSE\v3.0\Tools>WseWsdl3.exe /type:webClient >> http://www.example.com/Services/UserService.asmx?wsdl >> Web Services Enhancements 3.0 for Microsoft .NET. >> Copyright (c) Microsoft Corporation. >> >> Microsoft (R) Web Services Description Language Utility >> [Microsoft (R) .NET Framework, Version 2.0.50727.42] >> Copyright (C) Microsoft Corporation. All rights reserved. >> Writing file 'C:\Program Files\Microsoft WSE\v3.0\Tools\UserService.cs'. >> ---------------------------------------- >> >> The generated C# code does extend the right class: >> >> ---------------------------------------- >> public partial class UserService : >> Microsoft.Web.Services3.WebServicesClientProtocol { >> ---------------------------------------- >> >> but this code does not contain the SetClientCredential or SetPolicy >> methods, which is maybe not surprising giving the partial keyword. >> >> I can't figure out how to do the equivalent in IronPython. If I check >> the type of the returned object, it is of type UserService, and I can't >> introspect it to find it's superclass. Am I correct in assuming that >> there is no equivalent to wsdl.exe for IronPython? I.e. there is no way >> I can use WebServicesHelpers to dump out Python code so I can inspect >> this more directly? >> >> Ramon >> >> Srivatsn Narayanan wrote: >> >> >>> Well, if the WebService.Load method returned an object that this method then yes this should work. You can use wsdl.exe to generate the proxy in C# (or if u already have the code for UserServiceWse) then you can find out how the call is being made inside the UserServiceWse constructor and translate that to python. >>> >>> >>> -----Original Message----- >>> From: Ramon M. Felciano @ Yahoo [mailto:felciano at yahoo.com] >>> Sent: Monday, March 10, 2008 10:05 AM >>> To: Srivatsn Narayanan >>> Cc: Discussion of IronPython >>> Subject: Re: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? >>> >>> Hi Srivatsn -- >>> >>> Thanks for the quick reply. I don't actually have UserServiceWse defined >>> on the python side; I assumed that would be dynamically-generated from >>> the WSDL call and that the appropriate methods would be found through >>> introspectino. Is that incorrect? Is there some sort of stub-generator I >>> need to run in order to auto-generate the UserService client class? >>> >>> Ramon >>> >>> Srivatsn Narayanan wrote: >>> >>> >>> >>>> Looks like Webservice.Load is not returning a WebServicesClientProtocol. In the C# world you are instantiating a UserServiceWse. You could do the same in python so: >>>> userService = UserServiceWse() >>>> >>>> I assume the definition of that class would look like this: >>>> def UserServiceWse(WebServicesClientProtocol): >>>> def __init__(self): #The constructor. >>>> self.blah = foo >>>> ... >>>> >>>> -----Original Message----- >>>> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ramon M. Felciano @ Yahoo >>>> Sent: Sunday, March 09, 2008 11:09 PM >>>> To: users at lists.ironpython.com >>>> Cc: Ramon Felciano >>>> Subject: [IronPython] Newbie: IronPython and WSE 3.0 (translation from C# example)? >>>> >>>> Hi -- >>>> >>>> I'm trying to hook up IronPython to web services secured by Web Services >>>> Enhancements (WSE) 3.0. I have some C# sample code that I'm trying to >>>> convert to Python and am running into some trouble. I'm a C# and Windows >>>> ..NET newbie (using IronPython from the commmandline), so the libraries >>>> in question are foreign to me, so I was hoping someone could help me >>>> resolve this. The sample code shows: >>>> >>>> -------------------------- >>>> using Microsoft.Web.Services3; >>>> using Microsoft.Web.Services3.Design; >>>> using Microsoft.Web.Services3.Security; >>>> using Microsoft.Web.Services3.Security.Tokens; >>>> namespace TpIntegration >>>> { >>>> public class TpPolicy : Policy { >>>> public TpPolicy() { >>>> Assertions.Add(new UsernameOverTransportAssertion()); >>>> } >>>> public static UsernameToken GetUsernameToken(string username, string >>>> password, PasswordOption passwordOption) { >>>> UsernameToken token = new UsernameToken(username, password, >>>> passwordOption); >>>> ISecurityTokenManager securityTokenManager = >>>> >>>> SecurityTokenManager.GetSecurityTokenManagerByTokenType(WSTrust.TokenTypes.UsernameToken); >>>> securityTokenManager.CacheSecurityToken(token); >>>> return token; >>>> } >>>> public static void ApplyAutheticationTicket(WebServicesClientProtocol >>>> protocol, string userName, string password) { >>>> UsernameToken token = GetUsernameToken(userName, password, >>>> PasswordOption.SendPlainText); >>>> protocol.SetClientCredential(token); >>>> protocol.SetPolicy(new TpPolicy()); >>>> } >>>> } >>>> } >>>> -------------------------- >>>> >>>> This is then called using something like this: >>>> >>>> -------------------------- >>>> UserServiceWse userService = new UserServiceWse(); >>>> TpPolicy.ApplyAutheticationTicket(userService, "admin", "admin"); >>>> -------------------------- >>>> >>>> I've taken a swing at converting it: >>>> >>>> -------------------------- >>>> import Microsoft.Web.Services3 >>>> import Microsoft.Web.Services3.Design >>>> import Microsoft.Web.Services3.Security >>>> import Microsoft.Web.Services3.Security.Tokens >>>> >>>> def getUsernameToken(username, password, passwordOption): >>>> token = >>>> Microsoft.Web.Services3.Security.Tokens.UsernameToken(username, >>>> password, passwordOption) >>>> securityTokenManager = >>>> Microsoft.Web.Services3.Security.Tokens.SecurityTokenManager.GetSecurityTokenManagerByTokenType(Microsoft.Web.Services3.Security.WSTrust.TokenTypes.UsernameToken) >>>> securityTokenManager.CacheSecurityToken(token) >>>> return token >>>> >>>> def applyAutheticationTicket(protocol, userName, password): >>>> token = getUsernameToken(userName, password, >>>> Microsoft.Web.Services3.Security.Tokens.PasswordOption.SendPlainText) >>>> protocol.SetClientCredential(token) >>>> protocol.SetPolicy(TpPolicy()) >>>> -------------------------- >>>> >>>> but when calling it: >>>> >>>> -------------------------- >>>> userService = >>>> WebService.Load('http://www.example.com/Services/UserService.asmx') >>>> username = "test" >>>> password = "test" >>>> applyAutheticationTicket(userService, username, password) >>>> -------------------------- >>>> >>>> I get the following error: >>>> >>>> AttributeError: 'UserService' object has no attribute 'SetClientCredential' >>>> >>>> Any suggestions on how to debug this further? In case it matters, this >>>> is code from >>>> http://www.targetprocess.com/download/tp20/TP_2_Web_Services_Guide.pdf. >>>> >>>> Thanks! >>>> >>>> Ramon >>>> >>>> _______________________________________________ >>>> Users mailing list >>>> Users at lists.ironpython.com >>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>>> >>>> >>>> >>>> >>>> >>> >> >> > > > From leculver at microsoft.com Thu Mar 13 19:38:43 2008 From: leculver at microsoft.com (Lee Culver) Date: Thu, 13 Mar 2008 11:38:43 -0700 Subject: [IronPython] DLR/ToyScript: Parser generator? Message-ID: <6512F99DEFF77C418E6738CE6E12FD4E5DC208558B@NA-EXMSG-C105.redmond.corp.microsoft.com> Forgive the wide audience, there's not really a DLR mailing list... I've been reading through Martin Maly's blog and I've enjoyed it, though I've noticed it glossed over one issue...how the ToyScript parser/lexer was created. I've dug through the source of and they look hand written, as does the IronPython parser/lexer. Are all of these hand written or is there some tool you use to write them? Does anyone know of a good parser generator for .Net? I've been wanting to play with the DLR some, but I don't want to pay the up-front price of writing a parser if I can help it. I've seen MPLEX/MPPG, but they seem a bit under-documented. Thanks, -Lee -------------- next part -------------- An HTML attachment was scrubbed... URL: From christopher.masters at credit-suisse.com Thu Mar 13 19:40:54 2008 From: christopher.masters at credit-suisse.com (Masters, Christopher) Date: Thu, 13 Mar 2008 18:40:54 -0000 Subject: [IronPython] DLR/ToyScript: Parser generator? Message-ID: <8C984B4799C04D4B8F80F746537145E11EA49BED@elon12p32001.csfp.co.uk> Have a look a GOLD http://www.devincook.com/goldparser/ Cheers Chris _____ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Lee Culver Sent: 13 March 2008 18:39 To: Discussion of IronPython Subject: [IronPython] DLR/ToyScript: Parser generator? Forgive the wide audience, there's not really a DLR mailing list... I've been reading through Martin Maly's blog and I've enjoyed it, though I've noticed it glossed over one issue...how the ToyScript parser/lexer was created. I've dug through the source of and they look hand written, as does the IronPython parser/lexer. Are all of these hand written or is there some tool you use to write them? Does anyone know of a good parser generator for .Net? I've been wanting to play with the DLR some, but I don't want to pay the up-front price of writing a parser if I can help it. I've seen MPLEX/MPPG, but they seem a bit under-documented. Thanks, -Lee ============================================================================== Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html ============================================================================== -------------- next part -------------- An HTML attachment was scrubbed... URL: From miha.valencic at gmail.com Thu Mar 13 22:17:40 2008 From: miha.valencic at gmail.com (Miha Valencic) Date: Thu, 13 Mar 2008 22:17:40 +0100 Subject: [IronPython] DLR/ToyScript: Parser generator? In-Reply-To: <8C984B4799C04D4B8F80F746537145E11EA49BED@elon12p32001.csfp.co.uk> References: <8C984B4799C04D4B8F80F746537145E11EA49BED@elon12p32001.csfp.co.uk> Message-ID: <233dfa1d0803131417v2b551bf2x74508952e8b6fb53@mail.gmail.com> You might also take a look at Lex & Yacc. http://dinosaur.compilertools.net/ On a related note: I was attending one of Martins talks in 2007 and remember him saying that he created LOL-code script on a flight to Barcelona. So, I think there must be some tools that can be used to do it. Check out his LOLcode project and look for clues there. rgds, Miha. On Thu, Mar 13, 2008 at 7:40 PM, Masters, Christopher < christopher.masters at credit-suisse.com> wrote: > Have a look a GOLD > > http://www.devincook.com/goldparser/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From leculver at microsoft.com Thu Mar 13 22:26:28 2008 From: leculver at microsoft.com (Lee Culver) Date: Thu, 13 Mar 2008 14:26:28 -0700 Subject: [IronPython] DLR/ToyScript: Parser generator? In-Reply-To: <233dfa1d0803131417v2b551bf2x74508952e8b6fb53@mail.gmail.com> References: <8C984B4799C04D4B8F80F746537145E11EA49BED@elon12p32001.csfp.co.uk> <233dfa1d0803131417v2b551bf2x74508952e8b6fb53@mail.gmail.com> Message-ID: <6512F99DEFF77C418E6738CE6E12FD4E5DC20856BE@NA-EXMSG-C105.redmond.corp.microsoft.com> I'm actually quite handy with Lex and Yacc, I don't think they'll emit C# will they? -Lee From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Miha Valencic Sent: Thursday, March 13, 2008 2:18 PM To: Discussion of IronPython Subject: Re: [IronPython] DLR/ToyScript: Parser generator? You might also take a look at Lex & Yacc. http://dinosaur.compilertools.net/ On a related note: I was attending one of Martins talks in 2007 and remember him saying that he created LOL-code script on a flight to Barcelona. So, I think there must be some tools that can be used to do it. Check out his LOLcode project and look for clues there. rgds, Miha. On Thu, Mar 13, 2008 at 7:40 PM, Masters, Christopher > wrote: Have a look a GOLD http://www.devincook.com/goldparser/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From simon.dahlbacka at gmail.com Thu Mar 13 22:35:42 2008 From: simon.dahlbacka at gmail.com (Simon Dahlbacka) Date: Thu, 13 Mar 2008 23:35:42 +0200 Subject: [IronPython] DLR/ToyScript: Parser generator? In-Reply-To: <6512F99DEFF77C418E6738CE6E12FD4E5DC20856BE@NA-EXMSG-C105.redmond.corp.microsoft.com> References: <8C984B4799C04D4B8F80F746537145E11EA49BED@elon12p32001.csfp.co.uk> <233dfa1d0803131417v2b551bf2x74508952e8b6fb53@mail.gmail.com> <6512F99DEFF77C418E6738CE6E12FD4E5DC20856BE@NA-EXMSG-C105.redmond.corp.microsoft.com> Message-ID: <57124720803131435p65014f40mb4f279fc77da1002@mail.gmail.com> F# [1] also has some kind of lex and yacc according to [2], I've never used them myself, but being a .NET citizen one would think they should be able to spit out something appropriate? [1] http://research.microsoft.com/fsharp/fsharp.aspx [2]http://research.microsoft.com/fsharp/ergonomics.aspx On Thu, Mar 13, 2008 at 11:26 PM, Lee Culver wrote: > I'm actually quite handy with Lex and Yacc, I don't think they'll emit C# > will they? > > > > -Lee > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Miha Valencic > *Sent:* Thursday, March 13, 2008 2:18 PM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] DLR/ToyScript: Parser generator? > > > > You might also take a look at Lex & Yacc. > http://dinosaur.compilertools.net/ > > On a related note: I was attending one of Martins talks in 2007 and > remember him saying that he created LOL-code script on a flight to > Barcelona. So, I think there must be some tools that can be used to do it. > Check out his LOLcode project and look for clues there. > > rgds, > Miha. > > On Thu, Mar 13, 2008 at 7:40 PM, Masters, Christopher < > christopher.masters at credit-suisse.com> wrote: > > Have a look a GOLD > > > > http://www.devincook.com/goldparser/ > > > > _______________________________________________ > 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 imissfloppydisks at gmail.com Thu Mar 13 22:48:54 2008 From: imissfloppydisks at gmail.com (IMFD) Date: Thu, 13 Mar 2008 14:48:54 -0700 (PDT) Subject: [IronPython] DLR group? Message-ID: <0c216c7b-5481-469e-a954-39a0bd8ae7dc@m34g2000hsc.googlegroups.com> Please excuse me if this is the wrong place to post this. I am very interested in how the DLR itself works. I have not been able to find a great deal about it though. Perhaps I am not looking in the right places. I am trying to find out also if this is something I can learn without going back to school because the only place that is doing this kind of work is Microsoft and my experience with most schools is that they are very anti-Microsoft so I would end up working on UNIX all the time. Not that I have anything against UNIX, I just like to have other options. Anyway (please excuse the tangent) I have purchased used copies of several compiler and programming language texts (Aho, Appel, Scott, Sebesta) off of Amazon as well as books about the CLR (Gough, Box, Richter, Miller) to help me out. That's my background. Being already well-versed in Python and Ruby, I would like to see how things work from the inside now. Any pointers would be greatly appreciated. Thanks! :-) From miha.valencic at gmail.com Thu Mar 13 23:34:52 2008 From: miha.valencic at gmail.com (Miha Valencic) Date: Thu, 13 Mar 2008 23:34:52 +0100 Subject: [IronPython] DLR/ToyScript: Parser generator? In-Reply-To: <6512F99DEFF77C418E6738CE6E12FD4E5DC20856BE@NA-EXMSG-C105.redmond.corp.microsoft.com> References: <8C984B4799C04D4B8F80F746537145E11EA49BED@elon12p32001.csfp.co.uk> <233dfa1d0803131417v2b551bf2x74508952e8b6fb53@mail.gmail.com> <6512F99DEFF77C418E6738CE6E12FD4E5DC20856BE@NA-EXMSG-C105.redmond.corp.microsoft.com> Message-ID: <233dfa1d0803131534g3f149351ga895848d8e50160f@mail.gmail.com> Hmm. You don't really need C#, do you? Anyhow I'm not the expert, but do check the Martins LOLcode script, which I mentioned. http://www.iunknown.com/files/LolCode.zip I mean, if it was done on a plane trip to Barcelna, he probably didn't hand code all the parsing logic, I suppose. rgds, Miha. On Thu, Mar 13, 2008 at 10:26 PM, Lee Culver wrote: > I'm actually quite handy with Lex and Yacc, I don't think they'll emit C# > will they? > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From miha.valencic at gmail.com Thu Mar 13 23:37:30 2008 From: miha.valencic at gmail.com (Miha Valencic) Date: Thu, 13 Mar 2008 23:37:30 +0100 Subject: [IronPython] DLR/ToyScript: Parser generator? In-Reply-To: <233dfa1d0803131534g3f149351ga895848d8e50160f@mail.gmail.com> References: <8C984B4799C04D4B8F80F746537145E11EA49BED@elon12p32001.csfp.co.uk> <233dfa1d0803131417v2b551bf2x74508952e8b6fb53@mail.gmail.com> <6512F99DEFF77C418E6738CE6E12FD4E5DC20856BE@NA-EXMSG-C105.redmond.corp.microsoft.com> <233dfa1d0803131534g3f149351ga895848d8e50160f@mail.gmail.com> Message-ID: <233dfa1d0803131537k7c50b316r445700492a90f2e3@mail.gmail.com> Oh, this probably answers your question completely: http://www.hanselman.com/blog/TheWeeklySourceCode11LOLCodeDLREdition.aspx On Thu, Mar 13, 2008 at 11:34 PM, Miha Valencic wrote: > Hmm. You don't really need C#, do you? Anyhow I'm not the expert, but do > check the Martins LOLcode script, which I mentioned. > http://www.iunknown.com/files/LolCode.zip > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Harry.Pierson at microsoft.com Fri Mar 14 01:07:22 2008 From: Harry.Pierson at microsoft.com (Harry Pierson) Date: Thu, 13 Mar 2008 17:07:22 -0700 Subject: [IronPython] DLR/ToyScript: Parser generator? In-Reply-To: <6512F99DEFF77C418E6738CE6E12FD4E5DC208558B@NA-EXMSG-C105.redmond.corp.microsoft.com> References: <6512F99DEFF77C418E6738CE6E12FD4E5DC208558B@NA-EXMSG-C105.redmond.corp.microsoft.com> Message-ID: There's a .NET version of Lex & Yacc from QUT, GPLex (http://plas.fit.qut.edu.au/gplex/) and GPPG (http://plas.fit.qut.edu.au/gppg/) Microsoft licensed those tools and ship them as part of the VS SDK (announcement: http://blogs.msdn.com/somasegar/archive/2006/10/04/Next-step-in-VS-2005-SDK.aspx, VS SDK download available @ http://msdn2.microsoft.com/en-us/vsx/default.aspx) As was mentioned in other responses on this thread, F# includes a version of lex and yacc (docs: http://research.microsoft.com/fsharp/manual/parsing.aspx) If you like F#, but aren't a fan of Lex and Yacc, I highly recommend FParsec (http://www.quanttec.com/fparsec/) I've been playing with it but haven't had to a chance to write about it yet. Other choices include ANTLR (http://www.antlr.org/), Irony (http://www.codeplex.com/irony) and Coco/R (http://www.ssw.uni-linz.ac.at/Coco/) FYI, I recently wrote a series on my blog about parsing with F#. It doesn't use any of these libraries (I'm not a fan of lax/yacc & I hadn't discovered FParsec). It's just a parser (i.e. it doesn't generate any code) but it is a fairly complex grammar. http://devhawk.net/2007/12/10/Practical+Parsing+In+F.aspx BTW, I'm the newest member of the Dynamic Languages team @ Microsoft (http://devhawk.net/2008/03/11/Joining+The+Dynamic+Languages+Team.aspx) and I'm currently in Chicago for PyCon. I'd love to get a chance to chat w/ anyone else attending from this list about Python and DLR, Harry Pierson http://devhawk.net From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Lee Culver Sent: Thursday, March 13, 2008 11:39 AM To: Discussion of IronPython Subject: [IronPython] DLR/ToyScript: Parser generator? Forgive the wide audience, there's not really a DLR mailing list... I've been reading through Martin Maly's blog and I've enjoyed it, though I've noticed it glossed over one issue...how the ToyScript parser/lexer was created. I've dug through the source of and they look hand written, as does the IronPython parser/lexer. Are all of these hand written or is there some tool you use to write them? Does anyone know of a good parser generator for .Net? I've been wanting to play with the DLR some, but I don't want to pay the up-front price of writing a parser if I can help it. I've seen MPLEX/MPPG, but they seem a bit under-documented. Thanks, -Lee -------------- next part -------------- An HTML attachment was scrubbed... URL: From acevesna at gmail.com Fri Mar 14 01:45:42 2008 From: acevesna at gmail.com (Nick Aceves) Date: Thu, 13 Mar 2008 17:45:42 -0700 Subject: [IronPython] DLR group? In-Reply-To: <0c216c7b-5481-469e-a954-39a0bd8ae7dc@m34g2000hsc.googlegroups.com> References: <0c216c7b-5481-469e-a954-39a0bd8ae7dc@m34g2000hsc.googlegroups.com> Message-ID: Well, the DLR is built on top of the CLR, so you might want to understand the CLR first. There's lots of resources on the net about the CLR. On Thu, Mar 13, 2008 at 2:48 PM, IMFD wrote: > Please excuse me if this is the wrong place to post this. I am very > interested in how the DLR itself works. I have not been able to find > a great deal about it though. Perhaps I am not looking in the right > places. I am trying to find out also if this is something I can learn > without going back to school because the only place that is doing this > kind of work is Microsoft and my experience with most schools is that > they are very anti-Microsoft so I would end up working on UNIX all the > time. Not that I have anything against UNIX, I just like to have > other options. Anyway (please excuse the tangent) I have purchased > used copies of several compiler and programming language texts (Aho, > Appel, Scott, Sebesta) off of Amazon as well as books about the CLR > (Gough, Box, Richter, Miller) to help me out. That's my background. > Being already well-versed in Python and Ruby, I would like to see how > things work from the inside now. Any pointers would be greatly > appreciated. > > 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 desleo at gmail.com Fri Mar 14 08:37:03 2008 From: desleo at gmail.com (Leo Carbajal) Date: Fri, 14 Mar 2008 02:37:03 -0500 Subject: [IronPython] [IronPython 1.1] Scoping Advice(?) Message-ID: Greetings everyone, I've found this list an invaluable resource just by browsing past conversations, however I was hoping to get a little advice and direction with a question that I haven't really seen covered. (lately) I'm trying to integrate IronPython into a live gaming server, which means opening it up to people beyond my immediate circle of retribution should they do something unpleasant. What I'm looking for is some advice as to how to tighten the scope of a module so that only the exposed hooks of my API are available. What I mean to say is, those API hooks are already visible, what bothers me is that I can type a couple of import statements into a script and do things like inspect the file system and manipulate those files, etc. After poking at the source I did something really inelegant, I made it so the parser did not recognize the import keyword, but I can't help but think there has to be a better way (as well as unseen consequences I haven't run into yet). I could inspect every single script being submitted, and I do, however the intent is to release the codebase for others to build their own worlds with. The engine is friendly enough that non-hardcore coders can use it, and the API is self-sufficient, which means that all an admin has to do is learn the basic lexical structure of Python to really take advantage of it. Still, I don't want a situation to arise where someone has a bad day and decides to run a script that deletes all the files in the directory or something. I'm not sure if I'm articulating myself correctly, it's late and I've spent the last hour or so poring over the documentation to see if I could find something. Any advice? --- Leo C. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dfugate at microsoft.com Fri Mar 14 13:48:50 2008 From: dfugate at microsoft.com (Dave Fugate) Date: Fri, 14 Mar 2008 05:48:50 -0700 Subject: [IronPython] IronPython 2.0 Beta 1 In-Reply-To: References: <7346A825E148B049A9AD1D3ED46A2D91259EC8D020@NA-EXMSG-C106.redmond.corp.microsoft.com> <50B69702CA6E6D4E849D30CD4989AB8ED809459F32@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <7346A825E148B049A9AD1D3ED46A2D91259F06E5B4@NA-EXMSG-C106.redmond.corp.microsoft.com> Hello IronPython Community, I'm pleased to announce IronPython 2.0 Beta 1. This particular release contains almost one hundred bug fixes of which the majority were reported on CodePlex (118 votes)! 2.0 Beta 1 includes the following improvements over the Alphas: * PEP 328, absolute and relative imports, has been implemented * PEP 302, new import hooks, has been implemented * Numerous Python dictionary improvements * 'sys' is now a real builtin module * Test projects for IronPython .NET (ClrAssembly) and COM interop (DlrComLibrary) support have been added to the 'Src\Tests' directory within the source zip file * More improvements to the -X:PreferComDispatch flag The following CodePlex Work Items have been closed since IronPython 2.0 Alpha 8: * 946 import clr doesn't give access to the contents of __builtins__ using .NET method names * 1402 try-finally has an issue in generator * 2206 with statement broken in command line * 2443 problem with __slots__ and __init__ in new-style classes * 2648 Error importing module * 2704 __import__ and packages aren't mixing well * 3092 struct.unpack mishandling the "x" format code * 3117 dict.update doesn't take keyword arguments - differs from CPython * 3287 Descriptor/metaclass problems * 4197 Trivial: int('0x20', 16) fails to parse, long too * 4322 unpacking single element tuples in for-statement, listcomp and generator * 4691 AttributeError on __ComObject when using a C++/ATL/MFC COM object which implements a .NET interface * 5083 operator.__contains__ is broken * 5447 socket.getnameinfo(...) broken under Vista * 5566 base64 slash bug * 5609 Trivial: Python25: File lacks __enter__ and __exit__ * 5801 Class with slots and getattr not compatible * 5904 Trivial: Multi-line dictionary/list/tuple expressions in IP interpreter console not compatible w/ CPython Interpreter console * 6006 pyc is mixing up ia64 and x64 * 6265 maxsplit keyword arg of re.split not accepted * 6272 re.compile(...).match(...).endpos has an incorrect value * 6805 Trivial: func_code.co_argcount and func_code.co_flags are wrong * 6991 Trivial: IDictionary.GetEnumerator on IronPython Dict returns the wrong enumerator implementation * 7972 if the argument k in method GetRandBits(k) is not greater than zero, the valueError would be thrown * 8009 the getrandbits method would throw overflow exception in ironpython if the argument k is a int.MaxValue * 8297 range w/ large negative number produces incorrect results * 8361 Trivial: popen shouldn't open new window * 8678 itertools.izip does not work when the arguments are the same iterator * 8780 Removes the inexistent file did not throw OSError in IP * 9070 Python25: Assertions Fail with unittest - requires 2.5 style exceptions * 9349 The array.array format "I" handles large values incorrectly * 9351 int() doesn't convert representable longs to int * 10291 calling base class __call__ invokes constructor instead * 10577 Trivial: Python25: Attempts to set __dict__ of new style classes fails with wrong exception WRT CPython 2.5 * 10642 Non-empty expression list after "yield" keyword gives a SyntaxError * 10643 Can't assign to [] * 10648 Trivial: rpartition method of string objects broken when no separator match is found * 10709 Using lambda in class definition will add into the class's dictionary * 10782 Python25: Stringified representation of exception classes are incorrect * 10983 Reading files in text mode reads chars > 0x7F as '?' * 11362 Tracebacks not generated under 64-bit OSes * 11487 __str__ does not call __repr__ in new style classes * 11576 SystemError: Ambiguous match found. * 11760 Method incorrectly casts to PythonFunction. * 12038 Parser reports weird SyntaxError when trying to use digits for member names * 12493 Error in import * 12647 Implement __coerce__, __float__, __index__, __long__, and __rdivmod__ for bool type * 13617 Trivial: Modules with bad encoding names throw wrong exception * 13618 IRONPYTHONPATH should be split with platform-specific path separator * 13651 importing package with imp module * 13686 Using setattr with modules * 13806 Cannot import Python 2.5 email module * 13860 Complex infinite not allowed by IP * 14454 Event handlers can cause circular references and leak memory * 14456 raw_input blocks until 20 characters are read * 14499 Trivial: sys.version incorrect in IP2.0A7 * 14539 .Visible=True (property) does not work in 2.0 * 14605 Trivial: Enum truth broken * 14636 Trivial: Bug in ScriptDomainManager.GetPublishedModules() * 14833 Remove -X:AssembliesDir flag * 14861 Value types don't work when a function is called twice * 14878 type(sys) does not have a default constructor * 14882 Trivial: Implement float.__lt__(float) * 14982 Trivial: able to derive from System.Double (or not able to derive from System.Single) * 15102 Deriving from "property" breaks default constructor params * 15289 re module never compiles regular expressions We'd like to think everyone in the IronPython Community who reported these: undebtedly, Anthony Baxter, pobrien, Kamil Dworakowski, millind, romank, tarlano, Michael Foord, Evan Klitzke, sanxiyn, jbevain, jackeyoo, Jeff Brown, Oliver Yu, rridge, lthompson, JiaJun Liu, CriGoT, abs, jdhardy, sbergman, sjmachin, Eloff, atifaziz, arman0, Qvin, Vizcayno, Davy Mitchell, CurtHagenlocher, Laurion, luntain, py_sunil, zvikag, David Fraser, Gary Stephenson, and Beaton. Additionally, we've closed the following bugs that were reported internally: * 12% perf degrade on worst case generator scenario with loops * Copying arguments for the ContextAware methods in BuiltinFunction.cs * Performance issues in the Dict implementation * Trivial: overhead in using typed slots with environment * PythonFile.Write flushes on each write * Document difference converting instance without __complex__ or __float__ to complex * IronPython: Cannot step into a method * IronPython: Cannot Localize Windows Forms * formatting with '%o' on object which has __oct__ defined * 6% degrade in the try-raise-except scenario by change#183362 * unicode() can't handle 'unicode-escape' * raw_input is broken * it is different for yield statement between IronPython and CPython . * ImportError: Cannot import name defaultdict * true division(from __future__ import division) throws OverflowError on division by huge number * tuple([0,1,2,3,4])[-100:100:-1] throw OverflowError * a derived tuple which overrode the method __getitem__ gets an error result with the iter() * Trivial: u''.isdecimal() returns 'True' in IronPython but 'False' in CPython * there are different handle for getweakrefs and refequal against IronPython and CPython. lead to different result * istitle() returns False in IronPython with unicode object from u'\u1F88' to u'\u1FFc' * PythonContext.DisplayName is broken * return can't have an expression in generators * expect System.Nullable[()] returning the non-generic type, instead TypeError thrown * Dict slice eval order is incorrect * ctime() returns unicode on non-English machine * Can't call old style classes with non-simple signatures when __init__ is not defined * with doesn't work in interactive mode. * One overload is missing for decode methods in _codecs module. You can download IronPython 2.0 Beta 1 at: http://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=IronPython&ReleaseId=10266 The IronPython Team DLR CHANGES The hosting APIs are nearing completion and will be unlikely to change much in future IronPython 2.0 releases. For anyone interested, you might want to check out "EngineTest.cs" and "test_ipye.py" in the source zip file to get an idea of where the hosting APIs are for Beta 1. It's also worth pointing out that the 'CodeBlock'/'CodeBlockInfo' AST symbols have been renamed to 'LambdaExpression' and 'LambdaInfo' respectively. The APIs around both of these changed significantly since the last release. ToyScript, a small scripting language built on top of the DLR, is merely a DLR sample and not some new scripting language Microsoft has created. Also, ToyScript is not intended to be distributed with IronPython on a permanent basis. -------------- next part -------------- An HTML attachment was scrubbed... URL: From fernandoacorreia at gmail.com Fri Mar 14 14:03:51 2008 From: fernandoacorreia at gmail.com (Fernando Correia) Date: Fri, 14 Mar 2008 10:03:51 -0300 Subject: [IronPython] Testing IronPython hosting Message-ID: <8140eff40803140603j2bb77f5bra872066519d3e522@mail.gmail.com> I've developed a hosting helper class using IronPython and I would like to unit test it using NUnit. Unfortunately, as I described in a previous email, I'm getting exceptions: http://lists.ironpython.com/pipermail/users-ironpython.com/2008-March/006594.html I would like to know if anyone was able to test an IronPython engine hosted in C# using NUnit. Thanks. From billchi at microsoft.com Fri Mar 14 15:40:06 2008 From: billchi at microsoft.com (Bill Chiles) Date: Fri, 14 Mar 2008 07:40:06 -0700 Subject: [IronPython] DLR group? In-Reply-To: <7346A825E148B049A9AD1D3ED46A2D91259F06E5B2@NA-EXMSG-C106.redmond.corp.microsoft.com> References: <7346A825E148B049A9AD1D3ED46A2D91259F06E5B2@NA-EXMSG-C106.redmond.corp.microsoft.com> Message-ID: <2C734460517A154B8E98AC8BA98D49A15A9CB8069C@NA-EXMSG-C105.redmond.corp.microsoft.com> We are embarrassingly light on docs right now. blogs.msdn.com/mmaly has a series of posts going through the ToyScript sample language and explaining mechanism used by language implementers on the DLR. That would help you then to jump into the IPy sources from Codeplex. blogs.msdn.com/Hugunin has some older posts with some overview material of the DLR. http://compilerlab.members.winisp.net/dlr-spec-hosting.doc is the spec for how to host the DLR in your application, and a slightly outdated tour of using the APIs in a mock tool is at http://compilerlab.members.winisp.net/hosting-tour.doc. Cheers, Bill -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of IMFD Sent: Thursday, March 13, 2008 2:49 PM To: users at lists.ironpython.com Subject: [IronPython] DLR group? Please excuse me if this is the wrong place to post this. I am very interested in how the DLR itself works. I have not been able to find a great deal about it though. Perhaps I am not looking in the right places. I am trying to find out also if this is something I can learn without going back to school because the only place that is doing this kind of work is Microsoft and my experience with most schools is that they are very anti-Microsoft so I would end up working on UNIX all the time. Not that I have anything against UNIX, I just like to have other options. Anyway (please excuse the tangent) I have purchased used copies of several compiler and programming language texts (Aho, Appel, Scott, Sebesta) off of Amazon as well as books about the CLR (Gough, Box, Richter, Miller) to help me out. That's my background. Being already well-versed in Python and Ruby, I would like to see how things work from the inside now. Any pointers would be greatly appreciated. Thanks! :-) _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From imissfloppydisks at gmail.com Fri Mar 14 17:40:53 2008 From: imissfloppydisks at gmail.com (IMFD) Date: Fri, 14 Mar 2008 09:40:53 -0700 (PDT) Subject: [IronPython] DLR group? In-Reply-To: <2C734460517A154B8E98AC8BA98D49A15A9CB8069C@NA-EXMSG-C105.redmond.corp.microsoft.com> References: <7346A825E148B049A9AD1D3ED46A2D91259F06E5B2@NA-EXMSG-C106.redmond.corp.microsoft.com> <2C734460517A154B8E98AC8BA98D49A15A9CB8069C@NA-EXMSG-C105.redmond.corp.microsoft.com> Message-ID: <89d48202-2a96-4d60-b34c-47353c9735f3@n58g2000hsf.googlegroups.com> Thanks Nick and Bill. I have been looking into the CLR internals for a while now. I will take a look at the documentation links as well. I assume that any of the classic compiler texts (Aho, Appel) would be sufficient for taking apart the ToyScript language? Or does the DLR have a framework for interpreting built in? I know the VS SDK has tools like MPLEX and the DSL tools for languages. Does the DLR have something similar or is it worth a homegrown implementation? Thanks! :-) On Mar 14, 9:40?am, Bill Chiles wrote: > We are embarrassingly light on docs right now. ?blogs.msdn.com/mmaly has a series of posts going through the ToyScript sample language and explaining mechanism used by language implementers on the DLR. ?That would help you then to jump into the IPy sources from Codeplex. ?blogs.msdn.com/Hugunin has some older posts with some overview material of the DLR. ?http://compilerlab.members.winisp.net/dlr-spec-hosting.docis the spec for how to host the DLR in your application, and a slightly outdated tour of using the APIs in a mock tool is athttp://compilerlab.members.winisp.net/hosting-tour.doc. > > Cheers, > Bill > > -----Original Message----- > From: users-boun... at lists.ironpython.com [mailto:users-boun... at lists.ironpython.com] On Behalf Of IMFD > Sent: Thursday, March 13, 2008 2:49 PM > To: us... at lists.ironpython.com > Subject: [IronPython] DLR group? > > Please excuse me if this is the wrong place to post this. ?I am very > interested in how the DLR itself works. ?I have not been able to find > a great deal about it though. ?Perhaps I am not looking in the right > places. ?I am trying to find out also if this is something I can learn > without going back to school because the only place that is doing this > kind of work is Microsoft and my experience with most schools is that > they are very anti-Microsoft so I would end up working on UNIX all the > time. ?Not that I have anything against UNIX, I just like to have > other options. ?Anyway (please excuse the tangent) I have purchased > used copies of several compiler and programming language texts (Aho, > Appel, Scott, Sebesta) off of Amazon as well as books about the CLR > (Gough, Box, Richter, Miller) to help me out. ?That's my background. > Being already well-versed in Python and Ruby, I would like to see how > things work from the inside now. ?Any pointers would be greatly > appreciated. > > Thanks! :-) > _______________________________________________ > Users mailing list > Us... at lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Us... at lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users-ironpython.com From sanxiyn at gmail.com Sun Mar 16 02:31:33 2008 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Sun, 16 Mar 2008 10:31:33 +0900 Subject: [IronPython] DLR group? In-Reply-To: <89d48202-2a96-4d60-b34c-47353c9735f3@n58g2000hsf.googlegroups.com> References: <7346A825E148B049A9AD1D3ED46A2D91259F06E5B2@NA-EXMSG-C106.redmond.corp.microsoft.com> <2C734460517A154B8E98AC8BA98D49A15A9CB8069C@NA-EXMSG-C105.redmond.corp.microsoft.com> <89d48202-2a96-4d60-b34c-47353c9735f3@n58g2000hsf.googlegroups.com> Message-ID: <5b0248170803151831h4f418813w7c9a6d79ec44c260@mail.gmail.com> 2008/3/15, IMFD : > Thanks Nick and Bill. I have been looking into the CLR internals for > a while now. I will take a look at the documentation links as well. > I assume that any of the classic compiler texts (Aho, Appel) would be > sufficient for taking apart the ToyScript language? Or does the DLR > have a framework for interpreting built in? I know the VS SDK has > tools like MPLEX and the DSL tools for languages. Does the DLR have > something similar or is it worth a homegrown implementation? Classic compiler texts should be sufficient. DLR does not dictate you to use any specific parsing technology. IronPython uses homegrown lexer and parser, for example. -- Seo Sanghyeon From sanxiyn at gmail.com Sun Mar 16 02:57:53 2008 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Sun, 16 Mar 2008 10:57:53 +0900 Subject: [IronPython] [IronPython 1.1] Scoping Advice(?) In-Reply-To: References: Message-ID: <5b0248170803151857j38116fd7ncdbb1c49ce7b1321@mail.gmail.com> 2008/3/14, Leo Carbajal : > What I'm looking for is some advice as to how to tighten the scope of a > module so that only the exposed hooks of my API are available. What I mean > to say is, those API hooks are already visible, what bothers me is that I > can type a couple of import statements into a script and do things like > inspect the file system and manipulate those files, etc. After poking at the > source I did something really inelegant, I made it so the parser did not > recognize the import keyword, but I can't help but think there has to be a > better way (as well as unseen consequences I haven't run into yet). What you are describing is usually called "sandboxing", not "scoping". Searching for "sandboxing Python" should give you some useful results. Unfortunately, there is no simple and complete solution yet, as far as I know. Can you use .NET's application domain to isolate IronPython codes? -- Seo Sanghyeon From Shri.Borde at microsoft.com Mon Mar 17 07:37:45 2008 From: Shri.Borde at microsoft.com (Shri Borde) Date: Sun, 16 Mar 2008 23:37:45 -0700 Subject: [IronPython] DLR resources Message-ID: <50B69702CA6E6D4E849D30CD4989AB8ED80945AC65@DF-GRTDANE-MSG.exchange.corp.microsoft.com> I have started compiling a list of DLR resources in this blog - http://blogs.msdn.com/ironpython/archive/2008/03/16/dlr-resources.aspx. I will try and keep it updated so that folks have one place to start when hunting for DLR information. If you have other links that I should add, send them my way... Thanks, Shri Want to work on IronPython, IronRuby, F#? Visit http://blogs.msdn.com/ironpython -------------- next part -------------- An HTML attachment was scrubbed... URL: From ronnie.maor at gmail.com Mon Mar 17 08:25:13 2008 From: ronnie.maor at gmail.com (Ronnie Maor) Date: Mon, 17 Mar 2008 02:25:13 -0500 Subject: [IronPython] inheriting from "base" generic type Message-ID: <2fd6b9d0803170025q16ed861by98d74d39a61481db@mail.gmail.com> Hi Dino, asked you about this at pycon. posting it here per our discussion to help track it. I understand it's not high on your priority list (and shouldn't be, considering the other stuff there) details: have a python class (simplified here) that is a wrapper over an event: class Future(object): def set(self,val) # set from one thread def get(self) # blocking until set. returns the value set. I exposed the class to C# code through a template interface: interface IFuture void set(T val) T get() the interaction in our case is that C# calls python, which returns a future, which C# then waits on: interface MyPythonSubsystem: IFuture get_an_int() Ideally I'd say that Future implements IFuture for any T, by having Future inherit from IFuture in python. I hoped this would mean IronPython would accept my Future object when I returned it from the python implementation of get_an_int(). Unfortunately, this isn't possible, and I could only inherit from IFuture[T] for some specific T. Ended up writing a simple function at the boundary between the subsystems which gets T as an argument, and constructs an adapter that inherits from IFuture and proxies to an underlying Future object. It works fine for our case, but less than pretty :-( anyway, hope this helps document/track it Ronnie -------------- next part -------------- An HTML attachment was scrubbed... URL: From steve at holdenweb.com Mon Mar 17 09:21:03 2008 From: steve at holdenweb.com (Steve Holden) Date: Mon, 17 Mar 2008 04:21:03 -0400 Subject: [IronPython] [AVG SPAM] inheriting from "base" generic type In-Reply-To: <2fd6b9d0803170025q16ed861by98d74d39a61481db@mail.gmail.com> References: <2fd6b9d0803170025q16ed861by98d74d39a61481db@mail.gmail.com> Message-ID: <47DE29EF.1070909@holdenweb.com> Dino's at PyCon? Shit, this conference is getting too large! If you're still here, Dino (and Ronnie too, come to that) try and find me to say hello. regards Steve Ronnie Maor wrote: > Hi Dino, > > asked you about this at pycon. posting it here per our discussion to > help track it. > I understand it's not high on your priority list (and shouldn't be, > considering the other stuff there) > > details: > > have a python class (simplified here) that is a wrapper over an event: > class Future(object): > def set(self,val) # set from one thread > def get(self) # blocking until set. returns the value set. > > I exposed the class to C# code through a template interface: > interface IFuture > void set(T val) > T get() > > the interaction in our case is that C# calls python, which returns a > future, which C# then waits on: > interface MyPythonSubsystem: > IFuture get_an_int() > > Ideally I'd say that Future implements IFuture for any T, by having > Future inherit from IFuture in python. I hoped this would mean > IronPython would accept my Future object when I returned it from the > python implementation of get_an_int(). > Unfortunately, this isn't possible, and I could only inherit from > IFuture[T] for some specific T. > > Ended up writing a simple function at the boundary between the > subsystems which gets T as an argument, and constructs an adapter that > inherits from IFuture and proxies to an underlying Future object. It > works fine for our case, but less than pretty :-( > > anyway, hope this helps document/track it > Ronnie > > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ From fernandoacorreia at gmail.com Mon Mar 17 13:50:56 2008 From: fernandoacorreia at gmail.com (Fernando Correia) Date: Mon, 17 Mar 2008 09:50:56 -0300 Subject: [IronPython] Unit testing IP hosting -- update Message-ID: <8140eff40803170550j5834bedq60a5d509ea5825fa@mail.gmail.com> I've sent some messages to this list about problems trying to use NUnit to test IronPython hosting with IronPython-2.0A8. Just so you know, with IronPython-2.0B1 that seems to be working, at least with a very basic test. Code follows. Class1.cs ---------- using NUnit.Framework; namespace UnitTest { [TestFixture] public class Class1 { [Test] public void TestHosting() { Host host = new Host(); string x = host.Test(); Assert.AreEqual("Hosting", x); } } } Host.cs ---------- using IronPython; using IronPython.Modules; using Microsoft.Scripting; using Microsoft.Scripting.Hosting; namespace UnitTest { public class Host { public string Test() { ScriptRuntime environment = ScriptRuntime.Create(); ScriptEngine engine = environment.GetEngine("py"); ScriptScope scope = environment.CreateScope(); string scriptText = @" def Test(): return 'Hosting' "; ScriptSource script = engine.CreateScriptSourceFromString(scriptText, SourceCodeKind.Statements); CompiledCode compiledScript = script.Compile(); compiledScript.Execute(scope); string functionCall = "Test()"; ScriptSource function = engine.CreateScriptSourceFromString(functionCall, SourceCodeKind.Expression); return function.Execute(scope).ToString(); } } } From dinov at exchange.microsoft.com Mon Mar 17 17:12:59 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 17 Mar 2008 09:12:59 -0700 Subject: [IronPython] [AVG SPAM] inheriting from "base" generic type In-Reply-To: <47DE29EF.1070909@holdenweb.com> References: <2fd6b9d0803170025q16ed861by98d74d39a61481db@mail.gmail.com> <47DE29EF.1070909@holdenweb.com> Message-ID: <7AD436E4270DD54A94238001769C2227011D80382C03@DF-GRTDANE-MSG.exchange.corp.microsoft.com> I'm guessing you missed Jim's talk otherwise you would have seen my demo :) But anyway I'm still here - I'm down in Kitty Hawk working on making Django's latest and greatest work. I'm here tomorrow too and leave Wednesday morning. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Steve Holden Sent: Monday, March 17, 2008 3:21 AM To: Discussion of IronPython Subject: Re: [IronPython] [AVG SPAM] inheriting from "base" generic type Dino's at PyCon? Shit, this conference is getting too large! If you're still here, Dino (and Ronnie too, come to that) try and find me to say hello. regards Steve Ronnie Maor wrote: > Hi Dino, > > asked you about this at pycon. posting it here per our discussion to > help track it. > I understand it's not high on your priority list (and shouldn't be, > considering the other stuff there) > > details: > > have a python class (simplified here) that is a wrapper over an event: > class Future(object): > def set(self,val) # set from one thread > def get(self) # blocking until set. returns the value set. > > I exposed the class to C# code through a template interface: > interface IFuture > void set(T val) > T get() > > the interaction in our case is that C# calls python, which returns a > future, which C# then waits on: > interface MyPythonSubsystem: > IFuture get_an_int() > > Ideally I'd say that Future implements IFuture for any T, by having > Future inherit from IFuture in python. I hoped this would mean > IronPython would accept my Future object when I returned it from the > python implementation of get_an_int(). > Unfortunately, this isn't possible, and I could only inherit from > IFuture[T] for some specific T. > > Ended up writing a simple function at the boundary between the > subsystems which gets T as an argument, and constructs an adapter that > inherits from IFuture and proxies to an underlying Future object. It > works fine for our case, but less than pretty :-( > > anyway, hope this helps document/track it > Ronnie > > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at exchange.microsoft.com Mon Mar 17 17:16:01 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 17 Mar 2008 09:16:01 -0700 Subject: [IronPython] inheriting from "base" generic type In-Reply-To: <2fd6b9d0803170025q16ed861by98d74d39a61481db@mail.gmail.com> References: <2fd6b9d0803170025q16ed861by98d74d39a61481db@mail.gmail.com> Message-ID: <7AD436E4270DD54A94238001769C2227011D80382C05@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Thanks for following up and sending this to the list. I've opened a bug so we won't lose track of the issue because it doesn't look like we had one already: http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=15674 From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ronnie Maor Sent: Monday, March 17, 2008 2:25 AM To: users at lists.ironpython.com Subject: [IronPython] inheriting from "base" generic type Hi Dino, asked you about this at pycon. posting it here per our discussion to help track it. I understand it's not high on your priority list (and shouldn't be, considering the other stuff there) details: have a python class (simplified here) that is a wrapper over an event: class Future(object): def set(self,val) # set from one thread def get(self) # blocking until set. returns the value set. I exposed the class to C# code through a template interface: interface IFuture void set(T val) T get() the interaction in our case is that C# calls python, which returns a future, which C# then waits on: interface MyPythonSubsystem: IFuture get_an_int() Ideally I'd say that Future implements IFuture for any T, by having Future inherit from IFuture in python. I hoped this would mean IronPython would accept my Future object when I returned it from the python implementation of get_an_int(). Unfortunately, this isn't possible, and I could only inherit from IFuture[T] for some specific T. Ended up writing a simple function at the boundary between the subsystems which gets T as an argument, and constructs an adapter that inherits from IFuture and proxies to an underlying Future object. It works fine for our case, but less than pretty :-( anyway, hope this helps document/track it Ronnie -------------- next part -------------- An HTML attachment was scrubbed... URL: From miha.valencic at gmail.com Mon Mar 17 18:03:56 2008 From: miha.valencic at gmail.com (Miha Valencic) Date: Mon, 17 Mar 2008 18:03:56 +0100 Subject: [IronPython] [AVG SPAM] inheriting from "base" generic type In-Reply-To: <7AD436E4270DD54A94238001769C2227011D80382C03@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <2fd6b9d0803170025q16ed861by98d74d39a61481db@mail.gmail.com> <47DE29EF.1070909@holdenweb.com> <7AD436E4270DD54A94238001769C2227011D80382C03@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <233dfa1d0803171003o14db8f5csd6744a9cb64e7acd@mail.gmail.com> Dino, on a Django subject... :) does it run on IronPython? Thanks, Miha. On Mon, Mar 17, 2008 at 5:12 PM, Dino Viehland wrote: > I'm guessing you missed Jim's talk otherwise you would have seen my demo > :) > > But anyway I'm still here - I'm down in Kitty Hawk working on making > Django's latest and greatest work. I'm here tomorrow too and leave > Wednesday morning. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Mon Mar 17 18:31:47 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 17 Mar 2008 10:31:47 -0700 Subject: [IronPython] [AVG SPAM] inheriting from "base" generic type In-Reply-To: <233dfa1d0803171003o14db8f5csd6744a9cb64e7acd@mail.gmail.com> References: <2fd6b9d0803170025q16ed861by98d74d39a61481db@mail.gmail.com> <47DE29EF.1070909@holdenweb.com> <7AD436E4270DD54A94238001769C2227011D80382C03@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <233dfa1d0803171003o14db8f5csd6744a9cb64e7acd@mail.gmail.com> Message-ID: <7AD436E4270DD54A94238001769C2227011D80382C51@DF-GRTDANE-MSG.exchange.corp.microsoft.com> The short answer is yes, it runs. The long answer is only 0.96.1 will run on IronPython 2.0 Beta 1 but there are some small issues: 1. You need a database provider (check out http://blogs.msdn.com/dinoviehland/archive/2008/03/17/ironpython-ms-sql-and-pep-249.aspx for my quick and dirty version of this). The default DB providers don't run on IronPython because they rely on C extension modules. 2. There's a couple of fixes required to the SQL to run against MS SQL. If you were to run against another DB this wouldn't be an issue. The two tweaks I've made there are removing LIMIT 1 from one SQL call (by calling the backend function to generate limit syntax) and removing microseconds before sending off a DB query (same as MySQL). Note this isn't an incompatibility between IronPython and CPython, just a DB difference. 3. Binary files from the static view don't successfully get downloaded. This is due to a Unicode encoding issue (this is a simple 3 line fix of tracking the content type and only doing the encoding if necessary). This is the only real incompatibility and is due to us not having ASCII strings - only Unicode. This might not be an issue w/ a real web server though. Also once Py3k comes out and both Django and IronPython update to it this issue will go away because the bytes type will be used instead of a string. 4. Along the lines of #3 I've only tried running the development server, there's no integration with a real DB server - this might be trivial to do though, I just haven't tried it yet. I'm looking at the latest and greatest version from SVN now and there's a few issues there. These are mostly known bugs but I'm fixing them as I encounter them: nt.access is missing traceback's don't get created when catching from the same function that throws ?, I'm stuck at the traceback issue right now :) Once I get the latest and greatest running I want to start running through the test suite to see if any other issues are lurking. Unfortunately we need doctest support for that which means we need sys.settrace, so there's some more work to be done. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Miha Valencic Sent: Monday, March 17, 2008 12:04 PM To: Discussion of IronPython Subject: Re: [IronPython] [AVG SPAM] inheriting from "base" generic type Dino, on a Django subject... :) does it run on IronPython? Thanks, Miha. On Mon, Mar 17, 2008 at 5:12 PM, Dino Viehland > wrote: I'm guessing you missed Jim's talk otherwise you would have seen my demo :) But anyway I'm still here - I'm down in Kitty Hawk working on making Django's latest and greatest work. I'm here tomorrow too and leave Wednesday morning. -------------- next part -------------- An HTML attachment was scrubbed... URL: From miha.valencic at gmail.com Mon Mar 17 19:46:56 2008 From: miha.valencic at gmail.com (Miha Valencic) Date: Mon, 17 Mar 2008 19:46:56 +0100 Subject: [IronPython] [AVG SPAM] inheriting from "base" generic type In-Reply-To: <7AD436E4270DD54A94238001769C2227011D80382C51@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <2fd6b9d0803170025q16ed861by98d74d39a61481db@mail.gmail.com> <47DE29EF.1070909@holdenweb.com> <7AD436E4270DD54A94238001769C2227011D80382C03@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <233dfa1d0803171003o14db8f5csd6744a9cb64e7acd@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011D80382C51@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <233dfa1d0803171146h73901e9q18ff1fde6e78644a@mail.gmail.com> Ahh, thanks for the answer. Quite a few issues to address I see. Do you think it would make sense to run it in IIS somehow? (not via fastcgi with CPython, but with IronPython). Is that even doable yet? Since I am no python expert, but I am rather coming from a C background (and nowdays C# :)), the PEP 249 code you've written isn't very clear to me. But, I will stufy it at least and learn that way. Are you also commiting to Django SVN the changes you make. or are you running on your version? Miha On Mon, Mar 17, 2008 at 6:31 PM, Dino Viehland wrote: > The short answer is yes, it runs. The long answer is only 0.96.1 will > run on IronPython 2.0 Beta 1 but there are some small issues: > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Mon Mar 17 21:24:13 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 17 Mar 2008 13:24:13 -0700 Subject: [IronPython] [AVG SPAM] inheriting from "base" generic type In-Reply-To: <233dfa1d0803171146h73901e9q18ff1fde6e78644a@mail.gmail.com> References: <2fd6b9d0803170025q16ed861by98d74d39a61481db@mail.gmail.com> <47DE29EF.1070909@holdenweb.com> <7AD436E4270DD54A94238001769C2227011D80382C03@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <233dfa1d0803171003o14db8f5csd6744a9cb64e7acd@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011D80382C51@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <233dfa1d0803171146h73901e9q18ff1fde6e78644a@mail.gmail.com> Message-ID: <7AD436E4270DD54A94238001769C2227011D80382D0C@DF-GRTDANE-MSG.exchange.corp.microsoft.com> It might be possible to fix the one language compat issue on our side. And at least one of the 2 SQL issues is already fixed in the latest version of Django. So I'm hoping we can get compatible w/o needing to change Django. But currently I have the tweaks on my own version :(. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Miha Valencic Sent: Monday, March 17, 2008 1:47 PM To: Discussion of IronPython Subject: Re: [IronPython] [AVG SPAM] inheriting from "base" generic type Ahh, thanks for the answer. Quite a few issues to address I see. Do you think it would make sense to run it in IIS somehow? (not via fastcgi with CPython, but with IronPython). Is that even doable yet? Since I am no python expert, but I am rather coming from a C background (and nowdays C# :)), the PEP 249 code you've written isn't very clear to me. But, I will stufy it at least and learn that way. Are you also commiting to Django SVN the changes you make. or are you running on your version? Miha On Mon, Mar 17, 2008 at 6:31 PM, Dino Viehland > wrote: The short answer is yes, it runs. The long answer is only 0.96.1 will run on IronPython 2.0 Beta 1 but there are some small issues: -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdhardy at gmail.com Tue Mar 18 01:16:55 2008 From: jdhardy at gmail.com (Jeff Hardy) Date: Mon, 17 Mar 2008 18:16:55 -0600 Subject: [IronPython] 2.0B1 Hosting: Creating Python Types Message-ID: Hi, I'm trying to figure out how to create an instance of a Python type (i.e. tuple and file) using the hosting interface (from C#). In older versions there was PythonTuple.MakeTuple, for example, but that seems to have disappeared. Now PythonTuple and PythonFile both require a CodeContext, which I'm pretty sure is internal. Is there a nice, easy way in 2.0B1 to create a tuple and convert a Stream to a file-like object? Thanks, Jeff From dinov at exchange.microsoft.com Tue Mar 18 01:26:46 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 17 Mar 2008 17:26:46 -0700 Subject: [IronPython] 2.0B1 Hosting: Creating Python Types In-Reply-To: References: Message-ID: <7AD436E4270DD54A94238001769C2227011D80382E03@DF-GRTDANE-MSG.exchange.corp.microsoft.com> MakeTuple has been moved into PythonOps as PythonOps.MakeTuple. The reason for that change is that we now want the public surface area of the .NET Python types to match the public surface area Python types. File is more of a problem... Unfortunately files do need to be bound to a context (for multi-runtime support). If there's enough demand for it we could provide a PythonEngine class which is compatible w/ 1.x and we could expose the file creation via that. Until then probably the only way to do it right now is to call __builtin__.file through Python code (to which you can pass in a stream). The ObjectOperations class should make that fairly easy (you can convert file to a delegate and then call it). CodeContext isn't actually internal but it's also not available to you via the hosting APIs. Basically the DLR APIs are split into hosting APIs and language APIs. The hosting APIs provide a pretty interface as well as a remoting model and the language APIs provide a ton of functionality specific to language implementers. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jeff Hardy Sent: Monday, March 17, 2008 7:17 PM To: Discussion of IronPython Subject: [IronPython] 2.0B1 Hosting: Creating Python Types Hi, I'm trying to figure out how to create an instance of a Python type (i.e. tuple and file) using the hosting interface (from C#). In older versions there was PythonTuple.MakeTuple, for example, but that seems to have disappeared. Now PythonTuple and PythonFile both require a CodeContext, which I'm pretty sure is internal. Is there a nice, easy way in 2.0B1 to create a tuple and convert a Stream to a file-like object? Thanks, Jeff _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From kevin at kubasik.net Tue Mar 18 06:39:27 2008 From: kevin at kubasik.net (Kevin Kubasik) Date: Mon, 17 Mar 2008 23:39:27 -0600 Subject: [IronPython] IronPython Console Sample at Pycon Message-ID: <78b1a24a0803172239g6a0d3ceby7a0486e7222ec105@mail.gmail.com> I know that the dynamic console we saw during the presentation is available on the dynamicsilverlight.net, I was having some trouble finding it. Any chance someone has a direct link? -- Kevin Kubasik http://kubasik.net/blog From Jimmy.Schementi at microsoft.com Tue Mar 18 06:46:08 2008 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Mon, 17 Mar 2008 22:46:08 -0700 Subject: [IronPython] IronPython Console Sample at Pycon In-Reply-To: <78b1a24a0803172239g6a0d3ceby7a0486e7222ec105@mail.gmail.com> Message-ID: http://dynamicsilverlight.net/see/dlrconsole On 3/17/08 10:39 PM, "Kevin Kubasik" wrote: I know that the dynamic console we saw during the presentation is available on the dynamicsilverlight.net, I was having some trouble finding it. Any chance someone has a direct link? -- Kevin Kubasik http://kubasik.net/blog _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdhardy at gmail.com Tue Mar 18 14:45:59 2008 From: jdhardy at gmail.com (Jeff Hardy) Date: Tue, 18 Mar 2008 07:45:59 -0600 Subject: [IronPython] 2.0B1 Hosting: Creating Python Types In-Reply-To: <7AD436E4270DD54A94238001769C2227011D80382E03@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <7AD436E4270DD54A94238001769C2227011D80382E03@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: Hi Dino, On Mon, Mar 17, 2008 at 6:26 PM, Dino Viehland wrote: > MakeTuple has been moved into PythonOps as PythonOps.MakeTuple. The reason for that change is that we now want the public surface area of the .NET Python types to match the public surface area Python types. Sounds good. > > File is more of a problem... Unfortunately files do need to be bound to a context (for multi-runtime support). If there's enough demand for it we could provide a PythonEngine class which is compatible w/ 1.x and we could expose the file creation via that. Until then probably the only way to do it right now is to call __builtin__.file through Python code (to which you can pass in a stream). The ObjectOperations class should make that fairly easy (you can convert file to a delegate and then call it). That's actually what I thought when I was trying to sleep last night :). It's certainly acceptable, and I'm not sure using Streams as files will be all that common anyway, but it seems that it could hang off of ScriptEngine (i.e. engine.MakeFile(Stream)). However, I don't know how applicable that we be to other languages (it's been a while since I used Ruby). If you can think of a place to put it, great; if not, I won't lose any (more) sleep over it. Aside: I like the new ObjectOperations class. It makes a lot of the stuff I have to do for NWSGI much easier. All of the new hosting APIs are very nice to work with. Thanks for your help, Dino. -Jeff > > > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jeff Hardy > Sent: Monday, March 17, 2008 7:17 PM > To: Discussion of IronPython > Subject: [IronPython] 2.0B1 Hosting: Creating Python Types > > Hi, > I'm trying to figure out how to create an instance of a Python type > (i.e. tuple and file) using the hosting interface (from C#). In older > versions there was PythonTuple.MakeTuple, for example, but that seems > to have disappeared. Now PythonTuple and PythonFile both require a > CodeContext, which I'm pretty sure is internal. > > Is there a nice, easy way in 2.0B1 to create a tuple and convert a > Stream to a file-like object? > > Thanks, > 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 ivan at flanders.co.nz Tue Mar 18 22:35:28 2008 From: ivan at flanders.co.nz (Ivan Porto Carrero) Date: Wed, 19 Mar 2008 10:35:28 +1300 Subject: [IronPython] ScriptRuntime.Globals Message-ID: Hi, I'm working my way through the DLR hosting spec. And in the spec docs there is a distinction between 3 levels of hosting. Now in the case of IronRuby I tried hosting it with level one hosting and all I can get to work is executing ruby files. Whatever i put in ScriptRuntime.Globals doesn't matter because it looks like I can't get to it. What is the function of ScriptRuntime.Globals ? How do I access it? Why do ScriptScopes exist ? I saw that ScriptRuntime.Globals is a ScriptScope, so I guess that's the default script scope. From what I understand from the DLR spec is that it should give you a context for running a script with it's own variables etc. but globals are shared by the entire runtime. Is there somebody that can explain me what I'm not getting? Cheers Ivan -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Tue Mar 18 22:43:24 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Tue, 18 Mar 2008 14:43:24 -0700 Subject: [IronPython] ScriptRuntime.Globals In-Reply-To: References: Message-ID: <7AD436E4270DD54A94238001769C2227011D80383004@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Globals is a place for hosts to put stuff that will be exposed in some language specific way. I believe in Ruby the plan is to expose this as members that live in object. In IronPython it gets exposed via import. So if you put something into globals you should be able to do: import foo and get it back out. The other ScriptScope?s that you can pass in get exposed in IronPython as module-level variables so they should be accessible to code by just referring to them directly. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ivan Porto Carrero Sent: Tuesday, March 18, 2008 4:35 PM To: users at lists.ironpython.com Subject: [IronPython] ScriptRuntime.Globals Hi, I'm working my way through the DLR hosting spec. And in the spec docs there is a distinction between 3 levels of hosting. Now in the case of IronRuby I tried hosting it with level one hosting and all I can get to work is executing ruby files. Whatever i put in ScriptRuntime.Globals doesn't matter because it looks like I can't get to it. What is the function of ScriptRuntime.Globals ? How do I access it? Why do ScriptScopes exist ? I saw that ScriptRuntime.Globals is a ScriptScope, so I guess that's the default script scope. From what I understand from the DLR spec is that it should give you a context for running a script with it's own variables etc. but globals are shared by the entire runtime. Is there somebody that can explain me what I'm not getting? Cheers Ivan -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdhardy at gmail.com Wed Mar 19 01:07:43 2008 From: jdhardy at gmail.com (Jeff Hardy) Date: Tue, 18 Mar 2008 18:07:43 -0600 Subject: [IronPython] 2.0B1: sys.executable in hosting scenarios Message-ID: Hi, I'm trying to figure out how to set sys.executable when hosting IronPython. As best I can tell, I need to call PythonContext.SetHostVariables, but I can't figure out how to get an appropriate PythonContext. This causes sys.executable to be None, which messes up pydoc (specifically os.path.dirname(sys.executable)). Does this involve delving deeper into the hosting APIs, or is this a Level 2 scenario? -Jeff From jdhardy at gmail.com Wed Mar 19 01:29:02 2008 From: jdhardy at gmail.com (Jeff Hardy) Date: Tue, 18 Mar 2008 18:29:02 -0600 Subject: [IronPython] 2.0B1 Hosting: Creating Python Types In-Reply-To: <7AD436E4270DD54A94238001769C2227011D80382E03@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <7AD436E4270DD54A94238001769C2227011D80382E03@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: Hi Dino, > Until then probably the only way to do it right now is to call __builtin__.file through Python code (to which you can pass in a stream). The ObjectOperations class should make that fairly easy (you can convert file to a delegate and then call it). I get the gist of this, but I can't figure out how to get a reference to __builtins__.file to call. What's the easiest way to get one? Thanks, Jeff From jdhardy at gmail.com Wed Mar 19 01:38:51 2008 From: jdhardy at gmail.com (Jeff Hardy) Date: Tue, 18 Mar 2008 18:38:51 -0600 Subject: [IronPython] Hosting: Re-raising excpetions Message-ID: Hi, One part of the WSGI spec calls for sys.exc_info to be passed to a function, and if certain conditions are met, that exception is to be re-raised. The example given in PEP 333 is: raise exc_info[0],exc_info[1],exc_info[2] Previously I used PythonOps.MakeException for this but as of 2.0B1 that requires a code context. Is there another way to do this? I could create some Python code dynamically and execute it, but I'd prefer not too. Thanks, Jeff From tim.leonard at qlogic.com Wed Mar 19 03:39:53 2008 From: tim.leonard at qlogic.com (Tim Leonard) Date: Tue, 18 Mar 2008 19:39:53 -0700 Subject: [IronPython] IronPython Console Sample at Pycon In-Reply-To: References: <78b1a24a0803172239g6a0d3ceby7a0486e7222ec105@mail.gmail.com> Message-ID: <8611AA752F3DD647946D5C246B2E941710C16F@AVEXCH1.qlogic.org> This link starts it in my browser, but I want to play with the version that can be hosted locally (per the article in MSDN a few months back). Can someone provide a link to the latest version DLR code as well as to the other apps like the clock? Tim Leonard http://tim.leonard at qlogic.com ________________________________ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jimmy Schementi Sent: Monday, March 17, 2008 10:46 PM To: Discussion of IronPython Subject: Re: [IronPython] IronPython Console Sample at Pycon http://dynamicsilverlight.net/see/dlrconsole On 3/17/08 10:39 PM, "Kevin Kubasik" wrote: I know that the dynamic console we saw during the presentation is available on the dynamicsilverlight.net, I was having some trouble finding it. Any chance someone has a direct link? -- Kevin Kubasik http://kubasik.net/blog _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Wed Mar 19 04:49:28 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Tue, 18 Mar 2008 20:49:28 -0700 Subject: [IronPython] 2.0B1 Hosting: Creating Python Types In-Reply-To: References: <7AD436E4270DD54A94238001769C2227011D80382E03@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <7AD436E4270DD54A94238001769C2227011D8038310C@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Evaling __builtins__ should work (or import __builtin__ and then eval that). -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jeff Hardy Sent: Tuesday, March 18, 2008 7:29 PM To: Discussion of IronPython Subject: Re: [IronPython] 2.0B1 Hosting: Creating Python Types Hi Dino, > Until then probably the only way to do it right now is to call __builtin__.file through Python code (to which you can pass in a stream). The ObjectOperations class should make that fairly easy (you can convert file to a delegate and then call it). I get the gist of this, but I can't figure out how to get a reference to __builtins__.file to call. What's the easiest way to get one? Thanks, Jeff _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From steve at holdenweb.com Wed Mar 19 19:34:19 2008 From: steve at holdenweb.com (Steve Holden) Date: Wed, 19 Mar 2008 14:34:19 -0400 Subject: [IronPython] [AVG SPAM] inheriting from "base" generic type In-Reply-To: <233dfa1d0803171146h73901e9q18ff1fde6e78644a@mail.gmail.com> References: <2fd6b9d0803170025q16ed861by98d74d39a61481db@mail.gmail.com> <47DE29EF.1070909@holdenweb.com> <7AD436E4270DD54A94238001769C2227011D80382C03@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <233dfa1d0803171003o14db8f5csd6744a9cb64e7acd@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011D80382C51@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <233dfa1d0803171146h73901e9q18ff1fde6e78644a@mail.gmail.com> Message-ID: <47E15CAB.4010909@holdenweb.com> Miha: I understand that WSGI is available over IIS, so that would be one way to run Django. I'm too much of a noob in that environment to say whether it's been done yet, and if so by whom. regards Steve Miha Valencic wrote: > Ahh, thanks for the answer. Quite a few issues to address I see. Do you > think it would make sense to run it in IIS somehow? (not via fastcgi > with CPython, but with IronPython). Is that even doable yet? > > Since I am no python expert, but I am rather coming from a C background > (and nowdays C# :)), the PEP 249 code you've written isn't very clear to > me. But, I will stufy it at least and learn that way. > > Are you also commiting to Django SVN the changes you make. or are you > running on your version? > > Miha > > On Mon, Mar 17, 2008 at 6:31 PM, Dino Viehland > > wrote: > > The short answer is yes, it runs. The long answer is only 0.96.1 > will run on IronPython 2.0 Beta 1 but there are some small issues: > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From jdhardy at gmail.com Wed Mar 19 19:53:59 2008 From: jdhardy at gmail.com (Jeff Hardy) Date: Wed, 19 Mar 2008 12:53:59 -0600 Subject: [IronPython] 2.0B1 Hosting: Creating Python Types In-Reply-To: <7AD436E4270DD54A94238001769C2227011D8038310C@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <7AD436E4270DD54A94238001769C2227011D80382E03@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <7AD436E4270DD54A94238001769C2227011D8038310C@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: On Tue, Mar 18, 2008 at 9:49 PM, Dino Viehland wrote: > Evaling __builtins__ should work (or import __builtin__ and then eval that). Evaluate, not Execute :). Thanks, Dino. The code, for anyone else who's interested, is: private static object MakePythonFile(ScriptEngine engine, System.IO.Stream stream) { return engine.Operations.Call( engine.CreateScriptSourceFromString("__builtins__['file']") .Compile().Evaluate(engine.CreateScope()), stream); } From jdhardy at gmail.com Wed Mar 19 19:57:01 2008 From: jdhardy at gmail.com (Jeff Hardy) Date: Wed, 19 Mar 2008 12:57:01 -0600 Subject: [IronPython] [AVG SPAM] inheriting from "base" generic type In-Reply-To: <47E15CAB.4010909@holdenweb.com> References: <2fd6b9d0803170025q16ed861by98d74d39a61481db@mail.gmail.com> <47DE29EF.1070909@holdenweb.com> <7AD436E4270DD54A94238001769C2227011D80382C03@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <233dfa1d0803171003o14db8f5csd6744a9cb64e7acd@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011D80382C51@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <233dfa1d0803171146h73901e9q18ff1fde6e78644a@mail.gmail.com> <47E15CAB.4010909@holdenweb.com> Message-ID: Shameless plug: NWSGI (http://codeplex.com/NWSGI) will use IronPython to run WSGI apps on IIS. It still needs a bit of work (and I'm still in the process of updating it for B1) and a lot of documentation, but it works for some simple cases. If Dino can get Django working on IronPython, I'd be very interested in trying it with NWSGI to really stess it. -Jeff On Wed, Mar 19, 2008 at 12:34 PM, Steve Holden wrote: > Miha: > > I understand that WSGI is available over IIS, so that would be one way > to run Django. I'm too much of a noob in that environment to say whether > it's been done yet, and if so by whom. > > regards > Steve > > Miha Valencic wrote: > > Ahh, thanks for the answer. Quite a few issues to address I see. Do you > > think it would make sense to run it in IIS somehow? (not via fastcgi > > with CPython, but with IronPython). Is that even doable yet? > > > > Since I am no python expert, but I am rather coming from a C background > > (and nowdays C# :)), the PEP 249 code you've written isn't very clear to > > me. But, I will stufy it at least and learn that way. > > > > Are you also commiting to Django SVN the changes you make. or are you > > running on your version? > > > > Miha > > > > On Mon, Mar 17, 2008 at 6:31 PM, Dino Viehland > > > wrote: > > > > The short answer is yes, it runs. The long answer is only 0.96.1 > > will run on IronPython 2.0 Beta 1 but there are some small issues: > > > > > > > > ------------------------------------------------------------------------ > > > > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From curt at hagenlocher.org Wed Mar 19 20:14:58 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Wed, 19 Mar 2008 12:14:58 -0700 Subject: [IronPython] 2.0B1 Hosting: Creating Python Types In-Reply-To: <7AD436E4270DD54A94238001769C2227011D80382E03@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <7AD436E4270DD54A94238001769C2227011D80382E03@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: On Mon, Mar 17, 2008 at 5:26 PM, Dino Viehland wrote: > > CodeContext isn't actually internal but it's also not available to you via the > hosting APIs. Does this mean that we shouldn't be creating CodeContexts? I'm using the class "IronPython.Runtime.Operations.PythonTypeOps+TypeCaller" to construct new objects from Python types. This process requires a CodeContext, which I'm currently building from scratch as needed. (The same approach could be used with the PythonType "IronPython.Runtime.Builtin.file" in order to build a Python file object a little more efficiently.) -- Curt Hagenlocher curt at hagenlocher.org From tkapoor at wscm.net Wed Mar 19 20:34:49 2008 From: tkapoor at wscm.net (Tarun Kapoor) Date: Wed, 19 Mar 2008 14:34:49 -0500 Subject: [IronPython] 2.0B1 Hosting: Creating Python Types In-Reply-To: References: <7AD436E4270DD54A94238001769C2227011D80382E03@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: Curt - at pycon, I heard that you are working on a CLR wrapper project. Under which python code will be have automatically generated wrappers and that way they can called in C# more easily... Can you pls provide some details on how the project is going ? ->>Sorry this is not related to the thread. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher Sent: Wednesday, March 19, 2008 2:15 PM To: Discussion of IronPython Subject: Re: [IronPython] 2.0B1 Hosting: Creating Python Types On Mon, Mar 17, 2008 at 5:26 PM, Dino Viehland wrote: > > CodeContext isn't actually internal but it's also not available to you via the > hosting APIs. Does this mean that we shouldn't be creating CodeContexts? I'm using the class "IronPython.Runtime.Operations.PythonTypeOps+TypeCaller" to construct new objects from Python types. This process requires a CodeContext, which I'm currently building from scratch as needed. (The same approach could be used with the PythonType "IronPython.Runtime.Builtin.file" in order to build a Python file object a little more efficiently.) -- Curt Hagenlocher curt at hagenlocher.org _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com Disclaimer This e-mail and any attachments is confidential and intended solely for the use of the individual(s) to whom it is addressed. Any views or opinions presented are solely those of the author and do not necessarily represent those of Waterstone Capital Management, L.P and affiliates. If you are not the intended recipient, be advised that you have received this e-mail in error and that any use, dissemination, printing, forwarding or copying of this email is strictly prohibited. Please contact the sender if you have received this e-mail in error. You should also be aware that e-mails are susceptible to interference and you should not assume that the contents of this e-mail originated from the sender above or that they have been accurately reproduced in their original form. Waterstone Capital Management, L.P. and affiliates accepts no responsibility for information, or errors or omissions in this e-mail or use or misuse thereof. If in doubt, please verify the authenticity with the sender. From curt at hagenlocher.org Wed Mar 19 20:54:53 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Wed, 19 Mar 2008 12:54:53 -0700 Subject: [IronPython] 2.0B1 Hosting: Creating Python Types In-Reply-To: References: <7AD436E4270DD54A94238001769C2227011D80382E03@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: On Wed, Mar 19, 2008 at 12:34 PM, Tarun Kapoor wrote: > Curt - at pycon, I heard that you are working on a CLR wrapper project. > Under which python code will be have automatically generated wrappers > and that way they can called in C# more easily... > Can you pls provide some details on how the project is going ? I've just gotten back from vacation and will resume work on the project once I recover from the twin devils of "jet lag" and "the backlog". I can't make any specific promises about progress right now, but I'm definitely committed to making some :). -- Curt Hagenlocher curt at hagenlocher.org From tkapoor at wscm.net Wed Mar 19 21:11:55 2008 From: tkapoor at wscm.net (Tarun Kapoor) Date: Wed, 19 Mar 2008 15:11:55 -0500 Subject: [IronPython] 2.0B1 Hosting: Creating Python Types In-Reply-To: References: <7AD436E4270DD54A94238001769C2227011D80382E03@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: If you need any help let me know. I am up for it. It is personally going to help me a lot, so I have vested interests in the project :) Is there a project webpage by the way, where I can read etc? -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher Sent: Wednesday, March 19, 2008 2:55 PM To: Discussion of IronPython Subject: Re: [IronPython] 2.0B1 Hosting: Creating Python Types On Wed, Mar 19, 2008 at 12:34 PM, Tarun Kapoor wrote: > Curt - at pycon, I heard that you are working on a CLR wrapper project. > Under which python code will be have automatically generated wrappers > and that way they can called in C# more easily... > Can you pls provide some details on how the project is going ? I've just gotten back from vacation and will resume work on the project once I recover from the twin devils of "jet lag" and "the backlog". I can't make any specific promises about progress right now, but I'm definitely committed to making some :). -- Curt Hagenlocher curt at hagenlocher.org _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com Disclaimer This e-mail and any attachments is confidential and intended solely for the use of the individual(s) to whom it is addressed. Any views or opinions presented are solely those of the author and do not necessarily represent those of Waterstone Capital Management, L.P and affiliates. If you are not the intended recipient, be advised that you have received this e-mail in error and that any use, dissemination, printing, forwarding or copying of this email is strictly prohibited. Please contact the sender if you have received this e-mail in error. You should also be aware that e-mails are susceptible to interference and you should not assume that the contents of this e-mail originated from the sender above or that they have been accurately reproduced in their original form. Waterstone Capital Management, L.P. and affiliates accepts no responsibility for information, or errors or omissions in this e-mail or use or misuse thereof. If in doubt, please verify the authenticity with the sender. From curt at hagenlocher.org Wed Mar 19 21:14:43 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Wed, 19 Mar 2008 13:14:43 -0700 Subject: [IronPython] 2.0B1 Hosting: Creating Python Types In-Reply-To: References: <7AD436E4270DD54A94238001769C2227011D80382E03@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: On Wed, Mar 19, 2008 at 1:11 PM, Tarun Kapoor wrote: > If you need any help let me know. I am up for it. > It is personally going to help me a lot, so I have vested interests in > the project :) > Is there a project webpage by the way, where I can read etc? It's on CodePlex at http://www.codeplex.com/coils. Feel free to provide feedback or sign up :). The existing code works against 2.0A8; it will updated for 2.0B1 by the end of the week. -- Curt Hagenlocher curt at hagenlocher.org From dinov at exchange.microsoft.com Thu Mar 20 00:40:13 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Wed, 19 Mar 2008 16:40:13 -0700 Subject: [IronPython] 2.0B1 Hosting: Creating Python Types In-Reply-To: References: <7AD436E4270DD54A94238001769C2227011D80382E03@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <7AD436E4270DD54A94238001769C2227011D811279E7@DF-GRTDANE-MSG.exchange.corp.microsoft.com> In general you shouldn't need access to CodeContext for doing anything - unless you're writing an API which will be consumed by script code. And the hosting APIs don't expose CodeContext instances so it can be challenging to get one without jumping through hoops. Obviously there's a bunch of things people want to do that are Python specific and aren't covered by the DLR hosting APIs. It'd be interesting to collect all of those things so that we can make sure we get all of the features that people want. So far I think the interesting ones would include: file exception info module access (built-ins at least and possibly Python modules) type caller (which will actually going away, so no big deal there, but might be worth a discussion) There's also some cleanup here for example creating ScriptScope's from the DLR doesn't give you a very usable Python module but we'll be fixing that. Are there other things that jump out at people as missing? Also, is there much interest in a 1.1 compatible hosting API or should we just expose this additional functionality? -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher Sent: Wednesday, March 19, 2008 12:15 PM To: Discussion of IronPython Subject: Re: [IronPython] 2.0B1 Hosting: Creating Python Types On Mon, Mar 17, 2008 at 5:26 PM, Dino Viehland wrote: > > CodeContext isn't actually internal but it's also not available to you via the > hosting APIs. Does this mean that we shouldn't be creating CodeContexts? I'm using the class "IronPython.Runtime.Operations.PythonTypeOps+TypeCaller" to construct new objects from Python types. This process requires a CodeContext, which I'm currently building from scratch as needed. (The same approach could be used with the PythonType "IronPython.Runtime.Builtin.file" in order to build a Python file object a little more efficiently.) -- Curt Hagenlocher curt at hagenlocher.org _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From jdhardy at gmail.com Thu Mar 20 01:51:09 2008 From: jdhardy at gmail.com (Jeff Hardy) Date: Wed, 19 Mar 2008 18:51:09 -0600 Subject: [IronPython] NWSGI 0.1 released! Message-ID: Hi all, I've finally built a binary version of NWSGI, which is much easier to use than building it from source. It also includes a very simple "Hello, World!" app to get started. I've tested with some simple Paste applications, and CherryPy *almost* works; if you hack around the bugs that it exposes, you'll get a nice 503 error page. With news that Django works, I'll give that a spin when all of the bits are available. Right now, it works best with IIS7 - deployment is dead simple. Stories about IIS6 would be appreciated, as I don't have access to it. Any and all comments are very much appreciated. - Jeff Hardy From jdhardy at gmail.com Thu Mar 20 01:54:35 2008 From: jdhardy at gmail.com (Jeff Hardy) Date: Wed, 19 Mar 2008 18:54:35 -0600 Subject: [IronPython] subprocess module Message-ID: Hi all, Attached is a partial .NET implementation of the subprocess module. There are currently a few limitations: * Popen.communicate doesn't work * Can't redirect stdin except for PIPE * Can't redirect stderr to stdout (i.e. using stderr=subprocess.STDOUT) * Can't redirect to a file descriptor * univeral_newlines is not supported * Command strings are flaky (lists work much better). Use shell=True if using command strings. Except for what's listed above, it passes most (about 2/3) of the subprocess test cases. The code is under the Ms-PL, except for list2cmdline which is under the PSF license. I believe this is the correct way to do it (but correct me if I'm wrong!). Seo, what needs to be done to add this FePy? - Jeff Hardy -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: subprocess.py URL: From fuzzyman at voidspace.org.uk Thu Mar 20 07:43:26 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Thu, 20 Mar 2008 06:43:26 +0000 Subject: [IronPython] Silverlight - animation from code Message-ID: <47E2078E.8070301@voidspace.org.uk> Any idea why the following code does nothing? (root is the application root visual - the textblock becomes visible and 'starting' is printed at the right time - but the fint size doesn't change as I would expect from the Silverlight docs.) from System import TimeSpan from System.Windows import Duration from System.Windows.Controls import TextBlock from System.Windows.Media.Animation import ( DoubleAnimation, Storyboard ) root.Children.Clear() root.Resources.Clear() t = TextBlock() t.FontSize = 20 t.Text = 'Something Blue' root.Children.Add(t) sb = Storyboard() duration = Duration(TimeSpan.FromSeconds(2)) a = DoubleAnimation() a.Duration = duration sb.Duration = duration sb.Children.Add(a) Storyboard.SetTarget(a, t) Storyboard.SetTargetProperty(a, 'FontSize') a.From = 20 a.To = 40 def anim(s, e): print 'Starting' sb.Begin() t.MouseEnter += anim root.Resources.Add(sb) From srivatsn at microsoft.com Thu Mar 20 08:17:54 2008 From: srivatsn at microsoft.com (Srivatsn Narayanan) Date: Thu, 20 Mar 2008 00:17:54 -0700 Subject: [IronPython] Silverlight - animation from code In-Reply-To: <47E2078E.8070301@voidspace.org.uk> References: <47E2078E.8070301@voidspace.org.uk> Message-ID: <3FA51E96F92363468CF062D992DC84681F89A9CCAE@NA-EXMSG-C106.redmond.corp.microsoft.com> It worked for me. The text became bigger onmouseover. I did a root=Application.Current.LoadRootVisual(Canvas(), "app.xaml") with the xaml having nothing but a Canvas -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Wednesday, March 19, 2008 11:43 PM To: Discussion of IronPython Subject: [IronPython] Silverlight - animation from code Any idea why the following code does nothing? (root is the application root visual - the textblock becomes visible and 'starting' is printed at the right time - but the fint size doesn't change as I would expect from the Silverlight docs.) from System import TimeSpan from System.Windows import Duration from System.Windows.Controls import TextBlock from System.Windows.Media.Animation import ( DoubleAnimation, Storyboard ) root.Children.Clear() root.Resources.Clear() t = TextBlock() t.FontSize = 20 t.Text = 'Something Blue' root.Children.Add(t) sb = Storyboard() duration = Duration(TimeSpan.FromSeconds(2)) a = DoubleAnimation() a.Duration = duration sb.Duration = duration sb.Children.Add(a) Storyboard.SetTarget(a, t) Storyboard.SetTargetProperty(a, 'FontSize') a.From = 20 a.To = 40 def anim(s, e): print 'Starting' sb.Begin() t.MouseEnter += anim root.Resources.Add(sb) _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From sh at defuze.org Thu Mar 20 08:19:35 2008 From: sh at defuze.org (Sylvain Hellegouarch) Date: Thu, 20 Mar 2008 08:19:35 +0100 Subject: [IronPython] NWSGI 0.1 released! In-Reply-To: References: Message-ID: <47E21007.7080205@defuze.org> That's great news. Congratulations :) - Sylvain Jeff Hardy a ?crit : > Hi all, > I've finally built a binary version of NWSGI, which is much easier to > use than building it from source. It also includes a very simple > "Hello, World!" app to get started. > > I've tested with some simple Paste applications, and CherryPy *almost* > works; if you hack around the bugs that it exposes, you'll get a nice > 503 error page. With news that Django works, I'll give that a spin > when all of the bits are available. > > Right now, it works best with IIS7 - deployment is dead simple. > Stories about IIS6 would be appreciated, as I don't have access to it. > > Any and all comments are very much appreciated. > > - Jeff Hardy > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From fuzzyman at voidspace.org.uk Thu Mar 20 08:30:55 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Thu, 20 Mar 2008 07:30:55 +0000 Subject: [IronPython] Silverlight - animation from code In-Reply-To: <3FA51E96F92363468CF062D992DC84681F89A9CCAE@NA-EXMSG-C106.redmond.corp.microsoft.com> References: <47E2078E.8070301@voidspace.org.uk> <3FA51E96F92363468CF062D992DC84681F89A9CCAE@NA-EXMSG-C106.redmond.corp.microsoft.com> Message-ID: <47E212AF.8010603@voidspace.org.uk> Srivatsn Narayanan wrote: > It worked for me. The text became bigger onmouseover. I did a root=Application.Current.LoadRootVisual(Canvas(), "app.xaml") with the xaml having nothing but a Canvas > Odd - doesn't work for me. Hopefully I'll get the 'web ide' up soon so that other people can poke it for me. Michael > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Wednesday, March 19, 2008 11:43 PM > To: Discussion of IronPython > Subject: [IronPython] Silverlight - animation from code > > Any idea why the following code does nothing? (root is the application > root visual - the textblock becomes visible and 'starting' is printed at > the right time - but the fint size doesn't change as I would expect from > the Silverlight docs.) > > from System import TimeSpan > from System.Windows import Duration > from System.Windows.Controls import TextBlock > from System.Windows.Media.Animation import ( > DoubleAnimation, Storyboard > ) > > root.Children.Clear() > root.Resources.Clear() > > t = TextBlock() > t.FontSize = 20 > t.Text = 'Something Blue' > root.Children.Add(t) > > sb = Storyboard() > duration = Duration(TimeSpan.FromSeconds(2)) > a = DoubleAnimation() > a.Duration = duration > sb.Duration = duration > sb.Children.Add(a) > > Storyboard.SetTarget(a, t) > Storyboard.SetTargetProperty(a, 'FontSize') > a.From = 20 > a.To = 40 > > def anim(s, e): > print 'Starting' > sb.Begin() > > t.MouseEnter += anim > > root.Resources.Add(sb) > > > > _______________________________________________ > 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 miha.valencic at gmail.com Thu Mar 20 11:27:50 2008 From: miha.valencic at gmail.com (Miha Valencic) Date: Thu, 20 Mar 2008 11:27:50 +0100 Subject: [IronPython] [AVG SPAM] inheriting from "base" generic type In-Reply-To: References: <2fd6b9d0803170025q16ed861by98d74d39a61481db@mail.gmail.com> <47DE29EF.1070909@holdenweb.com> <7AD436E4270DD54A94238001769C2227011D80382C03@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <233dfa1d0803171003o14db8f5csd6744a9cb64e7acd@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011D80382C51@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <233dfa1d0803171146h73901e9q18ff1fde6e78644a@mail.gmail.com> <47E15CAB.4010909@holdenweb.com> Message-ID: <233dfa1d0803200327o23d863c6x157dd4813cf8d796@mail.gmail.com> Cool! Thanks for the info! On Wed, Mar 19, 2008 at 7:57 PM, Jeff Hardy wrote: > Shameless plug: NWSGI (http://codeplex.com/NWSGI) will use IronPython > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jimmy.Schementi at microsoft.com Thu Mar 20 19:39:51 2008 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Thu, 20 Mar 2008 11:39:51 -0700 Subject: [IronPython] Silverlight - animation from code In-Reply-To: <47E212AF.8010603@voidspace.org.uk> References: <47E2078E.8070301@voidspace.org.uk> <3FA51E96F92363468CF062D992DC84681F89A9CCAE@NA-EXMSG-C106.redmond.corp.microsoft.com> <47E212AF.8010603@voidspace.org.uk> Message-ID: <5283CA0A4168DF4FBBD71AE9ECA5A328457E789AD4@NA-EXMSG-C116.redmond.corp.microsoft.com> Yep, got it working too (attached). This is against the IronPython bits from http://dynamicsilverlight.net/get/. However, I have reproduced what you're talking about in dlrconsole (http://dynamicsilverlight.net/see/dlrconsole), which uses the older ironpython bits shipped in the Silverlight SDK. If you type Michael's code in there, it prints "Starting" but the font size never changes (note: the "root" referenced in Michael's code is the same as "canvas" in dlrconsole, so simply do "root = canvas" before typing in the code ... and sorry that there's no copy/paste! I guess that should be fixed =P) Michael, which set of bits are you using? ~Jimmy > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Thursday, March 20, 2008 12:31 AM > To: Discussion of IronPython > Subject: Re: [IronPython] Silverlight - animation from code > > Srivatsn Narayanan wrote: > > It worked for me. The text became bigger onmouseover. I did a > root=Application.Current.LoadRootVisual(Canvas(), "app.xaml") with the > xaml having nothing but a Canvas[jimmysch] from > > > Odd - doesn't work for me. Hopefully I'll get the 'web ide' up soon so > that other people can poke it for me. > > Michael > > > -----Original Message----- > > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Michael Foord > > Sent: Wednesday, March 19, 2008 11:43 PM > > To: Discussion of IronPython > > Subject: [IronPython] Silverlight - animation from code > > > > Any idea why the following code does nothing? (root is the > application > > root visual - the textblock becomes visible and 'starting' is printed > at > > the right time - but the fint size doesn't change as I would expect > from > > the Silverlight docs.) > > > > from System import TimeSpan > > from System.Windows import Duration > > from System.Windows.Controls import TextBlock > > from System.Windows.Media.Animation import ( > > DoubleAnimation, Storyboard > > ) > > > > root.Children.Clear() > > root.Resources.Clear() > > > > t = TextBlock() > > t.FontSize = 20 > > t.Text = 'Something Blue' > > root.Children.Add(t) > > > > sb = Storyboard() > > duration = Duration(TimeSpan.FromSeconds(2)) > > a = DoubleAnimation() > > a.Duration = duration > > sb.Duration = duration > > sb.Children.Add(a) > > > > Storyboard.SetTarget(a, t) > > Storyboard.SetTargetProperty(a, 'FontSize') > > a.From = 20 > > a.To = 40 > > > > def anim(s, e): > > print 'Starting' > > sb.Begin() > > > > t.MouseEnter += anim > > > > root.Resources.Add(sb) > > > > > > > > _______________________________________________ > > 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 -------------- A non-text attachment was scrubbed... Name: font-grow.zip Type: application/x-zip-compressed Size: 1664 bytes Desc: font-grow.zip URL: From Jimmy.Schementi at microsoft.com Thu Mar 20 19:47:42 2008 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Thu, 20 Mar 2008 11:47:42 -0700 Subject: [IronPython] Silverlight - animation from code Message-ID: <5283CA0A4168DF4FBBD71AE9ECA5A328457E789AE5@NA-EXMSG-C116.redmond.corp.microsoft.com> Yep, got it working too (http://jimmy.schementi.com/silverlight/font-grow.zip). This is against the IronPython bits from http://dynamicsilverlight.net/get/. However, I have reproduced what you're talking about in dlrconsole (http://dynamicsilverlight.net/see/dlrconsole), which uses the older ironpython bits shipped in the Silverlight SDK. If you type Michael's code in there, it prints "Starting" but the font size never changes (note: the "root" referenced in Michael's code is the same as "canvas" in dlrconsole, so simply do "root = canvas" before typing in the code ... and sorry that there's no copy/paste! I guess that should be fixed =P) Michael, which set of bits are you using? ~Jimmy > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Thursday, March 20, 2008 12:31 AM > To: Discussion of IronPython > Subject: Re: [IronPython] Silverlight - animation from code > > Srivatsn Narayanan wrote: > > It worked for me. The text became bigger onmouseover. I did a > root=Application.Current.LoadRootVisual(Canvas(), "app.xaml") with the > xaml having nothing but a Canvas[jimmysch] from > > > Odd - doesn't work for me. Hopefully I'll get the 'web ide' up soon so > that other people can poke it for me. > > Michael > > > -----Original Message----- > > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Michael Foord > > Sent: Wednesday, March 19, 2008 11:43 PM > > To: Discussion of IronPython > > Subject: [IronPython] Silverlight - animation from code > > > > Any idea why the following code does nothing? (root is the > application > > root visual - the textblock becomes visible and 'starting' is > > printed > at > > the right time - but the fint size doesn't change as I would expect > from > > the Silverlight docs.) > > > > from System import TimeSpan > > from System.Windows import Duration > > from System.Windows.Controls import TextBlock from > > System.Windows.Media.Animation import ( > > DoubleAnimation, Storyboard > > ) > > > > root.Children.Clear() > > root.Resources.Clear() > > > > t = TextBlock() > > t.FontSize = 20 > > t.Text = 'Something Blue' > > root.Children.Add(t) > > > > sb = Storyboard() > > duration = Duration(TimeSpan.FromSeconds(2)) a = DoubleAnimation() > > a.Duration = duration sb.Duration = duration > > sb.Children.Add(a) > > > > Storyboard.SetTarget(a, t) > > Storyboard.SetTargetProperty(a, 'FontSize') a.From = 20 a.To = 40 > > > > def anim(s, e): > > print 'Starting' > > sb.Begin() > > > > t.MouseEnter += anim > > > > root.Resources.Add(sb) > > > > > > > > _______________________________________________ > > 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 paschott at yahoo.com Thu Mar 20 22:10:52 2008 From: paschott at yahoo.com (Peter Schott) Date: Thu, 20 Mar 2008 16:10:52 -0500 Subject: [IronPython] Cannot find ScriptDomainManager in IronPython 2b1 Microsoft.Scripting Message-ID: <7ed125390803201410s26017fe9qbfb6532e26ae7d99@mail.gmail.com> Finally getting to play around a little with the latest beta and working through the Tutorials. When I try to issue: from Microsoft.Scripting import ScriptDomainManager I get an error because it's not there. Here's a dir(Microsoft.Scripting): >>> dir(Microsoft.Scripting) ['ActionOnCallAttribute', 'Actions', 'AmbiguousFileNameException', 'ArgumentType Exception', 'Ast', 'CompilerContext', 'CompilerOptions', 'EngineOptions', 'Error Counter', 'ErrorSink', 'FunctionType', 'Generation', 'Hosting', 'IAttributesColl ection', 'IValueEquality', 'Math', 'None', 'ParamDictionaryAttribute', 'ParserSi nk', 'PerfTrack', 'PlatformAdaptationLayer', 'Runtime', 'ScriptCode', 'Severity' , 'Shell', 'SourceCodeKind', 'SourceCodeProperties', 'SourceCodePropertiesUtils' , 'SourceLocation', 'SourceSpan', 'SourceStringContentProvider', 'SourceUnit', ' SourceUnitReader', 'StreamContentProvider', 'SymbolId', 'SymbolTable', 'SyntaxEr rorException', 'TextContentProvider', 'Tuple', 'Utils'] Am I calling the wrong library? Am I missing something really basic? My sys.path is only pointing to the latest beta, the Lib folder, and my Python 2.5 lib folder. From fuzzyman at voidspace.org.uk Fri Mar 21 00:25:36 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Thu, 20 Mar 2008 23:25:36 +0000 Subject: [IronPython] Silverlight - animation from code In-Reply-To: <5283CA0A4168DF4FBBD71AE9ECA5A328457E789AE5@NA-EXMSG-C116.redmond.corp.microsoft.com> References: <5283CA0A4168DF4FBBD71AE9ECA5A328457E789AE5@NA-EXMSG-C116.redmond.corp.microsoft.com> Message-ID: <47E2F270.3010404@voidspace.org.uk> Jimmy Schementi wrote: > Yep, got it working too (http://jimmy.schementi.com/silverlight/font-grow.zip). This is against the IronPython bits from http://dynamicsilverlight.net/get/. > > However, I have reproduced what you're talking about in dlrconsole (http://dynamicsilverlight.net/see/dlrconsole), which uses the older ironpython bits shipped in the Silverlight SDK. If you type Michael's code in there, it prints "Starting" but the font size never changes (note: the "root" referenced in Michael's code is the same as "canvas" in dlrconsole, so simply do "root = canvas" before typing in the code ... and sorry that there's no copy/paste! I guess that should be fixed =P) > > Michael, which set of bits are you using? > I'm actually using the binaries that Dino gave me - which if anything should be more up to date than the ones from dynamicsilverlight.net. Perhaps it is something to do with the environment as I was testing it in my 'webide' which is a fairly similar environment to the DLRConsole. I've just got into London and will try it as a standalone script when I get home. Thanks for trying this for me - and great to meet you Harry. Michael > ~Jimmy > > >> -----Original Message----- >> From: users-bounces at lists.ironpython.com [mailto:users- >> bounces at lists.ironpython.com] On Behalf Of Michael Foord >> Sent: Thursday, March 20, 2008 12:31 AM >> To: Discussion of IronPython >> Subject: Re: [IronPython] Silverlight - animation from code >> >> Srivatsn Narayanan wrote: >> >>> It worked for me. The text became bigger onmouseover. I did a >>> >> root=Application.Current.LoadRootVisual(Canvas(), "app.xaml") with the >> xaml having nothing but a Canvas[jimmysch] from >> >> Odd - doesn't work for me. Hopefully I'll get the 'web ide' up soon so >> that other people can poke it for me. >> >> Michael >> >> >>> -----Original Message----- >>> From: users-bounces at lists.ironpython.com [mailto:users- >>> >> bounces at lists.ironpython.com] On Behalf Of Michael Foord >> >>> Sent: Wednesday, March 19, 2008 11:43 PM >>> To: Discussion of IronPython >>> Subject: [IronPython] Silverlight - animation from code >>> >>> Any idea why the following code does nothing? (root is the >>> >> application >> >>> root visual - the textblock becomes visible and 'starting' is >>> printed >>> >> at >> >>> the right time - but the fint size doesn't change as I would expect >>> >> from >> >>> the Silverlight docs.) >>> >>> from System import TimeSpan >>> from System.Windows import Duration >>> from System.Windows.Controls import TextBlock from >>> System.Windows.Media.Animation import ( >>> DoubleAnimation, Storyboard >>> ) >>> >>> root.Children.Clear() >>> root.Resources.Clear() >>> >>> t = TextBlock() >>> t.FontSize = 20 >>> t.Text = 'Something Blue' >>> root.Children.Add(t) >>> >>> sb = Storyboard() >>> duration = Duration(TimeSpan.FromSeconds(2)) a = DoubleAnimation() >>> a.Duration = duration sb.Duration = duration >>> sb.Children.Add(a) >>> >>> Storyboard.SetTarget(a, t) >>> Storyboard.SetTargetProperty(a, 'FontSize') a.From = 20 a.To = 40 >>> >>> def anim(s, e): >>> print 'Starting' >>> sb.Begin() >>> >>> t.MouseEnter += anim >>> >>> root.Resources.Add(sb) >>> >>> >>> >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From dinov at exchange.microsoft.com Fri Mar 21 02:43:59 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Thu, 20 Mar 2008 18:43:59 -0700 Subject: [IronPython] Cannot find ScriptDomainManager in IronPython 2b1 Microsoft.Scripting In-Reply-To: <7ed125390803201410s26017fe9qbfb6532e26ae7d99@mail.gmail.com> References: <7ed125390803201410s26017fe9qbfb6532e26ae7d99@mail.gmail.com> Message-ID: <7AD436E4270DD54A94238001769C2227011D81127CAC@DF-GRTDANE-MSG.exchange.corp.microsoft.com> It's in Microsoft.Scripting.Runtime now. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Peter Schott Sent: Thursday, March 20, 2008 2:11 PM To: users at lists.ironpython.com Subject: [IronPython] Cannot find ScriptDomainManager in IronPython 2b1 Microsoft.Scripting Finally getting to play around a little with the latest beta and working through the Tutorials. When I try to issue: from Microsoft.Scripting import ScriptDomainManager I get an error because it's not there. Here's a dir(Microsoft.Scripting): >>> dir(Microsoft.Scripting) ['ActionOnCallAttribute', 'Actions', 'AmbiguousFileNameException', 'ArgumentType Exception', 'Ast', 'CompilerContext', 'CompilerOptions', 'EngineOptions', 'Error Counter', 'ErrorSink', 'FunctionType', 'Generation', 'Hosting', 'IAttributesColl ection', 'IValueEquality', 'Math', 'None', 'ParamDictionaryAttribute', 'ParserSi nk', 'PerfTrack', 'PlatformAdaptationLayer', 'Runtime', 'ScriptCode', 'Severity' , 'Shell', 'SourceCodeKind', 'SourceCodeProperties', 'SourceCodePropertiesUtils' , 'SourceLocation', 'SourceSpan', 'SourceStringContentProvider', 'SourceUnit', ' SourceUnitReader', 'StreamContentProvider', 'SymbolId', 'SymbolTable', 'SyntaxEr rorException', 'TextContentProvider', 'Tuple', 'Utils'] Am I calling the wrong library? Am I missing something really basic? My sys.path is only pointing to the latest beta, the Lib folder, and my Python 2.5 lib folder. _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From curt at hagenlocher.org Fri Mar 21 02:58:46 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Thu, 20 Mar 2008 18:58:46 -0700 Subject: [IronPython] Cannot find ScriptDomainManager in IronPython 2b1 Microsoft.Scripting In-Reply-To: <7ed125390803201410s26017fe9qbfb6532e26ae7d99@mail.gmail.com> References: <7ed125390803201410s26017fe9qbfb6532e26ae7d99@mail.gmail.com> Message-ID: On Thu, Mar 20, 2008 at 2:10 PM, Peter Schott wrote: > Finally getting to play around a little with the latest beta and > working through the Tutorials. When I try to issue: > > from Microsoft.Scripting import ScriptDomainManager > > I get an error because it's not there. try: from Microsoft.Scripting.Runtime import ScriptDomainManager -- Curt Hagenlocher curt at hagenlocher.org From dblank at brynmawr.edu Fri Mar 21 03:43:22 2008 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Thu, 20 Mar 2008 22:43:22 -0400 (EDT) Subject: [IronPython] IPCE: getting started Message-ID: <40468.71.59.123.159.1206067402.squirrel@webmail.brynmawr.edu> IPCE users, Just getting started with IPCE and wondering about the current state of things. I'm trying to get started with some Windows.Forms testing, and wanted to use the most modern version which is stable. I'm using IPCE-r7 under Fedora 8. Here's my setup, followed by some issues: $ mono --version Mono JIT compiler version 1.2.5.1 (tarball) Copyright (C) 2002-2007 Novell, Inc and Contributors. www.mono-project.com TLS: __thread GC: Included Boehm (with typed GC) SIGSEGV: normal Architecture: x86 Disabled: none $ pwd /home/dblank/fepy/IPCE/IronPython-2.0A7/Tutorial $ mono ~/Desktop/IPCE-r7/ipy2/ipy.exe IronPython console: IronPython 2.0A5 (2.0.11011.00) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> 1) I can't seem to import random: >>> import random ** ERROR **: file mini.c: line 3897 (mono_method_to_ir): assertion failed: (!sig->has_type_parameters) aborting... Stacktrace: at IronPython.NewTypes.IronPython.Modules.Random_1.GetRule (Microsoft.Scripting.Actions.DynamicAction,Microsoft.Scripting.CodeContext,object[]) <0xffffffff> ... This works with IPCE-r7/ipy/ipy.exe. Do I need a more modern mono? Or is there another issue? 2) I'd use 1.1, but it doesn't seem to load Windows.Forms: $ mono ~/Desktop/IPCE-r7/ipy/ipy.exe IronPython 1.1 (1.1) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> import clr >>> clr.AddReference('System.Windows.Forms') >>> from System.Windows.Forms import Application, Button, Form >>> form = Form() Traceback (most recent call last): File System.Drawing, line unknown, in .cctor File System.Drawing, line unknown, in .ctor File System.Drawing, line unknown, in .ctor File System.Drawing, line unknown, in InitFromStream File System.Windows.Forms, line unknown, in .cctor File System.Windows.Forms, line unknown, in GetResource File mscorlib, line unknown, in GetObject File mscorlib, line unknown, in GetObject File mscorlib, line unknown, in GetObject File mscorlib, line unknown, in ReadResources File mscorlib, line unknown, in get_Value File mscorlib, line unknown, in ResourceValue File mscorlib, line unknown, in ReadValueVer1 File mscorlib, line unknown, in ReadNonPredefinedValue SystemError: An exception was thrown by the type initializer for System.Windows.Forms.Form 3. I tried to build from svn sources, but the build.sh looks unmaintained: a. it stopped due to missing ../website/license.html (I made one) b. python-irclib-0.4.6.tar.gz was missing (I downloaded it) 4. If there is a README (or a wiki) for IPCE I would read it... and even contribute to it! Any pointers appreciated! -Doug -- Douglas S. Blank Associate Professor, Bryn Mawr College http://cs.brynmawr.edu/~dblank/ Office: 610 526 6501 From sanxiyn at gmail.com Fri Mar 21 08:11:10 2008 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Fri, 21 Mar 2008 16:11:10 +0900 Subject: [IronPython] IPCE: getting started In-Reply-To: <40468.71.59.123.159.1206067402.squirrel@webmail.brynmawr.edu> References: <40468.71.59.123.159.1206067402.squirrel@webmail.brynmawr.edu> Message-ID: <5b0248170803210011p50879496oe3820e19177a329c@mail.gmail.com> 2008/3/21, Douglas S. Blank : > 1) I can't seem to import random: > > This works with IPCE-r7/ipy/ipy.exe. Do I need a more modern mono? Or is > there another issue? Yes. You need Mono version at least 1.2.6 to run IronPython 2.x. > 2) I'd use 1.1, but it doesn't seem to load Windows.Forms: This works for me. > 3. I tried to build from svn sources, but the build.sh looks unmaintained: > a. it stopped due to missing ../website/license.html (I made one) > b. python-irclib-0.4.6.tar.gz was missing (I downloaded it) 0. Build stuffs inside IPCE were not really for public consumptions. :( a. Yes. You need to run "make" inside website directory. b. The idea is that you run ./download.sh and then ./build.sh. -- Seo Sanghyeon From dblank at brynmawr.edu Fri Mar 21 13:39:25 2008 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Fri, 21 Mar 2008 08:39:25 -0400 (EDT) Subject: [IronPython] IPCE: getting started In-Reply-To: <40468.71.59.123.159.1206067402.squirrel@webmail.brynmawr.edu> References: <40468.71.59.123.159.1206067402.squirrel@webmail.brynmawr.edu> Message-ID: <45508.71.59.123.159.1206103165.squirrel@webmail.brynmawr.edu> Seo et al, Between upgrading to a later mono, and installing libgdiplus-devel I'm completely working! We'll be keeping the following page up-to-date with notes on IronPython: http://wiki.roboteducation.org/IronPython Feel free to make corrections, comments, or other remarks there. (I've also tried to document the IPCE build process so that members of the community can also build the community edition. Looks like it works.) Thanks to all for making this available, and for the community-supported version! -Doug On Thu, March 20, 2008 10:43 pm, Douglas S. Blank said: > IPCE users, > > Just getting started with IPCE and wondering about the current state of > things. I'm trying to get started with some Windows.Forms testing, and > wanted to use the most modern version which is stable. I'm using IPCE-r7 > under Fedora 8. Here's my setup, followed by some issues: > > $ mono --version > Mono JIT compiler version 1.2.5.1 (tarball) > Copyright (C) 2002-2007 Novell, Inc and Contributors. www.mono-project.com > TLS: __thread > GC: Included Boehm (with typed GC) > SIGSEGV: normal > Architecture: x86 > Disabled: none > $ pwd > /home/dblank/fepy/IPCE/IronPython-2.0A7/Tutorial > $ mono ~/Desktop/IPCE-r7/ipy2/ipy.exe > IronPython console: IronPython 2.0A5 (2.0.11011.00) on .NET 2.0.50727.42 > Copyright (c) Microsoft Corporation. All rights reserved. >>>> > > 1) I can't seem to import random: > >>>> import random > > ** ERROR **: file mini.c: line 3897 (mono_method_to_ir): assertion failed: > (!sig->has_type_parameters) > aborting... > Stacktrace: > > at IronPython.NewTypes.IronPython.Modules.Random_1.GetRule > (Microsoft.Scripting.Actions.DynamicAction,Microsoft.Scripting.CodeContext,object[]) > <0xffffffff> > ... > > This works with IPCE-r7/ipy/ipy.exe. Do I need a more modern mono? Or is > there another issue? > > 2) I'd use 1.1, but it doesn't seem to load Windows.Forms: > > $ mono ~/Desktop/IPCE-r7/ipy/ipy.exe > IronPython 1.1 (1.1) on .NET 2.0.50727.42 > Copyright (c) Microsoft Corporation. All rights reserved. >>>> import clr >>>> clr.AddReference('System.Windows.Forms') >>>> from System.Windows.Forms import Application, Button, Form >>>> form = Form() > Traceback (most recent call last): > File System.Drawing, line unknown, in .cctor > File System.Drawing, line unknown, in .ctor > File System.Drawing, line unknown, in .ctor > File System.Drawing, line unknown, in InitFromStream > File System.Windows.Forms, line unknown, in .cctor > File System.Windows.Forms, line unknown, in GetResource > File mscorlib, line unknown, in GetObject > File mscorlib, line unknown, in GetObject > File mscorlib, line unknown, in GetObject > File mscorlib, line unknown, in ReadResources > File mscorlib, line unknown, in get_Value > File mscorlib, line unknown, in ResourceValue > File mscorlib, line unknown, in ReadValueVer1 > File mscorlib, line unknown, in ReadNonPredefinedValue > SystemError: An exception was thrown by the type initializer for > System.Windows.Forms.Form > > 3. I tried to build from svn sources, but the build.sh looks unmaintained: > a. it stopped due to missing ../website/license.html (I made one) > b. python-irclib-0.4.6.tar.gz was missing (I downloaded it) > > 4. If there is a README (or a wiki) for IPCE I would read it... and even > contribute to it! > > Any pointers appreciated! > > -Doug From fuzzyman at voidspace.org.uk Fri Mar 21 18:17:20 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Fri, 21 Mar 2008 17:17:20 +0000 Subject: [IronPython] Dynamic Silverlight on Codeplex Message-ID: <47E3EDA0.5080409@voidspace.org.uk> Has the dynamic silverlight project on codeplex been abandoned? http://www.codeplex.com/dynamicsilverlight Michael From fuzzyman at voidspace.org.uk Fri Mar 21 18:31:14 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Fri, 21 Mar 2008 17:31:14 +0000 Subject: [IronPython] Silverlight - animation from code In-Reply-To: <47E2078E.8070301@voidspace.org.uk> References: <47E2078E.8070301@voidspace.org.uk> Message-ID: <47E3F0E2.9070006@voidspace.org.uk> Odd. I'm using the binaries from dynamicsilverlight. The following code works fine as a standalone example, but doesn't change the font size when run from inside my web ide ??? Odd. from System import TimeSpan from System.Windows import Application, Duration from System.Windows.Controls import Canvas, TextBlock from System.Windows.Media.Animation import ( DoubleAnimation, Storyboard ) root = Canvas() Application.Current.RootVisual = root t = TextBlock() t.FontSize = 20 t.Text = 'Move the Mouse Over Me' root.Children.Add(t) sb = Storyboard() duration = Duration(TimeSpan.FromSeconds(0.25)) a = DoubleAnimation() a.Duration = duration sb.Duration = duration sb.AutoReverse = True sb.Children.Add(a) Storyboard.SetTarget(a, t) Storyboard.SetTargetProperty(a, 'FontSize') a.From = 20 a.To = 30 def anim(s, e): print 'Starting' sb.Begin() t.MouseEnter += anim root.Resources.Add(sb) Michael Foord wrote: > Any idea why the following code does nothing? (root is the application > root visual - the textblock becomes visible and 'starting' is printed at > the right time - but the fint size doesn't change as I would expect from > the Silverlight docs.) > > from System import TimeSpan > from System.Windows import Duration > from System.Windows.Controls import TextBlock > from System.Windows.Media.Animation import ( > DoubleAnimation, Storyboard > ) > > root.Children.Clear() > root.Resources.Clear() > > t = TextBlock() > t.FontSize = 20 > t.Text = 'Something Blue' > root.Children.Add(t) > > sb = Storyboard() > duration = Duration(TimeSpan.FromSeconds(2)) > a = DoubleAnimation() > a.Duration = duration > sb.Duration = duration > sb.Children.Add(a) > > Storyboard.SetTarget(a, t) > Storyboard.SetTargetProperty(a, 'FontSize') > a.From = 20 > a.To = 40 > > def anim(s, e): > print 'Starting' > sb.Begin() > > t.MouseEnter += anim > > root.Resources.Add(sb) > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From fuzzyman at voidspace.org.uk Fri Mar 21 19:52:54 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Fri, 21 Mar 2008 18:52:54 +0000 Subject: [IronPython] JScript Absent from Dynamic Silverlight Message-ID: <47E40406.5010800@voidspace.org.uk> Hello all, The binaries from dynamicsilverlight.net don't include the JScript binaries(which are part of the Silverlight 2 SDK). When I use Chiron to build apps that include the extended controls (!?) it fails because of the absence of the Microsoft.JScript.Runtime.dll. When I add this dll it succeeds but doesn't include the dll! Any reason for not including those assemblies in dynamic silverlight? Michael http://www.manning.com/foord From rdawson at exchange.microsoft.com Fri Mar 21 20:08:10 2008 From: rdawson at exchange.microsoft.com (Ryan Dawson) Date: Fri, 21 Mar 2008 12:08:10 -0700 Subject: [IronPython] Cannot find ScriptDomainManager in IronPython 2b1 Microsoft.Scripting In-Reply-To: <7AD436E4270DD54A94238001769C2227011D81127CAC@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <7ed125390803201410s26017fe9qbfb6532e26ae7d99@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011D81127CAC@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <50B69702CA6E6D4E849D30CD4989AB8ED80A89C537@DF-GRTDANE-MSG.exchange.corp.microsoft.com> And we're updating the tutorial. Thanks. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: Thursday, March 20, 2008 6:44 PM To: Discussion of IronPython Subject: Re: [IronPython] Cannot find ScriptDomainManager in IronPython 2b1 Microsoft.Scripting It's in Microsoft.Scripting.Runtime now. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Peter Schott Sent: Thursday, March 20, 2008 2:11 PM To: users at lists.ironpython.com Subject: [IronPython] Cannot find ScriptDomainManager in IronPython 2b1 Microsoft.Scripting Finally getting to play around a little with the latest beta and working through the Tutorials. When I try to issue: from Microsoft.Scripting import ScriptDomainManager I get an error because it's not there. Here's a dir(Microsoft.Scripting): >>> dir(Microsoft.Scripting) ['ActionOnCallAttribute', 'Actions', 'AmbiguousFileNameException', 'ArgumentType Exception', 'Ast', 'CompilerContext', 'CompilerOptions', 'EngineOptions', 'Error Counter', 'ErrorSink', 'FunctionType', 'Generation', 'Hosting', 'IAttributesColl ection', 'IValueEquality', 'Math', 'None', 'ParamDictionaryAttribute', 'ParserSi nk', 'PerfTrack', 'PlatformAdaptationLayer', 'Runtime', 'ScriptCode', 'Severity' , 'Shell', 'SourceCodeKind', 'SourceCodeProperties', 'SourceCodePropertiesUtils' , 'SourceLocation', 'SourceSpan', 'SourceStringContentProvider', 'SourceUnit', ' SourceUnitReader', 'StreamContentProvider', 'SymbolId', 'SymbolTable', 'SyntaxEr rorException', 'TextContentProvider', 'Tuple', 'Utils'] Am I calling the wrong library? Am I missing something really basic? My sys.path is only pointing to the latest beta, the Lib folder, and my Python 2.5 lib folder. _______________________________________________ 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 Jimmy.Schementi at microsoft.com Fri Mar 21 21:57:59 2008 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Fri, 21 Mar 2008 13:57:59 -0700 Subject: [IronPython] Dynamic Silverlight on Codeplex In-Reply-To: <47E3EDA0.5080409@voidspace.org.uk> References: <47E3EDA0.5080409@voidspace.org.uk> Message-ID: <5283CA0A4168DF4FBBD71AE9ECA5A328457E78A0F6@NA-EXMSG-C116.redmond.corp.microsoft.com> No, just slow to move bits over there. I'm moving all the downloads to there as we speak ... it'll eventually just serve as a place to host the downloads from dynamicsilverlight.net. Any other suggestions on what to use the codeplex project for? > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Friday, March 21, 2008 10:17 AM > To: Discussion of IronPython > Subject: [IronPython] Dynamic Silverlight on Codeplex > > Has the dynamic silverlight project on codeplex been abandoned? > > http://www.codeplex.com/dynamicsilverlight > > Michael > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From Jimmy.Schementi at microsoft.com Fri Mar 21 22:02:31 2008 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Fri, 21 Mar 2008 14:02:31 -0700 Subject: [IronPython] JScript Absent from Dynamic Silverlight In-Reply-To: <47E40406.5010800@voidspace.org.uk> References: <47E40406.5010800@voidspace.org.uk> Message-ID: <5283CA0A4168DF4FBBD71AE9ECA5A328457E78A0FF@NA-EXMSG-C116.redmond.corp.microsoft.com> > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Friday, March 21, 2008 11:53 AM > To: Discussion of IronPython > Subject: [IronPython] JScript Absent from Dynamic Silverlight > > Hello all, > > The binaries from dynamicsilverlight.net don't include the JScript > binaries(which are part of the Silverlight 2 SDK). JScript wasn't included in the dynamicsilverlight.net release since that release has sources and binaries. JScript will only be released as binaries, so we didn't include it this time around. However, it provides a really bad story for language interop, since the Silverlight SDK and dynamicsilverlight.net have different versions of the DLR. We're planning on refreshing the dynamicsilverlight bits next week, and making an effort include JScript in there as well. > When I use Chiron to build apps that include the extended controls (!?) > it fails because of the absence of the Microsoft.JScript.Runtime.dll. > When I add this dll it succeeds but doesn't include the dll! Creepy! The extended controls definitely shouldn't depend on Microsoft.JScript.Runtime.dll! Can you send me a repro of that? John(s), any idea what the hell is going on here? From curt at hagenlocher.org Fri Mar 21 22:36:43 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Fri, 21 Mar 2008 14:36:43 -0700 Subject: [IronPython] urllib.urlretrieve with IronPython 2a8 In-Reply-To: <7AD436E4270DD54A94238001769C2227011CF4D274D2@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <47B84425.9090804@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011CF4D2730D@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <6f4025010802181511t551732ebme21807486e8c055d@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011CF4D274D2@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: I noticed that this still isn't fixed in 2.0b1, so I took another look at socket.cs and realized that my analysis was slightly off. There's already a mechanism to track duplicated sockets in the form of the handleToSocket mapping. However, this mechanism isn't taken into account when deciding whether or not to Close() the BCL Socket object. Bottom line: I believe this bug can be fixed simply by moving the call to _socket.Close() from socket.close into socket.RemoveHandleSocketMapping, and only calling it when sockets.Count reaches zero. On Mon, Feb 18, 2008 at 9:19 PM, Dino Viehland wrote: > This is a great analysis - based upon this I think it'll be pretty easy to > fix this. I'll take a look at it tomorrow and respond back. > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher > Sent: Monday, February 18, 2008 4:19 PM > To: Discussion of IronPython > Subject: Re: [IronPython] urllib.urlretrieve with IronPython 2a8 > > On Feb 18, 2008 4:12 PM, Curt Hagenlocher wrote: > > > > Is it possible that CPython's socket.close method won't actually close > > the socket while there's still a makefile'd file attacked to the > > underlying OS socket? And that IronPython's will? Because that's the > > only explanation I can come up with. > > It is and it will. CPython basically dups the socket handle when you > call makefile, while IronPython does not. That's the cause of this > bug. > > By the way, the docstring for the IronPython socket class claims that > makefile isn't implemented. This is apparently only half-true. :P > > -- > Curt Hagenlocher > curt at hagenlocher.org > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Fri Mar 21 22:39:03 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Fri, 21 Mar 2008 21:39:03 +0000 Subject: [IronPython] Dynamic Silverlight on Codeplex In-Reply-To: <5283CA0A4168DF4FBBD71AE9ECA5A328457E78A0F6@NA-EXMSG-C116.redmond.corp.microsoft.com> References: <47E3EDA0.5080409@voidspace.org.uk> <5283CA0A4168DF4FBBD71AE9ECA5A328457E78A0F6@NA-EXMSG-C116.redmond.corp.microsoft.com> Message-ID: <47E42AF7.60202@voidspace.org.uk> Jimmy Schementi wrote: > No, just slow to move bits over there. I'm moving all the downloads to there as we speak ... it'll eventually just serve as a place to host the downloads from dynamicsilverlight.net. > > Any other suggestions on what to use the codeplex project for? > > Hello Jimmy, (Sorry for calling you Harry yesterday...) Download site and discussion forum for dynamic silverlight seems fine (although I prefer this mailing list for discussions)... It just upset me to see it out of date. :-p Michael >> -----Original Message----- >> From: users-bounces at lists.ironpython.com [mailto:users- >> bounces at lists.ironpython.com] On Behalf Of Michael Foord >> Sent: Friday, March 21, 2008 10:17 AM >> To: Discussion of IronPython >> Subject: [IronPython] Dynamic Silverlight on Codeplex >> >> Has the dynamic silverlight project on codeplex been abandoned? >> >> http://www.codeplex.com/dynamicsilverlight >> >> Michael >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From curt at hagenlocher.org Sat Mar 22 00:09:42 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Fri, 21 Mar 2008 16:09:42 -0700 Subject: [IronPython] urllib.urlretrieve with IronPython 2a8 In-Reply-To: References: <47B84425.9090804@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011CF4D2730D@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <6f4025010802181511t551732ebme21807486e8c055d@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011CF4D274D2@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: Nope; got it wrong again. I'll just supply a patch once I get this working. On Fri, Mar 21, 2008 at 2:36 PM, Curt Hagenlocher wrote: > I noticed that this still isn't fixed in 2.0b1, so I took another look at > socket.cs and realized that my analysis was slightly off. There's already > a mechanism to track duplicated sockets in the form of the handleToSocket > mapping. However, this mechanism isn't taken into account when deciding > whether or not to Close() the BCL Socket object. > > Bottom line: I believe this bug can be fixed simply by moving the call to > _socket.Close() from socket.close into socket.RemoveHandleSocketMapping, > and only calling it when sockets.Count reaches zero. > On Mon, Feb 18, 2008 at 9:19 PM, Dino Viehland < > dinov at exchange.microsoft.com> wrote: > > > This is a great analysis - based upon this I think it'll be pretty easy > > to fix this. I'll take a look at it tomorrow and respond back. > > > > -----Original Message----- > > From: users-bounces at lists.ironpython.com [mailto: > > users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher > > Sent: Monday, February 18, 2008 4:19 PM > > To: Discussion of IronPython > > Subject: Re: [IronPython] urllib.urlretrieve with IronPython 2a8 > > > > On Feb 18, 2008 4:12 PM, Curt Hagenlocher wrote: > > > > > > Is it possible that CPython's socket.close method won't actually close > > > the socket while there's still a makefile'd file attacked to the > > > underlying OS socket? And that IronPython's will? Because that's the > > > only explanation I can come up with. > > > > It is and it will. CPython basically dups the socket handle when you > > call makefile, while IronPython does not. That's the cause of this > > bug. > > > > By the way, the docstring for the IronPython socket class claims that > > makefile isn't implemented. This is apparently only half-true. :P > > > > -- > > Curt Hagenlocher > > curt at hagenlocher.org > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Sat Mar 22 00:17:02 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Fri, 21 Mar 2008 16:17:02 -0700 Subject: [IronPython] urllib.urlretrieve with IronPython 2a8 In-Reply-To: References: <47B84425.9090804@voidspace.org.uk> <6f4025010802181511t551732ebme21807486e8c055d@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011CF4D274D2@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: Attached. On Fri, Mar 21, 2008 at 4:09 PM, Curt Hagenlocher wrote: > Nope; got it wrong again. I'll just supply a patch once I get this > working. > > > On Fri, Mar 21, 2008 at 2:36 PM, Curt Hagenlocher > wrote: > > > I noticed that this still isn't fixed in 2.0b1, so I took another look > > at socket.cs and realized that my analysis was slightly off. There's > > already a mechanism to track duplicated sockets in the form of the > > handleToSocket mapping. However, this mechanism isn't taken into account > > when deciding whether or not to Close() the BCL Socket object. > > > > Bottom line: I believe this bug can be fixed simply by moving the call > > to _socket.Close() from socket.close into > > socket.RemoveHandleSocketMapping, and only calling it when sockets.Countreaches zero. > > On Mon, Feb 18, 2008 at 9:19 PM, Dino Viehland < > > dinov at exchange.microsoft.com> wrote: > > > > > This is a great analysis - based upon this I think it'll be pretty > > > easy to fix this. I'll take a look at it tomorrow and respond back. > > > > > > -----Original Message----- > > > From: users-bounces at lists.ironpython.com [mailto: > > > users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher > > > Sent: Monday, February 18, 2008 4:19 PM > > > To: Discussion of IronPython > > > Subject: Re: [IronPython] urllib.urlretrieve with IronPython 2a8 > > > > > > On Feb 18, 2008 4:12 PM, Curt Hagenlocher > > > wrote: > > > > > > > > Is it possible that CPython's socket.close method won't actually > > > close > > > > the socket while there's still a makefile'd file attacked to the > > > > underlying OS socket? And that IronPython's will? Because that's > > > the > > > > only explanation I can come up with. > > > > > > It is and it will. CPython basically dups the socket handle when you > > > call makefile, while IronPython does not. That's the cause of this > > > bug. > > > > > > By the way, the docstring for the IronPython socket class claims that > > > makefile isn't implemented. This is apparently only half-true. :P > > > > > > -- > > > Curt Hagenlocher > > > curt at hagenlocher.org > > > _______________________________________________ > > > Users mailing list > > > Users at lists.ironpython.com > > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > _______________________________________________ > > > Users mailing list > > > Users at lists.ironpython.com > > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: socket.cs.diff URL: From billchi at microsoft.com Sat Mar 22 01:15:01 2008 From: billchi at microsoft.com (Bill Chiles) Date: Fri, 21 Mar 2008 17:15:01 -0700 Subject: [IronPython] Dynamic Silverlight on Codeplex In-Reply-To: <47E3EDA0.5080409@voidspace.org.uk> References: <47E3EDA0.5080409@voidspace.org.uk> Message-ID: <2C734460517A154B8E98AC8BA98D49A15A9D01CBB8@NA-EXMSG-C105.redmond.corp.microsoft.com> Jimmy is the best person to answer its status vs. silverlight.net. Thanks, Bill -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Friday, March 21, 2008 10:17 AM To: Discussion of IronPython Subject: [IronPython] Dynamic Silverlight on Codeplex Has the dynamic silverlight project on codeplex been abandoned? http://www.codeplex.com/dynamicsilverlight Michael _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Sat Mar 22 01:41:53 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sat, 22 Mar 2008 00:41:53 +0000 Subject: [IronPython] JScript Absent from Dynamic Silverlight In-Reply-To: <5283CA0A4168DF4FBBD71AE9ECA5A328457E78A0FF@NA-EXMSG-C116.redmond.corp.microsoft.com> References: <47E40406.5010800@voidspace.org.uk> <5283CA0A4168DF4FBBD71AE9ECA5A328457E78A0FF@NA-EXMSG-C116.redmond.corp.microsoft.com> Message-ID: <47E455D1.80504@voidspace.org.uk> Jimmy Schementi wrote: >> -----Original Message----- >> From: users-bounces at lists.ironpython.com [mailto:users- >> bounces at lists.ironpython.com] On Behalf Of Michael Foord >> Sent: Friday, March 21, 2008 11:53 AM >> To: Discussion of IronPython >> Subject: [IronPython] JScript Absent from Dynamic Silverlight >> >> Hello all, >> >> The binaries from dynamicsilverlight.net don't include the JScript >> binaries(which are part of the Silverlight 2 SDK). >> > > JScript wasn't included in the dynamicsilverlight.net release since that release has sources and binaries. JScript will only be released as binaries, so we didn't include it this time around. However, it provides a really bad story for language interop, since the Silverlight SDK and dynamicsilverlight.net have different versions of the DLR. > > We're planning on refreshing the dynamicsilverlight bits next week, and making an effort include JScript in there as well. > > Ok. :-) >> When I use Chiron to build apps that include the extended controls (!?) >> it fails because of the absence of the Microsoft.JScript.Runtime.dll. >> When I add this dll it succeeds but doesn't include the dll! >> > > Creepy! The extended controls definitely shouldn't depend on Microsoft.JScript.Runtime.dll! Can you send me a repro of that? John(s), any idea what the hell is going on here? > I'm getting some more obscure oddness with Chiron - both under Windows and on the Mac. I'm not sure if it is reproducible though. I'm currently still working on my articles and have to tackle this properly soon (probably tomorrow as it is now nearly 1am here). I'll leave the results for another post with any repro instructions if they are consistent. I do wonder if there is some odd kind of caching going on inside Chiron?? (Some xap files don't get binaries added - some cause the browser to make additional requests for assemblies and some just don't work...) Michael > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From taozuhong at qq.com Sun Mar 16 03:39:17 2008 From: taozuhong at qq.com (=?gbk?B?QW5keS5UYW8=?=) Date: Sun, 16 Mar 2008 10:39:17 +0800 Subject: [IronPython] DLR 2.0 Beta 1 can't hosting in another AppDomain Message-ID: Hi, I have written a DLR hosting application, create ScriptRuntime in another AppDomain, DLR throw exception when execute code. the detail code like follow: public class ScriptProxy : MarshalByRefObject, IScriptProxy { private ScriptEngine m_ScriptEngine; private ScriptRuntime m_ScriptRuntime; public ScriptProxy() { ScriptRuntimeSetup runtimeSetup = new ScriptRuntimeSetup(true); m_ScriptRuntime = ScriptRuntime.Create(runtimeSetup); m_ScriptRuntime.GlobalOptions.DebugMode = true; m_ScriptRuntime.GlobalOptions.DynamicStackTraceSupport = true; //Default script engine m_ScriptEngine = m_ScriptRuntime.GetEngine("python"); } } //=======Client code as follow ===================== private void Initialize() { Evidence evidence = AppDomain.CurrentDomain.Evidence; AppDomainSetup appSetup = new AppDomainSetup(); appSetup.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory; m_ScriptAppDomain = AppDomain.CreateDomain("ScriptProxy", evidence, appSetup); m_ScriptAppDomain.Load("ScriptProxy"); m_RemoteScript = (IScriptProxy)m_ScriptAppDomain.CreateInstanceAndUnwrap("ScriptProxy", "ZuHong.TestMore.Scripting.ScriptProxy"); } m_RemoteScript.ExecuteCode(txtScriptSource.Text); ========================================== DLR throw exception when execute code: SourceUnit not marked as SerializableAttribute. ------------------ Andy Tao[???] ??????? http://www.zuhong.cn ??????????????????? -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: A349BAF3 at D9780F25.5588DC47 Type: application/octet-stream Size: 85882 bytes Desc: not available URL: From marcel.vandendungen at gmail.com Sat Mar 22 16:33:48 2008 From: marcel.vandendungen at gmail.com (Marcel) Date: Sat, 22 Mar 2008 08:33:48 -0700 (PDT) Subject: [IronPython] UI Automation and ControlTypeProperty Message-ID: <3ef6c057-b0b0-4348-af6f-b6513a44e9b3@i12g2000prf.googlegroups.com> Hi, I was reading the article on UI automation in MSDN (http:// msdn2.microsoft.com/en-us/magazine/cc163288.aspx) and decided to use IronPython to control the example. Unfortunately, I found that finding elements based on type doesn't work. The example application has 1 button on the form. If I type the following code I get an AutomationElement object: form.FindFirst(TreeScope.Children, PropertyCondition(AutomationElement.NameProperty, "Calculate")) But with the following code, I get None returned: form.FindFirst(TreeScope.Children, PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Button)) The C# code that accompanies the article successfully uses the FindAll with AutomationElement.ControlTypeProperty. Is this a known issue in IronPython? I'm using IronPython 1.1.1. Is this fixed in 2.0? TIA, -- Marcel From fuzzyman at voidspace.org.uk Sat Mar 22 20:13:00 2008 From: fuzzyman at voidspace.org.uk (fuzzyman at voidspace.org.uk) Date: Sat, 22 Mar 2008 19:13:00 +0000 (GMT) Subject: [IronPython] IronPython & Silverlight 2 Tutorial with Demos and Downloads Message-ID: <20080322191300.EAD7B9805F@smtp1.betherenow.co.uk> {ran_emo} Instead of posting my PyCon talk slides, I've turned them into a series of articles instead, which should be easier to follow. All the examples are available online and for download. This is everything you need to get started with IronPython and Silverlight 2. {sm;:-)} All the articles, demos and downloads can be found at: `Voidspace IronPython and Silverlight Pages `_. You can experiment online with the `IronPython & Silverlight Web IDE `_. There is also a prototype of my `Interactive Python Interpreter in the Browser `_. Due to a bug in the *current* Dynamic Silverlight binaries it can't handle indented blocks. I expect Dino will be able to post fixed binaries soon. If you want to help me make the Javascript cross-browser then get in touch! (Currently it is safari only I think.) .. raw:: html {title;The Articles} These articles will take you through everything you need to know to write Silverlight applications with IronPython: * `Introduction to IronPython & Silverlight 2 `_ * `The Structure and Contents of a Dynamic Silverlight Application `_ * `Getting Started: Minimal Examples of IronPython and Silverlight `_ * `The Silverlight APIs `_ Exploring the Core-CLR that comes with Silverlight. This includes accessing the browser DOM, working with XAML, creating controls, the video player, accessing server resources, using local storage and more. * `From Silverlight to Javascript and Back Again `_ Interacting with Javascript from IronPython code is easy, but needs a bit of C#. This article shows you how to do it - including compiling the C# from the command line (without Visual Studio installed). * `Embedding IronPython in a C# Silverlight Application `_ * `Interactive Python Interpreter in the Browser`_ An interactive Python interpreter that runs in the browser, inside an HTML textarea. Great for documentation and tutorials where you can try the code in the browser. .. raw:: html {title;Downloads & Online Examples} You can download several of the examples used in the articles: * `View Minimal IronPython Example 1 Online (with XAML) `_ * `Download Minimal IronPython Example 1 `_ * `View Minimal IronPython Example 2 Online (pure-Python) `_ * `Download Minimal IronPython Example 2 `_ * `View IronPython Controls Example 1 Online (from XAML) `_ * `Download IronPython Controls Example 1 `_ * `View IronPython Controls Example 2 Online `_ * `Download IronPython Controls Example 2 `_ * `View Simple Animation Example Online `_ * `Download Simple Animation Example `_ The easiest way of experimenting with the Silverlight APIs is through the Web IDE: * `View IronPython & Silverlight Web IDE Online `_. * `Download IronPython & Silverlight Web IDE 0.5.0 `_. The following downloads use C#: * `Visual Studio 2008 Project Using the Scriptable Attributes `_ * `Compiling C# from the Command Line (batch file) `_ * `Embedded IronPython Project `_ One of the most exciting things about Silverlight 2 is the possibility of embedding an interactive interpreter inside web pages: * `View Interactive Interpreter Online `_ * `Download Interactive Interpreter `_ If you find any bugs, typos or missing links then please let me know. -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Sat Mar 22 21:02:43 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sat, 22 Mar 2008 20:02:43 +0000 Subject: [IronPython] JScript Absent from Dynamic Silverlight In-Reply-To: <47E455D1.80504@voidspace.org.uk> References: <47E40406.5010800@voidspace.org.uk> <5283CA0A4168DF4FBBD71AE9ECA5A328457E78A0FF@NA-EXMSG-C116.redmond.corp.microsoft.com> <47E455D1.80504@voidspace.org.uk> Message-ID: <47E565E3.7000602@voidspace.org.uk> Michael Foord wrote: > Jimmy Schementi wrote: > > [snip..] >>> When I use Chiron to build apps that include the extended controls (!?) >>> it fails because of the absence of the Microsoft.JScript.Runtime.dll. >>> When I add this dll it succeeds but doesn't include the dll! >>> >>> >> Creepy! The extended controls definitely shouldn't depend on Microsoft.JScript.Runtime.dll! Can you send me a repro of that? John(s), any idea what the hell is going on here? >> >> > > I'm getting some more obscure oddness with Chiron - both under Windows > and on the Mac. I'm not sure if it is reproducible though. > I wonder if Chiron tried to reference the JScript binaries because the app directory had a '.js' file? In either case I have completely failed to get Chiron to do 'the right thing' with creating my 'xap' files and ended up building them by hand. The pattern I used was to have 'Chiron.exe' (with all the assemblies etc that come from dynamicsilverlight.net which is the version I'm using) in a bin subdirectory. I was using it on Windows Vista and added the bin directory to the path. I would then invoke it in the following way: chiron /d:path/to/example/app /x:another/path/to/output It would create 'xap' files, but not put the assemblies *or* a manifest in them. I gave up trying to use it. Michael http://www.manning.com/foord From jdhardy at gmail.com Sun Mar 23 23:45:03 2008 From: jdhardy at gmail.com (Jeff Hardy) Date: Sun, 23 Mar 2008 16:45:03 -0600 Subject: [IronPython] CherryPy and IronPython 2.0b1 Message-ID: Hi all, After applying the attached patch to cherrypy trunk (r1932), CherryPy will run a simple Hello World program (also attached) using IronPython 2.0b1 and NWSGI. It should work with the 0.1 release of NWSGI. I haven't tested the standalone CherryPy server yet. -Jeff -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: cherrypy-nwsgi.patch URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: hello.wsgi URL: From Shri.Borde at microsoft.com Mon Mar 24 07:14:27 2008 From: Shri.Borde at microsoft.com (Shri Borde) Date: Sun, 23 Mar 2008 23:14:27 -0700 Subject: [IronPython] UI Automation and ControlTypeProperty In-Reply-To: <3ef6c057-b0b0-4348-af6f-b6513a44e9b3@i12g2000prf.googlegroups.com> References: <3ef6c057-b0b0-4348-af6f-b6513a44e9b3@i12g2000prf.googlegroups.com> Message-ID: <50B69702CA6E6D4E849D30CD4989AB8ED80A89C790@DF-GRTDANE-MSG.exchange.corp.microsoft.com> UI Automation did have a problem with IronPython. See http://blogs.msdn.com/shrib/archive/2008/03/24/ironpython-cannot-call-automationelement-fromhandle.aspx. I am not sure if the issue has been fixed yet by the UI Automation team. Or if you are running into that same issue or something else. Thanks, Shri Want to work on IronPython, IronRuby, F#? Visit http://blogs.msdn.com/ironpython/ -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Marcel Sent: Saturday, March 22, 2008 8:34 AM To: users at lists.ironpython.com Subject: [IronPython] UI Automation and ControlTypeProperty Hi, I was reading the article on UI automation in MSDN (http:// msdn2.microsoft.com/en-us/magazine/cc163288.aspx) and decided to use IronPython to control the example. Unfortunately, I found that finding elements based on type doesn't work. The example application has 1 button on the form. If I type the following code I get an AutomationElement object: form.FindFirst(TreeScope.Children, PropertyCondition(AutomationElement.NameProperty, "Calculate")) But with the following code, I get None returned: form.FindFirst(TreeScope.Children, PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Button)) The C# code that accompanies the article successfully uses the FindAll with AutomationElement.ControlTypeProperty. Is this a known issue in IronPython? I'm using IronPython 1.1.1. Is this fixed in 2.0? TIA, -- Marcel _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From sanxiyn at gmail.com Mon Mar 24 10:30:13 2008 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Mon, 24 Mar 2008 18:30:13 +0900 Subject: [IronPython] CherryPy and IronPython 2.0b1 In-Reply-To: References: Message-ID: <5b0248170803240230n7005d887yd32a637109479fde@mail.gmail.com> 2008/3/24, Jeff Hardy : > Hi all, > After applying the attached patch to cherrypy trunk (r1932), CherryPy > will run a simple Hello World program (also attached) using IronPython > 2.0b1 and NWSGI. It should work with the 0.1 release of NWSGI. I > haven't tested the standalone CherryPy server yet. A small remark: + d = dict(child.__class__.__dict__).copy() Since you are already copying, I think copy method call would be unnecessary. So: + d = dict(child.__class__.__dict__) -- Seo Sanghyeon From Jimmy.Schementi at microsoft.com Mon Mar 24 14:18:12 2008 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Mon, 24 Mar 2008 06:18:12 -0700 Subject: [IronPython] JScript Absent from Dynamic Silverlight In-Reply-To: <47E565E3.7000602@voidspace.org.uk> Message-ID: On 3/22/08 1:02 PM, "Michael Foord" wrote: > Michael Foord wrote: >> Jimmy Schementi wrote: >> >> [snip..] >>>> When I use Chiron to build apps that include the extended controls (!?) >>>> it fails because of the absence of the Microsoft.JScript.Runtime.dll. >>>> When I add this dll it succeeds but doesn't include the dll! >>>> >>>> >>> Creepy! The extended controls definitely shouldn't depend on >>> Microsoft.JScript.Runtime.dll! Can you send me a repro of that? John(s), any >>> idea what the hell is going on here? >>> >>> >> >> I'm getting some more obscure oddness with Chiron - both under Windows >> and on the Mac. I'm not sure if it is reproducible though. >> > > I wonder if Chiron tried to reference the JScript binaries because the > app directory had a '.js' file? > That'd be it! If you don't have a AppManifest.xaml file in your app, it'll look at the extensions of all your script files to figure out which language assemblies to include in the XAP. If you do have an AppManifest.xaml, it'll just include the ones in there. > > In either case I have completely failed to get Chiron to do 'the right > thing' with creating my 'xap' > files and ended up building them by hand. That's crappy, sorry! I'm writing a blog-post to detail all the *features* of Chiron. Trust me, it's not as creepy as it seems. > The pattern I used was to have 'Chiron.exe' (with all the assemblies etc > that come from dynamicsilverlight.net which is the version I'm using) in > a bin subdirectory. I was using it on Windows Vista and added the bin > directory to the path. I would then invoke it in the following way: > > chiron /d:path/to/example/app /x:another/path/to/output > > It would create 'xap' files, but not put the assemblies *or* a manifest > in them. I gave up trying to use it. So, /x is not the correct flag =) For python/ruby/jscript, you only need to flags below "Dynamic Language Options" ... the other ones are only really used by Visual Studio (don't ask =)). The correct flag is /z[ipdlr]. If you run Chiron like this: Chiron /d:path/to/example/app /z:another/path/to/output/app.xap It will generate app.xap with the correct assembles and AppManifest.xaml in it. That's great for 1-off xap generation. If you just want to work on an app and don't want to xap every-time, just run Chiron in the app directory like so: Chiron /w And it'll automatically xap a directory when you ask for .xap. > Michael > http://www.manning.com/foord > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > I thought the documentation in Chiron was good enough, but an accompanying blog post would have prevented a ton of frustration, I'm sure. Sorry about that again, and I'm get that blog post out asap. From fuzzyman at voidspace.org.uk Mon Mar 24 14:20:54 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 24 Mar 2008 13:20:54 +0000 Subject: [IronPython] JScript Absent from Dynamic Silverlight In-Reply-To: References: Message-ID: <47E7AAB6.4080908@voidspace.org.uk> Jimmy Schementi wrote: > [snip..] >> The pattern I used was to have 'Chiron.exe' (with all the assemblies etc >> that come from dynamicsilverlight.net which is the version I'm using) in >> a bin subdirectory. I was using it on Windows Vista and added the bin >> directory to the path. I would then invoke it in the following way: >> >> chiron /d:path/to/example/app /x:another/path/to/output >> >> It would create 'xap' files, but not put the assemblies *or* a manifest >> in them. I gave up trying to use it. >> > > So, /x is not the correct flag =) For python/ruby/jscript, you only need to > flags below "Dynamic Language Options" ... the other ones are only really > used by Visual Studio (don't ask =)). > > The correct flag is /z[ipdlr]. If you run Chiron like this: > > Chiron /d:path/to/example/app /z:another/path/to/output/app.xap > > So I was just doing it wrong. :-) That sounds entirely plausible. I'd better update the tutorial with the correct usage pattern. Thanks Jimmy. Michael http://www.ironpythoninaction.com From curt at hagenlocher.org Mon Mar 24 17:11:19 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 24 Mar 2008 09:11:19 -0700 Subject: [IronPython] Latest DLR Hosting Spec? Message-ID: Is the file at http://compilerlab.members.winisp.net/dlr-spec-hosting.pdf still the latest publically-available version of the spec? The PDF was created on Jan 3, 08 but otherwise contains no versioning information. -- Curt Hagenlocher curt at hagenlocher.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From marcel.vandendungen at gmail.com Mon Mar 24 21:05:51 2008 From: marcel.vandendungen at gmail.com (Marcel) Date: Mon, 24 Mar 2008 13:05:51 -0700 (PDT) Subject: [IronPython] UI Automation and ControlTypeProperty In-Reply-To: <50B69702CA6E6D4E849D30CD4989AB8ED80A89C790@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <3ef6c057-b0b0-4348-af6f-b6513a44e9b3@i12g2000prf.googlegroups.com> <50B69702CA6E6D4E849D30CD4989AB8ED80A89C790@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: On Mar 24, 7:14 am, Shri Borde wrote: > UI Automation did have a problem with IronPython. Seehttp://blogs.msdn.com/shrib/archive/2008/03/24/ironpython-cannot-call.... I am not sure if the issue has been fixed yet by the UI Automation team. Or if you are running into that same issue or something else. > So the problem is with the UI Automation? Is there a way to verify this comes from the same root cause? Should I submit the issue in the codeplex issue tracker? TIA, -- Marcel From geez4 at runbox.com Mon Mar 24 22:48:46 2008 From: geez4 at runbox.com (Gary Kopp) Date: Mon, 24 Mar 2008 15:48:46 -0600 Subject: [IronPython] Sanity Check re. Legacy Python Code Message-ID: <01c801c88df8$d7f395d0$8603a8c0@Inspiron> Would I be correct in assuming that it is _not_ currently the intent that IronPython run "arbitrary" existing Python code? I am interested in making use of the Natural Language Toolkit (NLTK), a huge Python 2.5 application, in a .NET environment. Clearly, the most powerful approach would be to use IronPython, but I'm guessing (and please correct me if I'm wrong) that current limitations in the IronPython 2.0b1 implementation are likely to present many challenges in running/porting arbitrary "legacy" Python apps. My purpose in writing this is simply to find out whether I should even bother attempting such a feat. --Gary Kopp From curt at hagenlocher.org Mon Mar 24 22:58:53 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 24 Mar 2008 14:58:53 -0700 Subject: [IronPython] Sanity Check re. Legacy Python Code In-Reply-To: <01c801c88df8$d7f395d0$8603a8c0@Inspiron> References: <01c801c88df8$d7f395d0$8603a8c0@Inspiron> Message-ID: As I understand it, the goal of IronPython is to support the running of that kind of application -- provided that it doesn't use any binary extensions[1]. The NTLK webpage is a bit vague on that count, suggesting that "some users may require" numpy and matplotlib. If you're not one of "those users", you should give it a try! Of course, there's some chance that NLTK won't work correctly under 2.0b1; your reports in that regard will help all of us by driving IronPython closer to CPython compatibility. 1: but see also http://ironpython-urls.blogspot.com/2008/02/ironclad-01-released.html -- for which numpy support is an explicit goal On Mon, Mar 24, 2008 at 2:48 PM, Gary Kopp wrote: > Would I be correct in assuming that it is _not_ currently the intent that > IronPython run "arbitrary" existing Python code? I am interested in making > use of the Natural Language Toolkit (NLTK), a huge Python 2.5 application, > in a .NET environment. Clearly, the most powerful approach would be to use > IronPython, but I'm guessing (and please correct me if I'm wrong) that > current limitations in the IronPython 2.0b1 implementation are likely to > present many challenges in running/porting arbitrary "legacy" Python apps. > My purpose in writing this is simply to find out whether I should even > bother attempting such a feat. > > --Gary Kopp > > _______________________________________________ > 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 geez4 at runbox.com Mon Mar 24 23:18:36 2008 From: geez4 at runbox.com (Gary Kopp) Date: Mon, 24 Mar 2008 16:18:36 -0600 Subject: [IronPython] Sanity Check re. Legacy Python Code In-Reply-To: References: <01c801c88df8$d7f395d0$8603a8c0@Inspiron> Message-ID: <01e701c88dfd$02619110$8603a8c0@Inspiron> Thanks for the info, Curt. Stupid of me - I didn't even stop to think about the issue of binary extensions. I absolutely need numpy! I'll track Ironclad's progress now that you've made me aware of it. Meanwhile, I'll think about using Python.Net in the interim, and just try to "embed" NLTK (GIL and all) in my C# app. --Gary _____ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher Sent: Monday, March 24, 2008 3:59 PM To: Discussion of IronPython Subject: Re: [IronPython] Sanity Check re. Legacy Python Code As I understand it, the goal of IronPython is to support the running of that kind of application -- provided that it doesn't use any binary extensions[1]. The NTLK webpage is a bit vague on that count, suggesting that "some users may require" numpy and matplotlib. If you're not one of "those users", you should give it a try! Of course, there's some chance that NLTK won't work correctly under 2.0b1; your reports in that regard will help all of us by driving IronPython closer to CPython compatibility. 1: but see also http://ironpython-urls.blogspot.com/2008/02/ironclad-01-released.html -- for which numpy support is an explicit goal On Mon, Mar 24, 2008 at 2:48 PM, Gary Kopp wrote: Would I be correct in assuming that it is _not_ currently the intent that IronPython run "arbitrary" existing Python code? I am interested in making use of the Natural Language Toolkit (NLTK), a huge Python 2.5 application, in a .NET environment. Clearly, the most powerful approach would be to use IronPython, but I'm guessing (and please correct me if I'm wrong) that current limitations in the IronPython 2.0b1 implementation are likely to present many challenges in running/porting arbitrary "legacy" Python apps. My purpose in writing this is simply to find out whether I should even bother attempting such a feat. --Gary Kopp _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jimmy.Schementi at microsoft.com Mon Mar 24 23:54:04 2008 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Mon, 24 Mar 2008 15:54:04 -0700 Subject: [IronPython] http://codeplex.com/dynamicsilverlight Message-ID: Spamming both the lists, http://www.codeplex.com/dynamicsilverlight has been updated to host the Silverlight2 Beta1 bits. We will be using it as Dynamic Silverlight's project site, so please report any Silverlight-specific bugs there. Next steps are to move more samples up to the site, and host them on http://dynamicsilverlight.net and http://silverlight.net. Also, if you'd like to have a Dynamic Silverlight app showcased on http://dynamicsilverlight.net and the CodePlex project, please post the app (links to zipped source code and the live app) to the Discussions tab on the project and we will host it for you! Let me know what else you'd like to see on the Dynamic Silverlight CodePlex project site. Thanks! ~Jimmy From Shri.Borde at microsoft.com Tue Mar 25 00:04:49 2008 From: Shri.Borde at microsoft.com (Shri Borde) Date: Mon, 24 Mar 2008 16:04:49 -0700 Subject: [IronPython] UI Automation and ControlTypeProperty In-Reply-To: References: <3ef6c057-b0b0-4348-af6f-b6513a44e9b3@i12g2000prf.googlegroups.com> <50B69702CA6E6D4E849D30CD4989AB8ED80A89C790@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <50B69702CA6E6D4E849D30CD4989AB8ED80A89CA82@DF-GRTDANE-MSG.exchange.corp.microsoft.com> If you can check if the failing API calls Assembly.GetCallingAssembly by placing a breakpoint in the debugger, that would be 99% confirmation that it is the same issue. Alternatively, you could change the C# code to use Reflection.Emit to create a method which invokes the UI Automation API. If this fails, it is the same bug. The bug affects all dynamic code (IronPython source code gets compiled to Reflection.Emit on the fly). I have pinged the UI Automation team to find out the status of the bug. You could open a bug in the IronPython tracker. Given that its most likely not an IronPython issue, we may not be able to get to it in time to unblock you. Thanks, Shri Want to work on IronPython, IronRuby, F#? Visit http://blogs.msdn.com/ironpython -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Marcel Sent: Monday, March 24, 2008 1:06 PM To: users at lists.ironpython.com Subject: Re: [IronPython] UI Automation and ControlTypeProperty On Mar 24, 7:14 am, Shri Borde wrote: > UI Automation did have a problem with IronPython. Seehttp://blogs.msdn.com/shrib/archive/2008/03/24/ironpython-cannot-call.... I am not sure if the issue has been fixed yet by the UI Automation team. Or if you are running into that same issue or something else. > So the problem is with the UI Automation? Is there a way to verify this comes from the same root cause? Should I submit the issue in the codeplex issue tracker? TIA, -- Marcel _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From sls at iinet.net.au Tue Mar 25 13:56:58 2008 From: sls at iinet.net.au (Paul Turbett) Date: Tue, 25 Mar 2008 21:56:58 +0900 Subject: [IronPython] Question about serialization Message-ID: <47E8F69A.5010205@iinet.net.au> Hi, I'm using IP as a scripting engine in a C# app. I have various Python classes that derive from a C# base class, and have there own additional data & functionality. I would like to be able to serialize instances of the Python classes from the C# host for persistence across sessions. Using the standard BinaryFormatter with the Serializable attribute is not working - I get an error about the python class not being marked as serializable (the C# base class is marked as serializable though). How can I serialize python objects from C#? Should I use reflection to roll my own serializer, or is there something in one of the lesser documented assemblies like Ops I should use? I'm using IP 1.1.1 (but will move to 2.0 if that will help). Any pointers & advice greatly appreciated! Thanks, Paul From fuzzyman at voidspace.org.uk Tue Mar 25 14:12:02 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 25 Mar 2008 13:12:02 +0000 Subject: [IronPython] Question about serialization In-Reply-To: <47E8F69A.5010205@iinet.net.au> References: <47E8F69A.5010205@iinet.net.au> Message-ID: <47E8FA22.2030407@voidspace.org.uk> Paul Turbett wrote: > Hi, > > I'm using IP as a scripting engine in a C# app. I have various Python > classes that derive from a C# base class, and have there own additional > data & functionality. > > I would like to be able to serialize instances of the Python classes > from the C# host for persistence across sessions. Using the standard > BinaryFormatter with the Serializable attribute is not working - I get > an error about the python class not being marked as serializable (the C# > base class is marked as serializable though). > > How can I serialize python objects from C#? Should I use reflection to > roll my own serializer, or is there something in one of the lesser > documented assemblies like Ops I should use? > Typically for serializing Python objects you would use pickle [1]. The 'dumps' function returns a string (make sure you use the text protocol for IronPython). You could then execute code inside the Python engine to serialize / deserialize objects. I've not tried this for instances that inherit from C# base classes - but it should work fine. :-) Michael Foord http://www.ironpythoninaction.com .. [1] http://docs.python.org/lib/module-pickle.html > I'm using IP 1.1.1 (but will move to 2.0 if that will help). Any > pointers & advice greatly appreciated! > > Thanks, Paul > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From fuzzyman at voidspace.org.uk Tue Mar 25 14:50:02 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 25 Mar 2008 13:50:02 +0000 Subject: [IronPython] Talk on IronPython at PyCon Italy Message-ID: <47E9030A.7060502@voidspace.org.uk> Hello all, I've been asked by the organisers of PyCon Italy if anyone would be able to speak on IronPython at PyCon Italy in May? The person to contact is: Lawrence Oluyede l.oluyede at gmail.com There is also a PyCon in France and a EuroPython which could be good opportunities. Michael http://www.ironpythoninaction.com/ From giles.thomas at resolversystems.com Tue Mar 25 17:11:48 2008 From: giles.thomas at resolversystems.com (Giles Thomas) Date: Tue, 25 Mar 2008 16:11:48 +0000 Subject: [IronPython] Sanity Check re. Legacy Python Code In-Reply-To: <01e701c88dfd$02619110$8603a8c0@Inspiron> References: <01c801c88df8$d7f395d0$8603a8c0@Inspiron> <01e701c88dfd$02619110$8603a8c0@Inspiron> Message-ID: <47E92444.7000606@resolversystems.com> Gary, Ironclad has a mailing list where all updates are posted; it's pretty low traffic so you might want to join. You can sign up here: Regards, Giles Gary Kopp wrote: > > Thanks for the info, Curt. Stupid of me ? I didn?t even stop to think > about the issue of binary extensions. I absolutely need numpy! I?ll > track Ironclad?s progress now that you?ve made me aware of it. > Meanwhile, I?ll think about using Python.Net in the interim, and just > try to ?embed? NLTK (GIL and all) in my C# app. > > --Gary > > ------------------------------------------------------------------------ > > *From:* users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Curt > Hagenlocher > *Sent:* Monday, March 24, 2008 3:59 PM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] Sanity Check re. Legacy Python Code > > As I understand it, the goal of IronPython is to support the running > of that kind of application -- provided that it doesn't use any binary > extensions[1]. The NTLK webpage is a bit vague on that count, > suggesting that "some users may require" numpy and matplotlib. If > you're not one of "those users", you should give it a try! > > Of course, there's some chance that NLTK won't work correctly under > 2.0b1; your reports in that regard will help all of us by driving > IronPython closer to CPython compatibility. > > 1: but see also > http://ironpython-urls.blogspot.com/2008/02/ironclad-01-released.html > -- for which numpy support is an explicit goal > > On Mon, Mar 24, 2008 at 2:48 PM, Gary Kopp > wrote: > > Would I be correct in assuming that it is _not_ currently the intent that > IronPython run "arbitrary" existing Python code? I am interested in making > use of the Natural Language Toolkit (NLTK), a huge Python 2.5 application, > in a .NET environment. Clearly, the most powerful approach would be to use > IronPython, but I'm guessing (and please correct me if I'm wrong) that > current limitations in the IronPython 2.0b1 implementation are likely to > present many challenges in running/porting arbitrary "legacy" Python apps. > My purpose in writing this is simply to find out whether I should even > bother attempting such a feat. > > --Gary Kopp > > _______________________________________________ > 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 > -- Giles Thomas MD & CTO, Resolver Systems Ltd. giles.thomas at resolversystems.com +44 (0) 20 7253 6372 Try out Resolver One! (Free registration required) 17a Clerkenwell Road, London EC1M 5RD, UK VAT No.: GB 893 5643 79 Registered in England and Wales as company number 5467329. Registered address: 843 Finchley Road, London NW11 8NA, UK From dinov at exchange.microsoft.com Tue Mar 25 18:39:26 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Tue, 25 Mar 2008 10:39:26 -0700 Subject: [IronPython] Latest DLR Hosting Spec? In-Reply-To: References: Message-ID: <7AD436E4270DD54A94238001769C2227011D8112838A@DF-GRTDANE-MSG.exchange.corp.microsoft.com> I checked on this and it looks like we'll have a newer version sometime this week. I'll respond again when it's available. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher Sent: Monday, March 24, 2008 9:11 AM To: Discussion of IronPython Subject: [IronPython] Latest DLR Hosting Spec? Is the file at http://compilerlab.members.winisp.net/dlr-spec-hosting.pdf still the latest publically-available version of the spec? The PDF was created on Jan 3, 08 but otherwise contains no versioning information. -- Curt Hagenlocher curt at hagenlocher.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From sls at iinet.net.au Wed Mar 26 12:55:45 2008 From: sls at iinet.net.au (Paul Turbett) Date: Wed, 26 Mar 2008 20:55:45 +0900 Subject: [IronPython] Question about serialization In-Reply-To: <47E8FA22.2030407@voidspace.org.uk> References: <47E8F69A.5010205@iinet.net.au> <47E8FA22.2030407@voidspace.org.uk> Message-ID: <47EA39C1.6000202@iinet.net.au> Thanks Michael for the advice. Must appreciated. Unfortunately I hasn't worked out yet tho :( I can use pickle from C# using Evaluate, or from within a Python class, on a "pure" Python object. However any attempt at pickling a python object that derives from a C# base result in an exception like this: Cannot convert MyObject() to Int32 Exploring further, I came across Ops.GetDynamicType() and Ops.GetAttrsNames() which I thought might be helpful to get the attributes of an object and serialize it somehow (manually), but GetAttrNames requires an ICallerContext, and I can't see how to get one of those. It seems that whilst serializing .NET classes is trivial, and serializing python classes is trivial, serializing something that touches both is proving quite difficult. Any further suggestions gratefully received! Thanks, Paul Michael Foord wrote: > Paul Turbett wrote: > >> Hi, >> >> I'm using IP as a scripting engine in a C# app. I have various Python >> classes that derive from a C# base class, and have there own additional >> data & functionality. >> >> I would like to be able to serialize instances of the Python classes >> from the C# host for persistence across sessions. Using the standard >> BinaryFormatter with the Serializable attribute is not working - I get >> an error about the python class not being marked as serializable (the C# >> base class is marked as serializable though). >> >> How can I serialize python objects from C#? Should I use reflection to >> roll my own serializer, or is there something in one of the lesser >> documented assemblies like Ops I should use? >> >> > > Typically for serializing Python objects you would use pickle [1]. The > 'dumps' function returns a string (make sure you use the text protocol > for IronPython). > > You could then execute code inside the Python engine to serialize / > deserialize objects. I've not tried this for instances that inherit from > C# base classes - but it should work fine. :-) > > Michael Foord > http://www.ironpythoninaction.com > > .. [1] http://docs.python.org/lib/module-pickle.html > > >> I'm using IP 1.1.1 (but will move to 2.0 if that will help). Any >> pointers & advice greatly appreciated! >> >> Thanks, Paul >> _______________________________________________ >> 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 duncan.foster at gmail.com Wed Mar 26 13:02:58 2008 From: duncan.foster at gmail.com (Duncan Foster) Date: Wed, 26 Mar 2008 05:02:58 -0700 (PDT) Subject: [IronPython] SetSocketOption error on OSX Message-ID: <656deb36-f89a-4d9d-9a7f-62d655d5e9aa@t54g2000hsg.googlegroups.com> Hi, Motivated by the talks at PyCon I've started looking at ironPython. I've been trying to get some code that uses xmlrpclib working, but get: Traceback (most recent call last): File httplib, line unknown, in getreply File httplib, line unknown, in getresponse File httplib, line unknown, in __init__ File System, line unknown, in set_ReceiveBufferSize File System, line unknown, in SetSocketOption WindowsError: Invalid arguments I've tried both IronPython-1.1.1 & IPCE-r7 , and: myhost:~/IronPython dcf$ mono --version Mono JIT compiler version 1.9 (tarball) Copyright (C) 2002-2007 Novell, Inc and Contributors. www.mono-project.com TLS: normal GC: Included Boehm (with typed GC) SIGSEGV: normal Notification: Thread + polling Architecture: x86 Disabled: none Any help would be much appreciated! Thanks, Duncan From sanxiyn at gmail.com Wed Mar 26 13:55:48 2008 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Wed, 26 Mar 2008 21:55:48 +0900 Subject: [IronPython] SetSocketOption error on OSX In-Reply-To: <656deb36-f89a-4d9d-9a7f-62d655d5e9aa@t54g2000hsg.googlegroups.com> References: <656deb36-f89a-4d9d-9a7f-62d655d5e9aa@t54g2000hsg.googlegroups.com> Message-ID: <5b0248170803260555s599fd324wda7fb33bf18c6607@mail.gmail.com> 2008/3/26, Duncan Foster : > Traceback (most recent call last): > File httplib, line unknown, in getreply > File httplib, line unknown, in getresponse > File httplib, line unknown, in __init__ > File System, line unknown, in set_ReceiveBufferSize > File System, line unknown, in SetSocketOption > WindowsError: Invalid arguments This is likely to be a Mono bug, probably specific to Mac OS X. -- Seo Sanghyeon From bernd.viehmann at googlemail.com Wed Mar 26 16:04:00 2008 From: bernd.viehmann at googlemail.com (Bernd Viehmann) Date: Wed, 26 Mar 2008 16:04:00 +0100 Subject: [IronPython] deepcopy() in IRONPY Message-ID: Hi, i am news to this list, so let me give a short introduction of myself. My name is Bernd from Aachen in Germany (near the border to Netherlands and Belgium) and I am working with python for some time now. In the moment i am shifting some of my old python-scripts into ironpython because the "normal" python will not be installed on our 64bit windows servers. Ironpython as a Microsoft-product is more welcome in the eyes of our customer. So my (first) question regarding copy of object-instances: How can i use the copy-module-functionality in ipy? Is there something comparable in DOT.NET? Are a modern way to copy instance-data instead of references. Thank you very much and kind regards. Bernd -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Wed Mar 26 16:12:13 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Wed, 26 Mar 2008 08:12:13 -0700 Subject: [IronPython] deepcopy() in IRONPY In-Reply-To: References: Message-ID: On Wed, Mar 26, 2008 at 8:04 AM, Bernd Viehmann wrote: > > How can i use the copy-module-functionality in ipy? Have you tried just using the py files that ship with CPython? You can get a distribution of IronPython that incorporates these files from Seo's FePy project at http://fepy.sourceforge.net -- Curt Hagenlocher curt at hagenlocher.org From curt at hagenlocher.org Wed Mar 26 16:31:13 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Wed, 26 Mar 2008 08:31:13 -0700 Subject: [IronPython] Question about serialization In-Reply-To: <47EA39C1.6000202@iinet.net.au> References: <47E8F69A.5010205@iinet.net.au> <47E8FA22.2030407@voidspace.org.uk> <47EA39C1.6000202@iinet.net.au> Message-ID: This is an interesting problem. Python's pickle writes out enough data to rebuild the object entirely -- including the class definition, if the object is a user-defined type. How do you accurately write out a class definition for a C# base class? Would you restrict it to strongly named classes? On Wed, Mar 26, 2008 at 4:55 AM, Paul Turbett wrote: > Thanks Michael for the advice. Must appreciated. Unfortunately I hasn't > worked out yet tho :( > > I can use pickle from C# using Evaluate, or from within a Python class, on > a "pure" Python object. However any attempt at pickling a python object that > derives from a C# base result in an exception like this: > Cannot convert MyObject() to Int32 > > Exploring further, I came across Ops.GetDynamicType() and > Ops.GetAttrsNames() which I thought might be helpful to get the attributes > of an object and serialize it somehow (manually), but GetAttrNames requires > an ICallerContext, and I can't see how to get one of those. > > It seems that whilst serializing .NET classes is trivial, and serializing > python classes is trivial, serializing something that touches both is > proving quite difficult. > > Any further suggestions gratefully received! > > Thanks, Paul > > Michael Foord wrote: > > Paul Turbett wrote: > > > Hi, > > I'm using IP as a scripting engine in a C# app. I have various Python > classes that derive from a C# base class, and have there own additional > data & functionality. > > I would like to be able to serialize instances of the Python classes > from the C# host for persistence across sessions. Using the standard > BinaryFormatter with the Serializable attribute is not working - I get > an error about the python class not being marked as serializable (the C# > base class is marked as serializable though). > > How can I serialize python objects from C#? Should I use reflection to > roll my own serializer, or is there something in one of the lesser > documented assemblies like Ops I should use? > > > > Typically for serializing Python objects you would use pickle [1]. The > 'dumps' function returns a string (make sure you use the text protocol > for IronPython). > > You could then execute code inside the Python engine to serialize / > deserialize objects. I've not tried this for instances that inherit from > C# base classes - but it should work fine. :-) > > Michael Foordhttp://www.ironpythoninaction.com > > .. [1] http://docs.python.org/lib/module-pickle.html > > I'm using IP 1.1.1 (but will move to 2.0 if that will help). Any > pointers & advice greatly appreciated! > > Thanks, Paul > _______________________________________________ > Users mailing listUsers at lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > Users mailing listUsers at lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Wed Mar 26 16:36:26 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Wed, 26 Mar 2008 08:36:26 -0700 Subject: [IronPython] Question about serialization In-Reply-To: <47EA39C1.6000202@iinet.net.au> References: <47E8F69A.5010205@iinet.net.au> <47E8FA22.2030407@voidspace.org.uk> <47EA39C1.6000202@iinet.net.au> Message-ID: <7AD436E4270DD54A94238001769C2227011D811285FE@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Unfortunately I don't think what you want will work. If it's your .NET class you could implement __reduce_ex__ and I think we'd pick it up and use that for the serialization. But if it's some arbitrary framework class then you'll run into trouble. On IronPython 2.0 you could have an extension class w/ the __reduce_ex__ function, have an ExtensionTypeAttribute that links the .NET base class and the extension class, and then call RuntimeHelpers.RegisterAssembly and we'd pick up the extension method. Also, we do have a feature request for this on CodePlex: http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=13401 Voting on it would raise its priority and we'd be more likely to do it sooner rather than later. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Paul Turbett Sent: Wednesday, March 26, 2008 4:56 AM To: Discussion of IronPython Subject: Re: [IronPython] Question about serialization Thanks Michael for the advice. Must appreciated. Unfortunately I hasn't worked out yet tho :( I can use pickle from C# using Evaluate, or from within a Python class, on a "pure" Python object. However any attempt at pickling a python object that derives from a C# base result in an exception like this: Cannot convert MyObject() to Int32 Exploring further, I came across Ops.GetDynamicType() and Ops.GetAttrsNames() which I thought might be helpful to get the attributes of an object and serialize it somehow (manually), but GetAttrNames requires an ICallerContext, and I can't see how to get one of those. It seems that whilst serializing .NET classes is trivial, and serializing python classes is trivial, serializing something that touches both is proving quite difficult. Any further suggestions gratefully received! Thanks, Paul Michael Foord wrote: Paul Turbett wrote: Hi, I'm using IP as a scripting engine in a C# app. I have various Python classes that derive from a C# base class, and have there own additional data & functionality. I would like to be able to serialize instances of the Python classes from the C# host for persistence across sessions. Using the standard BinaryFormatter with the Serializable attribute is not working - I get an error about the python class not being marked as serializable (the C# base class is marked as serializable though). How can I serialize python objects from C#? Should I use reflection to roll my own serializer, or is there something in one of the lesser documented assemblies like Ops I should use? Typically for serializing Python objects you would use pickle [1]. The 'dumps' function returns a string (make sure you use the text protocol for IronPython). You could then execute code inside the Python engine to serialize / deserialize objects. I've not tried this for instances that inherit from C# base classes - but it should work fine. :-) Michael Foord http://www.ironpythoninaction.com .. [1] http://docs.python.org/lib/module-pickle.html I'm using IP 1.1.1 (but will move to 2.0 if that will help). Any pointers & advice greatly appreciated! Thanks, Paul _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Wed Mar 26 16:42:10 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Wed, 26 Mar 2008 08:42:10 -0700 Subject: [IronPython] Question about serialization In-Reply-To: References: <47E8F69A.5010205@iinet.net.au> <47E8FA22.2030407@voidspace.org.uk> <47EA39C1.6000202@iinet.net.au> Message-ID: <7AD436E4270DD54A94238001769C2227011D81128600@DF-GRTDANE-MSG.exchange.corp.microsoft.com> My guess is you'd restrict it only to .NET objects which are marked as being serializable. Then you'd ask the object to serialize it's self and then stuff that into the pickle stream along w/ the extra Python info. That's probably include a type name which you'd just load and see what you got - much like how cPickle does an import and uses what it gets when it's loading a global. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher Sent: Wednesday, March 26, 2008 8:31 AM To: Discussion of IronPython Subject: Re: [IronPython] Question about serialization This is an interesting problem. Python's pickle writes out enough data to rebuild the object entirely -- including the class definition, if the object is a user-defined type. How do you accurately write out a class definition for a C# base class? Would you restrict it to strongly named classes? On Wed, Mar 26, 2008 at 4:55 AM, Paul Turbett > wrote: Thanks Michael for the advice. Must appreciated. Unfortunately I hasn't worked out yet tho :( I can use pickle from C# using Evaluate, or from within a Python class, on a "pure" Python object. However any attempt at pickling a python object that derives from a C# base result in an exception like this: Cannot convert MyObject() to Int32 Exploring further, I came across Ops.GetDynamicType() and Ops.GetAttrsNames() which I thought might be helpful to get the attributes of an object and serialize it somehow (manually), but GetAttrNames requires an ICallerContext, and I can't see how to get one of those. It seems that whilst serializing .NET classes is trivial, and serializing python classes is trivial, serializing something that touches both is proving quite difficult. Any further suggestions gratefully received! Thanks, Paul Michael Foord wrote: Paul Turbett wrote: Hi, I'm using IP as a scripting engine in a C# app. I have various Python classes that derive from a C# base class, and have there own additional data & functionality. I would like to be able to serialize instances of the Python classes from the C# host for persistence across sessions. Using the standard BinaryFormatter with the Serializable attribute is not working - I get an error about the python class not being marked as serializable (the C# base class is marked as serializable though). How can I serialize python objects from C#? Should I use reflection to roll my own serializer, or is there something in one of the lesser documented assemblies like Ops I should use? Typically for serializing Python objects you would use pickle [1]. The 'dumps' function returns a string (make sure you use the text protocol for IronPython). You could then execute code inside the Python engine to serialize / deserialize objects. I've not tried this for instances that inherit from C# base classes - but it should work fine. :-) Michael Foord http://www.ironpythoninaction.com .. [1] http://docs.python.org/lib/module-pickle.html I'm using IP 1.1.1 (but will move to 2.0 if that will help). Any pointers & advice greatly appreciated! Thanks, Paul _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Wed Mar 26 16:50:38 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Wed, 26 Mar 2008 08:50:38 -0700 Subject: [IronPython] Question about serialization In-Reply-To: <7AD436E4270DD54A94238001769C2227011D811285FE@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <47E8F69A.5010205@iinet.net.au> <47E8FA22.2030407@voidspace.org.uk> <47EA39C1.6000202@iinet.net.au> <7AD436E4270DD54A94238001769C2227011D811285FE@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: Ooh, I was unaware of __reduce__ and __reduce_ex__; thanks. On Wed, Mar 26, 2008 at 8:36 AM, Dino Viehland wrote: > Unfortunately I don't think what you want will work. If it's your .NET > class you could implement __reduce_ex__ and I think we'd pick it up and use > that for the serialization. But if it's some arbitrary framework class then > you'll run into trouble. On IronPython 2.0 you could have an extension > class w/ the __reduce_ex__ function, have an ExtensionTypeAttribute that > links the .NET base class and the extension class, and then call > RuntimeHelpers.RegisterAssembly and we'd pick up the extension method. > > > > Also, we do have a feature request for this on CodePlex: > http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=13401 > Voting on it would raise its priority and we'd be more likely to do it > sooner rather than later. > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Paul Turbett > *Sent:* Wednesday, March 26, 2008 4:56 AM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] Question about serialization > > > > Thanks Michael for the advice. Must appreciated. Unfortunately I hasn't > worked out yet tho :( > > I can use pickle from C# using Evaluate, or from within a Python class, on > a "pure" Python object. However any attempt at pickling a python object that > derives from a C# base result in an exception like this: > Cannot convert MyObject() to Int32 > > Exploring further, I came across Ops.GetDynamicType() and > Ops.GetAttrsNames() which I thought might be helpful to get the attributes > of an object and serialize it somehow (manually), but GetAttrNames requires > an ICallerContext, and I can't see how to get one of those. > > It seems that whilst serializing .NET classes is trivial, and serializing > python classes is trivial, serializing something that touches both is > proving quite difficult. > > Any further suggestions gratefully received! > > Thanks, Paul > > Michael Foord wrote: > > Paul Turbett wrote: > > > > Hi, > > > > I'm using IP as a scripting engine in a C# app. I have various Python > > classes that derive from a C# base class, and have there own additional > > data & functionality. > > > > I would like to be able to serialize instances of the Python classes > > from the C# host for persistence across sessions. Using the standard > > BinaryFormatter with the Serializable attribute is not working - I get > > an error about the python class not being marked as serializable (the C# > > base class is marked as serializable though). > > > > How can I serialize python objects from C#? Should I use reflection to > > roll my own serializer, or is there something in one of the lesser > > documented assemblies like Ops I should use? > > > > > > > > Typically for serializing Python objects you would use pickle [1]. The > > 'dumps' function returns a string (make sure you use the text protocol > > for IronPython). > > > > You could then execute code inside the Python engine to serialize / > > deserialize objects. I've not tried this for instances that inherit from > > C# base classes - but it should work fine. :-) > > > > Michael Foord > > http://www.ironpythoninaction.com > > > > .. [1] http://docs.python.org/lib/module-pickle.html > > > > > > I'm using IP 1.1.1 (but will move to 2.0 if that will help). Any > > pointers & advice greatly appreciated! > > > > Thanks, Paul > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Wed Mar 26 17:37:42 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Wed, 26 Mar 2008 09:37:42 -0700 Subject: [IronPython] Question about serialization In-Reply-To: <7AD436E4270DD54A94238001769C2227011D81128600@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <47E8F69A.5010205@iinet.net.au> <47E8FA22.2030407@voidspace.org.uk> <47EA39C1.6000202@iinet.net.au> <7AD436E4270DD54A94238001769C2227011D81128600@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: I was thinking that Python's lack of a global namespace for classes would be a problem -- but of course it's not because you'd actually be looking in the CLR namespace. So you could just fail the deserialize if the CLR base class doesn't already exist. It would still be nice to be able to auto-load an assembly when the base class is strongly-named. On Wed, Mar 26, 2008 at 8:42 AM, Dino Viehland wrote: > My guess is you'd restrict it only to .NET objects which are marked as > being serializable. Then you'd ask the object to serialize it's self and > then stuff that into the pickle stream along w/ the extra Python info. > That's probably include a type name which you'd just load and see what you > got ? much like how cPickle does an import and uses what it gets when it's > loading a global. > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Curt Hagenlocher > *Sent:* Wednesday, March 26, 2008 8:31 AM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] Question about serialization > > > > This is an interesting problem. Python's pickle writes out enough data to > rebuild the object entirely -- including the class definition, if the object > is a user-defined type. How do you accurately write out a class definition > for a C# base class? Would you restrict it to strongly named classes? > > > > > On Wed, Mar 26, 2008 at 4:55 AM, Paul Turbett wrote: > > Thanks Michael for the advice. Must appreciated. Unfortunately I hasn't > worked out yet tho :( > > I can use pickle from C# using Evaluate, or from within a Python class, on > a "pure" Python object. However any attempt at pickling a python object that > derives from a C# base result in an exception like this: > Cannot convert MyObject() to Int32 > > Exploring further, I came across Ops.GetDynamicType() and > Ops.GetAttrsNames() which I thought might be helpful to get the attributes > of an object and serialize it somehow (manually), but GetAttrNames requires > an ICallerContext, and I can't see how to get one of those. > > It seems that whilst serializing .NET classes is trivial, and serializing > python classes is trivial, serializing something that touches both is > proving quite difficult. > > Any further suggestions gratefully received! > > Thanks, Paul > > Michael Foord wrote: > > Paul Turbett wrote: > > > > Hi, > > > > I'm using IP as a scripting engine in a C# app. I have various Python > > classes that derive from a C# base class, and have there own additional > > data & functionality. > > > > I would like to be able to serialize instances of the Python classes > > from the C# host for persistence across sessions. Using the standard > > BinaryFormatter with the Serializable attribute is not working - I get > > an error about the python class not being marked as serializable (the C# > > base class is marked as serializable though). > > > > How can I serialize python objects from C#? Should I use reflection to > > roll my own serializer, or is there something in one of the lesser > > documented assemblies like Ops I should use? > > > > > > Typically for serializing Python objects you would use pickle [1]. The > > 'dumps' function returns a string (make sure you use the text protocol > > for IronPython). > > > > You could then execute code inside the Python engine to serialize / > > deserialize objects. I've not tried this for instances that inherit from > > C# base classes - but it should work fine. :-) > > > > Michael Foord > > http://www.ironpythoninaction.com > > > > .. [1] http://docs.python.org/lib/module-pickle.html > > > > > > I'm using IP 1.1.1 (but will move to 2.0 if that will help). Any > > pointers & advice greatly appreciated! > > > > Thanks, Paul > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sanxiyn at gmail.com Wed Mar 26 18:25:54 2008 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Thu, 27 Mar 2008 02:25:54 +0900 Subject: [IronPython] Question about serialization In-Reply-To: <47EA39C1.6000202@iinet.net.au> References: <47E8F69A.5010205@iinet.net.au> <47E8FA22.2030407@voidspace.org.uk> <47EA39C1.6000202@iinet.net.au> Message-ID: <5b0248170803261025i35ae47c6x6131dfb16db9541d@mail.gmail.com> 2008/3/26, Paul Turbett : > It seems that whilst serializing .NET classes is trivial, and serializing > python classes is trivial, serializing something that touches both is > proving quite difficult. > > Any further suggestions gratefully received! I suggest using copy_reg to register .NET class to Python pickle mechanism. See: http://docs.python.org/lib/module-copyreg.html I actually implemented this back in the last year. http://lists.ironpython.com/pipermail/users-ironpython.com/2007-February/004509.html http://fepy.svn.sourceforge.net/svnroot/fepy/trunk/fepy/pickle.py -- Seo Sanghyeon From bernd.viehmann at googlemail.com Thu Mar 27 06:21:23 2008 From: bernd.viehmann at googlemail.com (Bernd Viehmann) Date: Thu, 27 Mar 2008 06:21:23 +0100 Subject: [IronPython] deepcopy() in IRONPY In-Reply-To: References: Message-ID: Hi Curt, thanks, but I am not allowed to install FePy on the Production-Server. So I need a solution with pure IronPython ;-). Regards Bernd 2008/3/26, Curt Hagenlocher : > > On Wed, Mar 26, 2008 at 8:04 AM, Bernd Viehmann > wrote: > > > > How can i use the copy-module-functionality in ipy? > > > Have you tried just using the py files that ship with CPython? > > You can get a distribution of IronPython that incorporates these files > from Seo's FePy project at http://fepy.sourceforge.net > > > -- > Curt Hagenlocher > curt at hagenlocher.org > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ironpython at programuok.com Thu Mar 27 07:23:09 2008 From: ironpython at programuok.com (Marius) Date: Thu, 27 Mar 2008 08:23:09 +0200 Subject: [IronPython] DLR: ActionBinder and ParseSourceCode Message-ID: <67b73e970803262323rec00f6cm13f99c36d6d4ced8@mail.gmail.com> Hi, I wonder if that's a bug or by design. Expression returned by Ast.Action.Operator(Operators.NotEquals, Ast.Null(), Ast.Null()) [which I believe is equivalent to null != null] evaluates to True, though False could be expected (overriding MakeRule for this special case does the trick). Having returned LambdaExpression from LanguageContext.ParseSourceCode which has return type of void, produces "System.InvalidProgramException : Common Language Runtime detected an invalid program", changing return type to object solves the problem. Marius From dblank at brynmawr.edu Thu Mar 27 11:46:33 2008 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Thu, 27 Mar 2008 06:46:33 -0400 (EDT) Subject: [IronPython] deepcopy() in IRONPY In-Reply-To: References: Message-ID: <60177.71.59.123.159.1206614793.squirrel@webmail.brynmawr.edu> On Thu, March 27, 2008 1:21 am, Bernd Viehmann said: > Hi Curt, > > thanks, but I am not allowed to install FePy on the Production-Server. So > I > need a solution with pure IronPython ;-). Bernd, AFAIK, you should try to get the CPython libraries installed with IronPython, otherwise you're missing functionality that you can use. Many of the CPython libraries are pure-Python, and can be used directly by IronPython. FePy also includes the CPython libraries, but that is independent of Mono/.NET issues. -Doug > Regards > > Bernd > > > 2008/3/26, Curt Hagenlocher : >> >> On Wed, Mar 26, 2008 at 8:04 AM, Bernd Viehmann >> wrote: >> > >> > How can i use the copy-module-functionality in ipy? >> >> >> Have you tried just using the py files that ship with CPython? >> >> You can get a distribution of IronPython that incorporates these files >> from Seo's FePy project at http://fepy.sourceforge.net >> >> >> -- >> Curt Hagenlocher >> curt at hagenlocher.org >> _______________________________________________ >> 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 > -- Douglas S. Blank Associate Professor, Bryn Mawr College http://cs.brynmawr.edu/~dblank/ Office: 610 526 6501 From sls at iinet.net.au Thu Mar 27 13:10:45 2008 From: sls at iinet.net.au (Paul Turbett) Date: Thu, 27 Mar 2008 21:10:45 +0900 Subject: [IronPython] Question about serialization In-Reply-To: <5b0248170803261025i35ae47c6x6131dfb16db9541d@mail.gmail.com> References: <47E8F69A.5010205@iinet.net.au> <47E8FA22.2030407@voidspace.org.uk> <47EA39C1.6000202@iinet.net.au> <5b0248170803261025i35ae47c6x6131dfb16db9541d@mail.gmail.com> Message-ID: <47EB8EC5.4050003@iinet.net.au> Thanks for the suggestion, unfortunately, again, no dice. It seems there is no way to serialize an IP object that derives from a .NET base class. Even though the base class is marked as serializable, I still get an error about the derived class not being marked as serializable when I use the fepy pickle. I'd be interested to trying using the DLR hosting mechanism...does anybody know of any docs about upgrading from IP 1.x to IP 2 script hosting? Thanks, Paul Sanghyeon Seo wrote: > 2008/3/26, Paul Turbett : > >> It seems that whilst serializing .NET classes is trivial, and serializing >> python classes is trivial, serializing something that touches both is >> proving quite difficult. >> >> Any further suggestions gratefully received! >> > > I suggest using copy_reg to register .NET class to Python pickle mechanism. > See: http://docs.python.org/lib/module-copyreg.html > > I actually implemented this back in the last year. > http://lists.ironpython.com/pipermail/users-ironpython.com/2007-February/004509.html > http://fepy.svn.sourceforge.net/svnroot/fepy/trunk/fepy/pickle.py > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Thu Mar 27 13:58:01 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Thu, 27 Mar 2008 12:58:01 +0000 Subject: [IronPython] deepcopy() in IRONPY In-Reply-To: References: Message-ID: <47EB99D9.5040706@voidspace.org.uk> Bernd Viehmann wrote: > Hi Curt, > > thanks, but I am not allowed to install FePy on the Production-Server. > So I need a solution with pure IronPython ;-). The CPython standard library, most of which works with IronPython, is just a bunch of Python files - which you could justifiably argue are part of your application. (The ones that work are pure Python - i.e. pure IronPython.) You cn just put them in a directory and then either point to that directory with the IRONPYTHONPATH environment variable, or add 'sys.path.append(direcotry_name)' at the start of your application. This will allow you to use modules like 'copy'. Michael Foord http://www.ironpythoninaction.com > > Regards > > Bernd > > > 2008/3/26, Curt Hagenlocher >: > > On Wed, Mar 26, 2008 at 8:04 AM, Bernd Viehmann > > wrote: > > > > How can i use the copy-module-functionality in ipy? > > > Have you tried just using the py files that ship with CPython? > > You can get a distribution of IronPython that incorporates these files > from Seo's FePy project at http://fepy.sourceforge.net > > > -- > Curt Hagenlocher > curt at hagenlocher.org > _______________________________________________ > 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 dfugate at microsoft.com Thu Mar 27 17:56:29 2008 From: dfugate at microsoft.com (Dave Fugate) Date: Thu, 27 Mar 2008 09:56:29 -0700 Subject: [IronPython] deepcopy() in IRONPY In-Reply-To: References: Message-ID: <7346A825E148B049A9AD1D3ED46A2D91259F381A62@NA-EXMSG-C106.redmond.corp.microsoft.com> We sort of have a similar problem with respect to IronPython tests - the tests we ship on CodePlex need to run without dependencies on standard CPython libraries. What we did for the case of the 'copy' module was to reimplement the functionality needed in pure Python. For example, a naive implementation of copy.deepcopy might look like the following: def copy(y): if type(y)!=list: return y ret_val = list(y) return [deepcopy(x) for x in ret_val] Hope that helps! From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Bernd Viehmann Sent: Wednesday, March 26, 2008 10:21 PM To: Discussion of IronPython Subject: Re: [IronPython] deepcopy() in IRONPY Hi Curt, thanks, but I am not allowed to install FePy on the Production-Server. So I need a solution with pure IronPython ;-). Regards Bernd 2008/3/26, Curt Hagenlocher >: On Wed, Mar 26, 2008 at 8:04 AM, Bernd Viehmann > wrote: > > How can i use the copy-module-functionality in ipy? Have you tried just using the py files that ship with CPython? You can get a distribution of IronPython that incorporates these files from Seo's FePy project at http://fepy.sourceforge.net -- Curt Hagenlocher curt at hagenlocher.org _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From dfugate at microsoft.com Thu Mar 27 18:08:47 2008 From: dfugate at microsoft.com (Dave Fugate) Date: Thu, 27 Mar 2008 10:08:47 -0700 Subject: [IronPython] deepcopy() in IRONPY In-Reply-To: <7346A825E148B049A9AD1D3ED46A2D91259F381A62@NA-EXMSG-C106.redmond.corp.microsoft.com> References: <7346A825E148B049A9AD1D3ED46A2D91259F381A62@NA-EXMSG-C106.redmond.corp.microsoft.com> Message-ID: <7346A825E148B049A9AD1D3ED46A2D91259F381A72@NA-EXMSG-C106.redmond.corp.microsoft.com> If you replace 'deepcopy(x)' with 'copy(x)' below it should work:) From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dave Fugate Sent: Thursday, March 27, 2008 9:56 AM To: Discussion of IronPython Subject: Re: [IronPython] deepcopy() in IRONPY We sort of have a similar problem with respect to IronPython tests - the tests we ship on CodePlex need to run without dependencies on standard CPython libraries. What we did for the case of the 'copy' module was to reimplement the functionality needed in pure Python. For example, a naive implementation of copy.deepcopy might look like the following: def copy(y): if type(y)!=list: return y ret_val = list(y) return [deepcopy(x) for x in ret_val] Hope that helps! From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Bernd Viehmann Sent: Wednesday, March 26, 2008 10:21 PM To: Discussion of IronPython Subject: Re: [IronPython] deepcopy() in IRONPY Hi Curt, thanks, but I am not allowed to install FePy on the Production-Server. So I need a solution with pure IronPython ;-). Regards Bernd 2008/3/26, Curt Hagenlocher >: On Wed, Mar 26, 2008 at 8:04 AM, Bernd Viehmann > wrote: > > How can i use the copy-module-functionality in ipy? Have you tried just using the py files that ship with CPython? You can get a distribution of IronPython that incorporates these files from Seo's FePy project at http://fepy.sourceforge.net -- Curt Hagenlocher curt at hagenlocher.org _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From cummings.michael at gmail.com Thu Mar 27 20:01:19 2008 From: cummings.michael at gmail.com (Michael Cummings) Date: Thu, 27 Mar 2008 15:01:19 -0400 Subject: [IronPython] DLR Hosting Question Message-ID: Hi all, I'm putting together a seminar at our local Code Camp for hosting the DLR and integration with applications. The hosting spec pdf is great however I do have (at least) one question that isn't explained very well in the doc. How can I restrict what assemblies can be loaded by a ScriptScope? To explain further: If I use the following code to load a py script file ScriptRuntime env = ScriptRuntime.Create(); ScriptEngine eng = env.GetEngineByFileExtension( "py" ); ScriptSource source = eng.CreateScriptSourceFromString( form.Source, SourceCodeKind.File ); source.Execute(); Where form.Source is a string containing this : import sys import clr clr.AddReference("System.Windows.Forms") clr.AddReference("System") clr.AddReference("Microsoft.Xna.Framework") clr.AddReference("Microsoft.Xna.Framework.Graphics") clr.AddReference("Microsoft.Xna.Framework.Input") clr.AddReference("Bnoerj.AI.Steering.Demo.Plugins.Ctf") from Bnoerj.AI.Steering.Demo.Plugins.Ctf import CtfBase, Globals class CtfPythonSeeker(CtfBase): def __init__(self): Reset() def Reset(self): Globals.Instance.Seeker = self How can I prevent some references from being referenced, like " Microsoft.Xna.Framework" but allow "Bnoerj.AI.Steering.Demo.Plugins.Ctf"? Thanks in advance Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Fri Mar 28 01:50:45 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Thu, 27 Mar 2008 17:50:45 -0700 Subject: [IronPython] DLR Hosting Question In-Reply-To: References: Message-ID: <7AD436E4270DD54A94238001769C2227011D816E62DE@DF-GRTDANE-MSG.exchange.corp.microsoft.com> There's no way to currently do this from the DLR and I suspect it's beyond the scope of both the DLR and IronPython. What you might be able to do is create an AppDomain with limited permissions and therefore prevent the loading of assemblies at the lower level. Once you've done that the DLR hosting APIs have support for loading them in a remote app domain. The reason why we wouldn't do this directly is it's very hard to prevent access. Once you can do import clr you can do: clr.GetClrType(str).Assembly.System.Reflection.Assembly.Load(...) and there's likely other ways to get around any walls we could put up (e.g. 'abc'.GetType().Assembly... not to mention any othe APIs that could return types). From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Cummings Sent: Thursday, March 27, 2008 12:01 PM To: Discussion of IronPython Subject: [IronPython] DLR Hosting Question Hi all, I'm putting together a seminar at our local Code Camp for hosting the DLR and integration with applications. The hosting spec pdf is great however I do have (at least) one question that isn't explained very well in the doc. How can I restrict what assemblies can be loaded by a ScriptScope? To explain further: If I use the following code to load a py script file ScriptRuntime env = ScriptRuntime.Create(); ScriptEngine eng = env.GetEngineByFileExtension( "py" ); ScriptSource source = eng.CreateScriptSourceFromString( form.Source, SourceCodeKind.File ); source.Execute(); Where form.Source is a string containing this : import sys import clr clr.AddReference("System.Windows.Forms") clr.AddReference("System") clr.AddReference("Microsoft.Xna.Framework") clr.AddReference("Microsoft.Xna.Framework.Graphics") clr.AddReference("Microsoft.Xna.Framework.Input") clr.AddReference("Bnoerj.AI.Steering.Demo.Plugins.Ctf") from Bnoerj.AI.Steering.Demo.Plugins.Ctf import CtfBase, Globals class CtfPythonSeeker(CtfBase): def __init__(self): Reset() def Reset(self): Globals.Instance.Seeker = self How can I prevent some references from being referenced, like "Microsoft.Xna.Framework" but allow "Bnoerj.AI.Steering.Demo.Plugins.Ctf"? Thanks in advance Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From bernd.viehmann at googlemail.com Fri Mar 28 12:31:37 2008 From: bernd.viehmann at googlemail.com (Bernd Viehmann) Date: Fri, 28 Mar 2008 12:31:37 +0100 Subject: [IronPython] deepcopy() in IRONPY In-Reply-To: <7346A825E148B049A9AD1D3ED46A2D91259F381A72@NA-EXMSG-C106.redmond.corp.microsoft.com> References: <7346A825E148B049A9AD1D3ED46A2D91259F381A62@NA-EXMSG-C106.redmond.corp.microsoft.com> <7346A825E148B049A9AD1D3ED46A2D91259F381A72@NA-EXMSG-C106.redmond.corp.microsoft.com> Message-ID: Thanks much for the answers. The own implementation of copy is the best solution for me. It works. But allow me one question regarding the usage of "standard" CPython modules. Who can i use them when using the IronPython-Studio? Haven't found any config-items inside yet. Thank you and regards Bernd 2008/3/27, Dave Fugate : > > If you replace 'deepcopy(x)' with 'copy(x)' below it should workJ > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Dave Fugate > *Sent:* Thursday, March 27, 2008 9:56 AM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] deepcopy() in IRONPY > > > > We sort of have a similar problem with respect to IronPython tests ? the > tests we ship on CodePlex need to run without dependencies on standard > CPython libraries. What we did for the case of the 'copy' module was to > reimplement the functionality needed in pure Python. For example, a naive > implementation of copy.deepcopy might look like the following: > > def copy(y): > > if type(y)!=list: > > return y > > ret_val = list(y) > > return [deepcopy(x) for x in ret_val] > > > > Hope that helps! > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Bernd Viehmann > *Sent:* Wednesday, March 26, 2008 10:21 PM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] deepcopy() in IRONPY > > > > Hi Curt, > > thanks, but I am not allowed to install FePy on the Production-Server. So > I need a solution with pure IronPython ;-). > > Regards > > Bernd > > 2008/3/26, Curt Hagenlocher : > > On Wed, Mar 26, 2008 at 8:04 AM, Bernd Viehmann > wrote: > > > > How can i use the copy-module-functionality in ipy? > > > Have you tried just using the py files that ship with CPython? > > You can get a distribution of IronPython that incorporates these files > from Seo's FePy project at http://fepy.sourceforge.net > > > -- > Curt Hagenlocher > curt at hagenlocher.org > _______________________________________________ > 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 bernd.viehmann at googlemail.com Fri Mar 28 12:31:37 2008 From: bernd.viehmann at googlemail.com (Bernd Viehmann) Date: Fri, 28 Mar 2008 12:31:37 +0100 Subject: [IronPython] deepcopy() in IRONPY In-Reply-To: <7346A825E148B049A9AD1D3ED46A2D91259F381A72@NA-EXMSG-C106.redmond.corp.microsoft.com> References: <7346A825E148B049A9AD1D3ED46A2D91259F381A62@NA-EXMSG-C106.redmond.corp.microsoft.com> <7346A825E148B049A9AD1D3ED46A2D91259F381A72@NA-EXMSG-C106.redmond.corp.microsoft.com> Message-ID: Thanks much for the answers. The own implementation of copy is the best solution for me. It works. But allow me one question regarding the usage of "standard" CPython modules. Who can i use them when using the IronPython-Studio? Haven't found any config-items inside yet. Thank you and regards Bernd 2008/3/27, Dave Fugate : > > If you replace 'deepcopy(x)' with 'copy(x)' below it should workJ > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Dave Fugate > *Sent:* Thursday, March 27, 2008 9:56 AM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] deepcopy() in IRONPY > > > > We sort of have a similar problem with respect to IronPython tests ? the > tests we ship on CodePlex need to run without dependencies on standard > CPython libraries. What we did for the case of the 'copy' module was to > reimplement the functionality needed in pure Python. For example, a naive > implementation of copy.deepcopy might look like the following: > > def copy(y): > > if type(y)!=list: > > return y > > ret_val = list(y) > > return [deepcopy(x) for x in ret_val] > > > > Hope that helps! > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Bernd Viehmann > *Sent:* Wednesday, March 26, 2008 10:21 PM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] deepcopy() in IRONPY > > > > Hi Curt, > > thanks, but I am not allowed to install FePy on the Production-Server. So > I need a solution with pure IronPython ;-). > > Regards > > Bernd > > 2008/3/26, Curt Hagenlocher : > > On Wed, Mar 26, 2008 at 8:04 AM, Bernd Viehmann > wrote: > > > > How can i use the copy-module-functionality in ipy? > > > Have you tried just using the py files that ship with CPython? > > You can get a distribution of IronPython that incorporates these files > from Seo's FePy project at http://fepy.sourceforge.net > > > -- > Curt Hagenlocher > curt at hagenlocher.org > _______________________________________________ > 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 rpigneri at LavaStorm.com Fri Mar 28 15:39:37 2008 From: rpigneri at LavaStorm.com (Pigneri, Rocco) Date: Fri, 28 Mar 2008 10:39:37 -0400 Subject: [IronPython] deepcopy() in IRONPY In-Reply-To: References: <7346A825E148B049A9AD1D3ED46A2D91259F381A62@NA-EXMSG-C106.redmond.corp.microsoft.com><7346A825E148B049A9AD1D3ED46A2D91259F381A72@NA-EXMSG-C106.redmond.corp.microsoft.com> Message-ID: Bernd, I played around with this a lot myself when I was using IPS. The only solution I could find was to add an import statement to the top of any file in which I wanted to use that code. The concept of building a "reference" as in C# is not yet supported in IPS. I seem to recall being told that if you need to, you can also add paths to sys.path in order to add things that are not in standard Python paths; however, I myself haven't done this as I think that IPS just adds the regular Python paths that it finds. Hope that helps, Rocco ________________________________ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Bernd Viehmann Sent: Friday, March 28, 2008 7:32 AM To: Discussion of IronPython Subject: Re: [IronPython] deepcopy() in IRONPY Thanks much for the answers. The own implementation of copy is the best solution for me. It works. But allow me one question regarding the usage of "standard" CPython modules. Who can i use them when using the IronPython-Studio? Haven't found any config-items inside yet. Thank you and regards Bernd 2008/3/27, Dave Fugate : If you replace 'deepcopy(x)' with 'copy(x)' below it should workJ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dave Fugate Sent: Thursday, March 27, 2008 9:56 AM To: Discussion of IronPython Subject: Re: [IronPython] deepcopy() in IRONPY We sort of have a similar problem with respect to IronPython tests - the tests we ship on CodePlex need to run without dependencies on standard CPython libraries. What we did for the case of the 'copy' module was to reimplement the functionality needed in pure Python. For example, a naive implementation of copy.deepcopy might look like the following: def copy(y): if type(y)!=list: return y ret_val = list(y) return [deepcopy(x) for x in ret_val] Hope that helps! From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Bernd Viehmann Sent: Wednesday, March 26, 2008 10:21 PM To: Discussion of IronPython Subject: Re: [IronPython] deepcopy() in IRONPY Hi Curt, thanks, but I am not allowed to install FePy on the Production-Server. So I need a solution with pure IronPython ;-). Regards Bernd 2008/3/26, Curt Hagenlocher : On Wed, Mar 26, 2008 at 8:04 AM, Bernd Viehmann wrote: > > How can i use the copy-module-functionality in ipy? Have you tried just using the py files that ship with CPython? You can get a distribution of IronPython that incorporates these files from Seo's FePy project at http://fepy.sourceforge.net -- Curt Hagenlocher curt at hagenlocher.org _______________________________________________ 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 cummings.michael at gmail.com Fri Mar 28 17:46:13 2008 From: cummings.michael at gmail.com (Michael Cummings) Date: Fri, 28 Mar 2008 12:46:13 -0400 Subject: [IronPython] DLR Hosting Question In-Reply-To: <7AD436E4270DD54A94238001769C2227011D816E62DE@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <7AD436E4270DD54A94238001769C2227011D816E62DE@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: I was afraid of that. So, if I am reading your response correctly... I can from my Apps AppDomain ( Primary ) create a second AppDomain ( Secondary ) which has limited permissions, specifically for me loading assemblies. I can then use the DLR in the Secondary AppDomain and use the DLR API to load the Assemblies I want. That about sum it up. I know that there may be ways around it, I'm just trying to be secure enough at this point. Thanks, Michael On Thu, Mar 27, 2008 at 8:50 PM, Dino Viehland wrote: > There's no way to currently do this from the DLR and I suspect it's > beyond the scope of both the DLR and IronPython. What you might be able to > do is create an AppDomain with limited permissions and therefore prevent the > loading of assemblies at the lower level. Once you've done that the DLR > hosting APIs have support for loading them in a remote app domain. > > > > The reason why we wouldn't do this directly is it's very hard to prevent > access. Once you can do import clr you can do: > > > > clr.GetClrType(str).Assembly.System.Reflection.Assembly.Load(?) > > > > and there's likely other ways to get around any walls we could put up (e.g. > 'abc'.GetType().Assembly? not to mention any othe APIs that could return > types). > > > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Michael Cummings > *Sent:* Thursday, March 27, 2008 12:01 PM > *To:* Discussion of IronPython > *Subject:* [IronPython] DLR Hosting Question > > > > Hi all, > I'm putting together a seminar at our local Code Camp for hosting the > DLR and integration with applications. The hosting spec pdf is great however > I do have (at least) one question that isn't explained very well in the doc. > How can I restrict what assemblies can be loaded by a ScriptScope? To > explain further: If I use the following code to load a py script file > > ScriptRuntime env = ScriptRuntime.Create(); > ScriptEngine eng = env.GetEngineByFileExtension( "py" ); > > ScriptSource source = eng.CreateScriptSourceFromString( > form.Source, SourceCodeKind.File ); > > source.Execute(); > > Where form.Source is a string containing this : > > import sys > > import clr > clr.AddReference("System.Windows.Forms") > clr.AddReference("System") > clr.AddReference("Microsoft.Xna.Framework") > clr.AddReference("Microsoft.Xna.Framework.Graphics") > clr.AddReference("Microsoft.Xna.Framework.Input") > clr.AddReference("Bnoerj.AI.Steering.Demo.Plugins.Ctf") > > from Bnoerj.AI.Steering.Demo.Plugins.Ctf import CtfBase, Globals > > class CtfPythonSeeker(CtfBase): > > def __init__(self): > Reset() > > def Reset(self): > Globals.Instance.Seeker = self > > How can I prevent some references from being referenced, like " > Microsoft.Xna.Framework" but allow "Bnoerj.AI.Steering.Demo.Plugins.Ctf"? > > Thanks in advance > > Michael > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Fri Mar 28 22:32:49 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Fri, 28 Mar 2008 14:32:49 -0700 Subject: [IronPython] DLR Hosting Question In-Reply-To: References: <7AD436E4270DD54A94238001769C2227011D816E62DE@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <7AD436E4270DD54A94238001769C2227011D816E6481@DF-GRTDANE-MSG.exchange.corp.microsoft.com> That's the theory - unfortunately I'm not sure exactly what knobs to twist in the CLR to accomplish it though. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Cummings Sent: Friday, March 28, 2008 9:46 AM To: Discussion of IronPython Subject: Re: [IronPython] DLR Hosting Question I was afraid of that. So, if I am reading your response correctly... I can from my Apps AppDomain ( Primary ) create a second AppDomain ( Secondary ) which has limited permissions, specifically for me loading assemblies. I can then use the DLR in the Secondary AppDomain and use the DLR API to load the Assemblies I want. That about sum it up. I know that there may be ways around it, I'm just trying to be secure enough at this point. Thanks, Michael On Thu, Mar 27, 2008 at 8:50 PM, Dino Viehland > wrote: There's no way to currently do this from the DLR and I suspect it's beyond the scope of both the DLR and IronPython. What you might be able to do is create an AppDomain with limited permissions and therefore prevent the loading of assemblies at the lower level. Once you've done that the DLR hosting APIs have support for loading them in a remote app domain. The reason why we wouldn't do this directly is it's very hard to prevent access. Once you can do import clr you can do: clr.GetClrType(str).Assembly.System.Reflection.Assembly.Load(...) and there's likely other ways to get around any walls we could put up (e.g. 'abc'.GetType().Assembly... not to mention any othe APIs that could return types). From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Cummings Sent: Thursday, March 27, 2008 12:01 PM To: Discussion of IronPython Subject: [IronPython] DLR Hosting Question Hi all, I'm putting together a seminar at our local Code Camp for hosting the DLR and integration with applications. The hosting spec pdf is great however I do have (at least) one question that isn't explained very well in the doc. How can I restrict what assemblies can be loaded by a ScriptScope? To explain further: If I use the following code to load a py script file ScriptRuntime env = ScriptRuntime.Create(); ScriptEngine eng = env.GetEngineByFileExtension( "py" ); ScriptSource source = eng.CreateScriptSourceFromString( form.Source, SourceCodeKind.File ); source.Execute(); Where form.Source is a string containing this : import sys import clr clr.AddReference("System.Windows.Forms") clr.AddReference("System") clr.AddReference("Microsoft.Xna.Framework") clr.AddReference("Microsoft.Xna.Framework.Graphics") clr.AddReference("Microsoft.Xna.Framework.Input") clr.AddReference("Bnoerj.AI.Steering.Demo.Plugins.Ctf") from Bnoerj.AI.Steering.Demo.Plugins.Ctf import CtfBase, Globals class CtfPythonSeeker(CtfBase): def __init__(self): Reset() def Reset(self): Globals.Instance.Seeker = self How can I prevent some references from being referenced, like "Microsoft.Xna.Framework" but allow "Bnoerj.AI.Steering.Demo.Plugins.Ctf"? Thanks in advance Michael _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Harry.Pierson at microsoft.com Fri Mar 28 23:57:12 2008 From: Harry.Pierson at microsoft.com (Harry Pierson) Date: Fri, 28 Mar 2008 15:57:12 -0700 Subject: [IronPython] DLR Hosting Question In-Reply-To: <7AD436E4270DD54A94238001769C2227011D816E6481@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <7AD436E4270DD54A94238001769C2227011D816E62DE@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <7AD436E4270DD54A94238001769C2227011D816E6481@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: I'd recommend "Customizing the Microsoft(r) .NET Framework Common Language Runtime" (http://www.microsoft.com/MSPress/books/6895.aspx ) for learning about the specific CLR knobs to twist in this scenario. Harry From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: Friday, March 28, 2008 2:33 PM To: Discussion of IronPython Subject: Re: [IronPython] DLR Hosting Question That's the theory - unfortunately I'm not sure exactly what knobs to twist in the CLR to accomplish it though. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Cummings Sent: Friday, March 28, 2008 9:46 AM To: Discussion of IronPython Subject: Re: [IronPython] DLR Hosting Question I was afraid of that. So, if I am reading your response correctly... I can from my Apps AppDomain ( Primary ) create a second AppDomain ( Secondary ) which has limited permissions, specifically for me loading assemblies. I can then use the DLR in the Secondary AppDomain and use the DLR API to load the Assemblies I want. That about sum it up. I know that there may be ways around it, I'm just trying to be secure enough at this point. Thanks, Michael On Thu, Mar 27, 2008 at 8:50 PM, Dino Viehland > wrote: There's no way to currently do this from the DLR and I suspect it's beyond the scope of both the DLR and IronPython. What you might be able to do is create an AppDomain with limited permissions and therefore prevent the loading of assemblies at the lower level. Once you've done that the DLR hosting APIs have support for loading them in a remote app domain. The reason why we wouldn't do this directly is it's very hard to prevent access. Once you can do import clr you can do: clr.GetClrType(str).Assembly.System.Reflection.Assembly.Load(...) and there's likely other ways to get around any walls we could put up (e.g. 'abc'.GetType().Assembly... not to mention any othe APIs that could return types). From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Cummings Sent: Thursday, March 27, 2008 12:01 PM To: Discussion of IronPython Subject: [IronPython] DLR Hosting Question Hi all, I'm putting together a seminar at our local Code Camp for hosting the DLR and integration with applications. The hosting spec pdf is great however I do have (at least) one question that isn't explained very well in the doc. How can I restrict what assemblies can be loaded by a ScriptScope? To explain further: If I use the following code to load a py script file ScriptRuntime env = ScriptRuntime.Create(); ScriptEngine eng = env.GetEngineByFileExtension( "py" ); ScriptSource source = eng.CreateScriptSourceFromString( form.Source, SourceCodeKind.File ); source.Execute(); Where form.Source is a string containing this : import sys import clr clr.AddReference("System.Windows.Forms") clr.AddReference("System") clr.AddReference("Microsoft.Xna.Framework") clr.AddReference("Microsoft.Xna.Framework.Graphics") clr.AddReference("Microsoft.Xna.Framework.Input") clr.AddReference("Bnoerj.AI.Steering.Demo.Plugins.Ctf") from Bnoerj.AI.Steering.Demo.Plugins.Ctf import CtfBase, Globals class CtfPythonSeeker(CtfBase): def __init__(self): Reset() def Reset(self): Globals.Instance.Seeker = self How can I prevent some references from being referenced, like "Microsoft.Xna.Framework" but allow "Bnoerj.AI.Steering.Demo.Plugins.Ctf"? Thanks in advance Michael _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Sat Mar 29 14:49:50 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sat, 29 Mar 2008 06:49:50 -0700 Subject: [IronPython] Accessing search path through ScriptEngine Message-ID: The script engine allows you to set the search path by calling ScriptEngine.SetScriptSourceSearchPaths, but it neither lets you query the existing path nor amend it -- just set it outright. Is this intentional? -- Curt Hagenlocher curt at hagenlocher.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Sat Mar 29 18:00:52 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sat, 29 Mar 2008 17:00:52 +0000 Subject: [IronPython] IP 2 Hosting Message-ID: <47EE75C4.6050209@voidspace.org.uk> Hello guys, I'm trying to do some simple examples of hosting with IronPython 2. Boy you made things more complicated than IronPython 1. :-) Unfortunately the DLR hosting spec document is out of date. I have a couple of questions (but will keep exploring). The simplest use case is just to evaluate an expression and return a result. The hosting spec document mention 'ScriptRuntime.Execute(text)'. This may or may not be the right way to evaluate an expression, but in any case it has been removed. An alternative is: engine = PythonEngine.CurrentEngine # a ScriptEngine unit = engine.CreateSourceUnitFromString(code, id) result = unit.Execute() Which is straightforward enough, however I can't see a way to set TrueDivision using this technique. (What is the 'id' by the way?) I can see that TrueDivision is a setting on IronPython.Runtime.ModuleOptions and IronPython.Runtime.PythonModule. Can I set this on the engine somehow? All the alternative seem to lead down a rabbit warren of 'create this object - which requires this object - which you construct from another object - which...'. I don't know which path to follow down the rabbit hole... :-) Any suggestions to save me from madness? Michael From curt at hagenlocher.org Sat Mar 29 18:23:43 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sat, 29 Mar 2008 10:23:43 -0700 Subject: [IronPython] IP 2 Hosting In-Reply-To: <47EE75C4.6050209@voidspace.org.uk> References: <47EE75C4.6050209@voidspace.org.uk> Message-ID: Some of those look like names from A9, which have changed in B1. The easiest way to evaluate an expression from scratch seems to be as follows: ScriptEngine engine = ScriptRuntime.Create().GetEngine("py"); ScriptScope scope = engine.CreateScope(); ScriptSource source = engine.CreateScriptSourceFromString("1 + 1", SourceCodeKind.Expression); int result = source.Execute(scope); On Sat, Mar 29, 2008 at 10:00 AM, Michael Foord wrote: > Hello guys, > > I'm trying to do some simple examples of hosting with IronPython 2. Boy > you made things more complicated than IronPython 1. :-) > > Unfortunately the DLR hosting spec document is out of date. I have a > couple of questions (but will keep exploring). > > The simplest use case is just to evaluate an expression and return a > result. > > The hosting spec document mention 'ScriptRuntime.Execute(text)'. This > may or may not be the right way to evaluate an expression, but in any > case it has been removed. > > An alternative is: > > engine = PythonEngine.CurrentEngine # a ScriptEngine > unit = engine.CreateSourceUnitFromString(code, id) > result = unit.Execute() > > Which is straightforward enough, however I can't see a way to set > TrueDivision using this technique. (What is the 'id' by the way?) > > I can see that TrueDivision is a setting on > IronPython.Runtime.ModuleOptions and IronPython.Runtime.PythonModule. > Can I set this on the engine somehow? > > All the alternative seem to lead down a rabbit warren of 'create this > object - which requires this object - which you construct from another > object - which...'. I don't know which path to follow down the rabbit > hole... > > :-) > > Any suggestions to save me from madness? > > Michael > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Sat Mar 29 18:32:15 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sat, 29 Mar 2008 17:32:15 +0000 Subject: [IronPython] IP 2 Hosting In-Reply-To: References: <47EE75C4.6050209@voidspace.org.uk> Message-ID: <47EE7D1F.2020008@voidspace.org.uk> Curt Hagenlocher wrote: > Some of those look like names from A9, which have changed in B1. I'm using B1. I expect they'll change in the next release though. *sigh* ;-) In the old days a beta used to mean the API was fixed and it was only bugfixes that would go in... <0.5 wink> Michael > > The easiest way to evaluate an expression from scratch seems to be as > follows: > > ScriptEngine engine = ScriptRuntime.Create().GetEngine("py"); > ScriptScope scope = engine.CreateScope(); > ScriptSource source = engine.CreateScriptSourceFromString("1 + 1", > SourceCodeKind.Expression); > int result = source.Execute(scope); > > On Sat, Mar 29, 2008 at 10:00 AM, Michael Foord > > wrote: > > Hello guys, > > I'm trying to do some simple examples of hosting with IronPython > 2. Boy > you made things more complicated than IronPython 1. :-) > > Unfortunately the DLR hosting spec document is out of date. I have a > couple of questions (but will keep exploring). > > The simplest use case is just to evaluate an expression and return > a result. > > The hosting spec document mention 'ScriptRuntime.Execute(text)'. This > may or may not be the right way to evaluate an expression, but in any > case it has been removed. > > An alternative is: > > engine = PythonEngine.CurrentEngine # a ScriptEngine > unit = engine.CreateSourceUnitFromString(code, id) > result = unit.Execute() > > Which is straightforward enough, however I can't see a way to set > TrueDivision using this technique. (What is the 'id' by the way?) > > I can see that TrueDivision is a setting on > IronPython.Runtime.ModuleOptions and IronPython.Runtime.PythonModule. > Can I set this on the engine somehow? > > All the alternative seem to lead down a rabbit warren of 'create this > object - which requires this object - which you construct from another > object - which...'. I don't know which path to follow down the rabbit > hole... > > :-) > > Any suggestions to save me from madness? > > Michael > _______________________________________________ > 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 fuzzyman at voidspace.org.uk Sat Mar 29 18:36:45 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sat, 29 Mar 2008 17:36:45 +0000 Subject: [IronPython] IP 2 Hosting In-Reply-To: References: <47EE75C4.6050209@voidspace.org.uk> Message-ID: <47EE7E2D.8020003@voidspace.org.uk> Curt Hagenlocher wrote: > Some of those look like names from A9, which have changed in B1. > > The easiest way to evaluate an expression from scratch seems to be as > follows: > > ScriptEngine engine = ScriptRuntime.Create().GetEngine("py"); > ScriptScope scope = engine.CreateScope(); > ScriptSource source = engine.CreateScriptSourceFromString("1 + 1", > SourceCodeKind.Expression); > int result = source.Execute(scope); Oops - didn't read all of your message. I'm using B1 and my code seems *pretty* similar except for the useful addition of SourceCodeKind - thanks. Michael > > On Sat, Mar 29, 2008 at 10:00 AM, Michael Foord > > wrote: > > Hello guys, > > I'm trying to do some simple examples of hosting with IronPython > 2. Boy > you made things more complicated than IronPython 1. :-) > > Unfortunately the DLR hosting spec document is out of date. I have a > couple of questions (but will keep exploring). > > The simplest use case is just to evaluate an expression and return > a result. > > The hosting spec document mention 'ScriptRuntime.Execute(text)'. This > may or may not be the right way to evaluate an expression, but in any > case it has been removed. > > An alternative is: > > engine = PythonEngine.CurrentEngine # a ScriptEngine > unit = engine.CreateSourceUnitFromString(code, id) > result = unit.Execute() > > Which is straightforward enough, however I can't see a way to set > TrueDivision using this technique. (What is the 'id' by the way?) > > I can see that TrueDivision is a setting on > IronPython.Runtime.ModuleOptions and IronPython.Runtime.PythonModule. > Can I set this on the engine somehow? > > All the alternative seem to lead down a rabbit warren of 'create this > object - which requires this object - which you construct from another > object - which...'. I don't know which path to follow down the rabbit > hole... > > :-) > > Any suggestions to save me from madness? > > Michael > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From curt at hagenlocher.org Sat Mar 29 18:47:43 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sat, 29 Mar 2008 10:47:43 -0700 Subject: [IronPython] IP 2 Hosting In-Reply-To: <47EE7D1F.2020008@voidspace.org.uk> References: <47EE75C4.6050209@voidspace.org.uk> <47EE7D1F.2020008@voidspace.org.uk> Message-ID: On Sat, Mar 29, 2008 at 10:32 AM, Michael Foord wrote: > > In the old days a beta used to mean the API was fixed and it was only > bugfixes that would go in... <0.5 wink> heh It seems to me that B1 is more consistent with the various published DLR hosting specs than A9 was -- which suggests that the API churn for the Microsoft.Scripting namespace is dying down. -- Curt Hagenlocher curt at hagenlocher.org From fuzzyman at voidspace.org.uk Sat Mar 29 18:51:01 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sat, 29 Mar 2008 17:51:01 +0000 Subject: [IronPython] IP 2 Hosting In-Reply-To: References: <47EE75C4.6050209@voidspace.org.uk> <47EE7D1F.2020008@voidspace.org.uk> Message-ID: <47EE8185.5020804@voidspace.org.uk> Curt Hagenlocher wrote: > On Sat, Mar 29, 2008 at 10:32 AM, Michael Foord > wrote: > >> In the old days a beta used to mean the API was fixed and it was only >> bugfixes that would go in... <0.5 wink> >> > > heh > > It seems to me that B1 is more consistent with the various published > DLR hosting specs than A9 was -- which suggests that the API churn for > the Microsoft.Scripting namespace is dying down. > Cool - I was just being rude. Any ideas on switching on TrueDivision for the scope? Michael > -- > Curt Hagenlocher > curt at hagenlocher.org > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From curt at hagenlocher.org Sat Mar 29 19:21:10 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sat, 29 Mar 2008 11:21:10 -0700 Subject: [IronPython] IP 2 Hosting In-Reply-To: <47EE8185.5020804@voidspace.org.uk> References: <47EE75C4.6050209@voidspace.org.uk> <47EE7D1F.2020008@voidspace.org.uk> <47EE8185.5020804@voidspace.org.uk> Message-ID: On Sat, Mar 29, 2008 at 10:51 AM, Michael Foord wrote: > > Cool - I was just being rude. Hey, I feel your pain! I'd swear that I've rewritten more hosting code than I've written... > Any ideas on switching on TrueDivision for the scope? This is what I was able to puzzle out. I have no idea how "correct" it is. ScriptSource source = engine.CreateScriptSourceFromString("import foo", SourceCodeKind.Statements); ScriptScope scriptScope = runtime.ExecuteSourceUnit(source); Scope scope = scriptScope.GetVariable("foo"); PythonModule extension = (PythonModule)scope.GetExtension(scope.Language.ContextId); extension.TrueDivision = true; It looks like you can set this globally by doing something like this: ((IronPython.PythonEngineOptions)engine.Options).DivisionOptions = IronPython.PythonDivisionOptions.New; -- Curt Hagenlocher curt at hagenlocher.org From fuzzyman at voidspace.org.uk Sat Mar 29 20:06:53 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sat, 29 Mar 2008 19:06:53 +0000 Subject: [IronPython] IP 2 Hosting In-Reply-To: References: <47EE75C4.6050209@voidspace.org.uk> <47EE7D1F.2020008@voidspace.org.uk> <47EE8185.5020804@voidspace.org.uk> Message-ID: <47EE934D.2010709@voidspace.org.uk> ((IronPython.PythonEngineOptions)engine.Options).DivisionOptions = IronPython.PythonDivisionOptions.New; This worked! Thanks - it is for a simple embedding example which is a calculator. The winforms UI builds up expressions and the '=' button evaluates them with the Python engine. :-) Michael Curt Hagenlocher wrote: > On Sat, Mar 29, 2008 at 10:51 AM, Michael Foord > wrote: > >> Cool - I was just being rude. >> > > Hey, I feel your pain! I'd swear that I've rewritten more hosting > code than I've written... > > >> Any ideas on switching on TrueDivision for the scope? >> > > This is what I was able to puzzle out. I have no idea how "correct" it is. > ScriptSource source = engine.CreateScriptSourceFromString("import > foo", SourceCodeKind.Statements); > ScriptScope scriptScope = runtime.ExecuteSourceUnit(source); > Scope scope = scriptScope.GetVariable("foo"); > PythonModule extension = > (PythonModule)scope.GetExtension(scope.Language.ContextId); > extension.TrueDivision = true; > > It looks like you can set this globally by doing something like this: > ((IronPython.PythonEngineOptions)engine.Options).DivisionOptions = > IronPython.PythonDivisionOptions.New; > > -- > Curt Hagenlocher > curt at hagenlocher.org > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From fuzzyman at voidspace.org.uk Sat Mar 29 20:37:39 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sat, 29 Mar 2008 19:37:39 +0000 Subject: [IronPython] IronPython 2 Hosting Examples Message-ID: <47EE9A83.1060809@voidspace.org.uk> Hello all, I've written up the IP 2 hosting example (thanks Curt) at: http://www.ironpython.info/index.php/Hosting_IronPython_2 I've created a couple of minimal C# projects for the ACCU talk next week and will post those online at some point. Michael http://www.ironpythoninaction.com From daftspaniel at gmail.com Sat Mar 29 21:28:22 2008 From: daftspaniel at gmail.com (Davy Mitchell) Date: Sat, 29 Mar 2008 20:28:22 +0000 Subject: [IronPython] Snippets in Trackback Message-ID: <20253b0c0803291328q6a756025l218f4a63bc0e39f0@mail.gmail.com> Hi All, IPY2.0 B1 Vista SP1 I keep seeing reference to 'Snippets' in IP Tracebacks on different bits of code. Can't find anything on codeplex so assume it *probably* something wrong this end. I don't have a 'Snippets' module AFAIK. Typical example C:\Code\OSProjects>ipy wpf5.py Traceback (most recent call last): File Snippets, line unknown, in Initialize File PresentationFramework, line unknown, in Load Is it just me or.... :-) -- Davy Mitchell Blog - http://www.latedecember.co.uk/sites/personal/davy/ Twitter - http://twitter.com/daftspaniel Skype - daftspaniel needgod.com From curt at hagenlocher.org Sat Mar 29 21:34:59 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sat, 29 Mar 2008 13:34:59 -0700 Subject: [IronPython] Snippets in Trackback In-Reply-To: <20253b0c0803291328q6a756025l218f4a63bc0e39f0@mail.gmail.com> References: <20253b0c0803291328q6a756025l218f4a63bc0e39f0@mail.gmail.com> Message-ID: The "snippets" represent executable code that's generated dynamically by the DLR from your Python source. Do you have a small piece of sample code that reproduces the failure? On Sat, Mar 29, 2008 at 1:28 PM, Davy Mitchell wrote: > Hi All, > > IPY2.0 B1 Vista SP1 > > I keep seeing reference to 'Snippets' in IP Tracebacks on different > bits of code. Can't find anything on codeplex so assume it *probably* > something wrong this end. > I don't have a 'Snippets' module AFAIK. > > Typical example > C:\Code\OSProjects>ipy wpf5.py > Traceback (most recent call last): > File Snippets, line unknown, in Initialize > File PresentationFramework, line unknown, in Load > > Is it just me or.... :-) > > -- > Davy Mitchell > Blog - http://www.latedecember.co.uk/sites/personal/davy/ > Twitter - http://twitter.com/daftspaniel > Skype - daftspaniel needgod.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Sat Mar 29 21:41:21 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sat, 29 Mar 2008 13:41:21 -0700 Subject: [IronPython] Multiple engines, multiple scopes Message-ID: Beta 1 now supports multiple engines inside the same AppDomain provided that you create a ScriptRuntime for each: ScriptEngine engine1 = ScriptRuntime.Create().GetEngine("py"); ScriptEngine engine2 = ScriptRuntime.Create().GetEngine("py"); A ScriptScope is loosely equivalent to a Python module. Empty ScriptScopes can be created from the engine: ScriptScope scope1 = engine1.CreateScope(); ScriptScope scope2 = engine2.CreateScope(); So the ScriptScope is somewhat bound to the engine it was created from. But in actuality, the engine is only used for ScriptScope.GetVariable, and the other operations on ScriptScope appear to be entirely independent of the ScriptEngine. In particular, scope1.GetVariable("foo") is equivalent to engine1.GetVariable(scope1, "foo"). But it appears to be quite legal to say engine2.GetVariable(scope1, "foo") engine2.GetVariable(scope1, "foo"), and the only difference appears to be the context that's used for the type conversion -- if needed. Is this intentional? It seems to me that it would be better if the ScriptScope were either more tightly bound to the ScriptEngine or not bound to it at all. -- Curt Hagenlocher curt at hagenlocher.org From daftspaniel at gmail.com Sun Mar 30 08:42:07 2008 From: daftspaniel at gmail.com (Davy Mitchell) Date: Sun, 30 Mar 2008 06:42:07 +0000 Subject: [IronPython] Snippets in Trackback In-Reply-To: References: <20253b0c0803291328q6a756025l218f4a63bc0e39f0@mail.gmail.com> Message-ID: <20253b0c0803292342l546fd247lfa22ce31c411e26c@mail.gmail.com> This has the desired effect: import clr clr.AddReference("System.Xml") clr.AddReference("PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35") clr.AddReference("PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35") from System.IO import StringReader from System.Xml import XmlReader from System.Windows.Markup import XamlReader, XamlWriter from System.Windows import Window, Application xaml = """ """ xr = XmlReader.Create(StringReader(xaml)) win = XamlReader.Load(xr) Application().Run(win) On Sat, Mar 29, 2008 at 8:34 PM, Curt Hagenlocher wrote: > The "snippets" represent executable code that's generated dynamically by the > DLR from your Python source. Do you have a small piece of sample code that > reproduces the failure? > > > > On Sat, Mar 29, 2008 at 1:28 PM, Davy Mitchell > wrote: > > > > > > > > > Hi All, > > > > IPY2.0 B1 Vista SP1 > > > > I keep seeing reference to 'Snippets' in IP Tracebacks on different > > bits of code. Can't find anything on codeplex so assume it *probably* > > something wrong this end. > > I don't have a 'Snippets' module AFAIK. > > > > Typical example > > C:\Code\OSProjects>ipy wpf5.py > > Traceback (most recent call last): > > File Snippets, line unknown, in Initialize > > File PresentationFramework, line unknown, in Load > > > > Is it just me or.... :-) > > > > -- > > > > > > > > Davy Mitchell > > Blog - http://www.latedecember.co.uk/sites/personal/davy/ > > Twitter - http://twitter.com/daftspaniel > > Skype - daftspaniel needgod.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 > > -- Davy Mitchell Blog - http://www.latedecember.co.uk/sites/personal/davy/ Twitter - http://twitter.com/daftspaniel Skype - daftspaniel needgod.com From sls at iinet.net.au Sun Mar 30 11:59:49 2008 From: sls at iinet.net.au (Paul Turbett) Date: Sun, 30 Mar 2008 17:59:49 +0800 Subject: [IronPython] Creating Python classes in IP2 Message-ID: <47EF6495.7070600@iinet.net.au> Hi, I'm attempting to update an application framework that uses IP1.1 to use IP2b1. In the framework, I create python objects that are derived from C# classes, so I can bind to an interface at compile time. I do this from C# by executing the .py file that defines the class, getting the class as a UserType from the module globals, and using Ops.Call to create an instance. I've looked through the DLR hosting spec, and experimented a bit, but I can't see how to get the same thing working with DLR hosting. So, how do I create instances of python classes from C#? Thanks, Paul From curt at hagenlocher.org Sun Mar 30 13:41:47 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sun, 30 Mar 2008 04:41:47 -0700 Subject: [IronPython] Snippets in Trackback In-Reply-To: <20253b0c0803292342l546fd247lfa22ce31c411e26c@mail.gmail.com> References: <20253b0c0803291328q6a756025l218f4a63bc0e39f0@mail.gmail.com> <20253b0c0803292342l546fd247lfa22ce31c411e26c@mail.gmail.com> Message-ID: This works for me once I fix the mismatched XML tag (and the mail-induced line breaks). And when I don't, I get pretty explicit error messages as the text of the exception: SystemError: The 'DockPanel' start tag on line 4 does not match the end tag of 'DockPanelTest'. Line 5, position 3. -or- SyntaxError: EOL while scanning single-quoted string What was the exception that you were getting? On Sat, Mar 29, 2008 at 11:42 PM, Davy Mitchell wrote: > This has the desired effect: > > import clr > clr.AddReference("System.Xml") > clr.AddReference("PresentationFramework, Version=3.0.0.0, > Culture=neutral, PublicKeyToken=31bf3856ad364e35") > clr.AddReference("PresentationCore, Version=3.0.0.0, Culture=neutral, > PublicKeyToken=31bf3856ad364e35") > from System.IO import StringReader > from System.Xml import XmlReader > from System.Windows.Markup import XamlReader, XamlWriter > from System.Windows import Window, Application > > xaml = """ > Title="Test" Width="600" Height="400"> > > > > """ > > xr = XmlReader.Create(StringReader(xaml)) > win = XamlReader.Load(xr) > Application().Run(win) > > On Sat, Mar 29, 2008 at 8:34 PM, Curt Hagenlocher > wrote: > > The "snippets" represent executable code that's generated dynamically by > the > > DLR from your Python source. Do you have a small piece of sample code > that > > reproduces the failure? > > > > > > > > On Sat, Mar 29, 2008 at 1:28 PM, Davy Mitchell > > wrote: > > > > > > > > > > > > > > Hi All, > > > > > > IPY2.0 B1 Vista SP1 > > > > > > I keep seeing reference to 'Snippets' in IP Tracebacks on different > > > bits of code. Can't find anything on codeplex so assume it *probably* > > > something wrong this end. > > > I don't have a 'Snippets' module AFAIK. > > > > > > Typical example > > > C:\Code\OSProjects>ipy wpf5.py > > > Traceback (most recent call last): > > > File Snippets, line unknown, in Initialize > > > File PresentationFramework, line unknown, in Load > > > > > > Is it just me or.... :-) > > > > > > -- > > > > > > > > > > > > Davy Mitchell > > > Blog - http://www.latedecember.co.uk/sites/personal/davy/ > > > Twitter - http://twitter.com/daftspaniel > > > Skype - daftspaniel needgod.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 > > > > > > > > -- > Davy Mitchell > Blog - http://www.latedecember.co.uk/sites/personal/davy/ > Twitter - http://twitter.com/daftspaniel > Skype - daftspaniel needgod.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Sun Mar 30 13:53:05 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sun, 30 Mar 2008 04:53:05 -0700 Subject: [IronPython] Creating Python classes in IP2 In-Reply-To: <47EF6495.7070600@iinet.net.au> References: <47EF6495.7070600@iinet.net.au> Message-ID: On Sun, Mar 30, 2008 at 2:59 AM, Paul Turbett wrote: > > I've looked through the DLR hosting spec, and experimented a bit, but I > can't see how to get the same thing working with DLR hosting. So, how do > I create instances of python classes from C#? This is what works for me: ScriptRuntime runtime = ScriptRuntime.Create(); ScriptEngine engine = runtime.GetEngine("py"); // These next two lines are needed if you expect to be able to import System // without manually loading the assembly through Python // runtime.LoadAssembly(typeof(string).Assembly); // runtime.LoadAssembly(typeof(System.Diagnostics.Debug).Assembly); // File foo.py contains class Foo ScriptScope scope = runtime.ExecuteFile("foo.py"); object theClass; scope.TryGetVariable("Foo", out theClass); object theValue = PythonCalls.Call(theClass); -- Curt Hagenlocher curt at hagenlocher.org From sls at iinet.net.au Sun Mar 30 14:06:18 2008 From: sls at iinet.net.au (Paul Turbett) Date: Sun, 30 Mar 2008 20:06:18 +0800 Subject: [IronPython] Creating Python classes in IP2 In-Reply-To: References: <47EF6495.7070600@iinet.net.au> Message-ID: <47EF823A.5020609@iinet.net.au> Awesome, thanks! Curt Hagenlocher wrote: > On Sun, Mar 30, 2008 at 2:59 AM, Paul Turbett wrote: > >> I've looked through the DLR hosting spec, and experimented a bit, but I >> can't see how to get the same thing working with DLR hosting. So, how do >> I create instances of python classes from C#? >> > > This is what works for me: > > ScriptRuntime runtime = ScriptRuntime.Create(); > ScriptEngine engine = runtime.GetEngine("py"); > > // These next two lines are needed if you expect to be able to import System > // without manually loading the assembly through Python > // runtime.LoadAssembly(typeof(string).Assembly); > // runtime.LoadAssembly(typeof(System.Diagnostics.Debug).Assembly); > > // File foo.py contains class Foo > ScriptScope scope = runtime.ExecuteFile("foo.py"); > object theClass; > scope.TryGetVariable("Foo", out theClass); > object theValue = PythonCalls.Call(theClass); > > -- > Curt Hagenlocher > curt at hagenlocher.org > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From daftspaniel at gmail.com Sun Mar 30 14:20:23 2008 From: daftspaniel at gmail.com (Davy Mitchell) Date: Sun, 30 Mar 2008 13:20:23 +0100 Subject: [IronPython] Snippets in Trackback In-Reply-To: References: <20253b0c0803291328q6a756025l218f4a63bc0e39f0@mail.gmail.com> <20253b0c0803292342l546fd247lfa22ce31c411e26c@mail.gmail.com> Message-ID: <20253b0c0803300520n4b0a5ad9he82fd9985bbaa8c5@mail.gmail.com> Hi Curt, Yeah the errors are pretty trivial to fix - usually XAML typos and the .Net detail is fine to fix it. I was just a little confused about Snippets in the traceback but no reference to my 'test.py' file. A better example is the single line 'self.test' saved to to test2.py python test2.py C:\Code\OSProjects>python test2.py Traceback (most recent call last): File "test2.py", line 1, in self.test NameError: name 'self' is not defined ipy test2.py C:\Code\OSProjects>ipy test2.py Traceback (most recent call last): File Snippets, line unknown, in Initialize NameError: name 'self' is not defined Cpython does a bit better there in callstack detail :-) Davy On Sun, Mar 30, 2008 at 12:41 PM, Curt Hagenlocher wrote: > This works for me once I fix the mismatched XML tag (and the mail-induced > line breaks). And when I don't, I get pretty explicit error messages as the > text of the exception: > > SystemError: The 'DockPanel' start tag on line 4 does not match the end tag > of 'DockPanelTest'. Line 5, position 3. > -or- > SyntaxError: EOL while scanning single-quoted string > > What was the exception that you were getting? > > > On Sat, Mar 29, 2008 at 11:42 PM, Davy Mitchell > wrote: > > > This has the desired effect: > > > > import clr > > clr.AddReference("System.Xml") > > clr.AddReference("PresentationFramework, Version=3.0.0.0, > > Culture=neutral, PublicKeyToken=31bf3856ad364e35") > > clr.AddReference("PresentationCore, Version=3.0.0.0, Culture=neutral, > > PublicKeyToken=31bf3856ad364e35") > > from System.IO import StringReader > > from System.Xml import XmlReader > > from System.Windows.Markup import XamlReader, XamlWriter > > from System.Windows import Window, Application > > > > xaml = """ > > > Title="Test" Width="600" Height="400"> > > > > > > > > """ > > > > xr = XmlReader.Create(StringReader(xaml)) > > win = XamlReader.Load(xr) > > Application().Run(win) > > > > > > > > > > On Sat, Mar 29, 2008 at 8:34 PM, Curt Hagenlocher > wrote: > > > The "snippets" represent executable code that's generated dynamically by > the > > > DLR from your Python source. Do you have a small piece of sample code > that > > > reproduces the failure? > > > > > > > > > > > > On Sat, Mar 29, 2008 at 1:28 PM, Davy Mitchell > > > wrote: > > > > > > > > > > > > > > > > > > > Hi All, > > > > > > > > IPY2.0 B1 Vista SP1 > > > > > > > > I keep seeing reference to 'Snippets' in IP Tracebacks on different > > > > bits of code. Can't find anything on codeplex so assume it *probably* > > > > something wrong this end. > > > > I don't have a 'Snippets' module AFAIK. > > > > > > > > Typical example > > > > C:\Code\OSProjects>ipy wpf5.py > > > > Traceback (most recent call last): > > > > File Snippets, line unknown, in Initialize > > > > File PresentationFramework, line unknown, in Load > > > > > > > > Is it just me or.... :-) > > > > > > > > -- > > > > > > > > > > > > > > > > Davy Mitchell > > > > Blog - http://www.latedecember.co.uk/sites/personal/davy/ > > > > Twitter - http://twitter.com/daftspaniel > > > > Skype - daftspaniel needgod.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 > > > > > > > > > > > > > > -- > > > > > > > > Davy Mitchell > > Blog - http://www.latedecember.co.uk/sites/personal/davy/ > > Twitter - http://twitter.com/daftspaniel > > Skype - daftspaniel needgod.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 > > -- Davy Mitchell Blog - http://www.latedecember.co.uk/sites/personal/davy/ Twitter - http://twitter.com/daftspaniel Skype - daftspaniel needgod.com From curt at hagenlocher.org Sun Mar 30 14:26:10 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sun, 30 Mar 2008 05:26:10 -0700 Subject: [IronPython] Snippets in Trackback In-Reply-To: <20253b0c0803300520n4b0a5ad9he82fd9985bbaa8c5@mail.gmail.com> References: <20253b0c0803291328q6a756025l218f4a63bc0e39f0@mail.gmail.com> <20253b0c0803292342l546fd247lfa22ce31c411e26c@mail.gmail.com> <20253b0c0803300520n4b0a5ad9he82fd9985bbaa8c5@mail.gmail.com> Message-ID: On Sun, Mar 30, 2008 at 5:20 AM, Davy Mitchell wrote: > A better example is the single line 'self.test' saved to to test2.py > > ipy test2.py > C:\Code\OSProjects>ipy test2.py > Traceback (most recent call last): > File Snippets, line unknown, in Initialize > NameError: name 'self' is not defined I imagine this is just a temporary glitch in 2.0b1, as IronPython 1.1.1 shows the right line: PS F:\IPCE-r7\ipy> .\ipy.exe test2.py Traceback (most recent call last): File F:\IPCE-r7\ipy\test2.py, line 1, in Initialize NameError: name 'self' not defined -- Curt Hagenlocher curt at hagenlocher.org From fuzzyman at voidspace.org.uk Sun Mar 30 17:25:57 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sun, 30 Mar 2008 16:25:57 +0100 Subject: [IronPython] Mixing Languages with the DLR Message-ID: <47EFB105.3020004@voidspace.org.uk> Hello all, A quick question on mixing languages with the DLR. If we have an execution scope that we have executed code in - can we execute code from another language in the same scope? If this is trivially easy (just use a different engine to execute the code in the same scope) then we could make Resolver One scriptable in the DLR language of your choosing... (Why anyone would want to use anything other than Python I don't know). Michael http://www.ironpythoninaction.com From Jimmy.Schementi at microsoft.com Mon Mar 31 01:10:34 2008 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Sun, 30 Mar 2008 16:10:34 -0700 Subject: [IronPython] Using Dynamic Languages in Silverlight with Visual Studio Message-ID: http://blogs.msdn.com/webnext/archive/2008/03/30/silverlight-dynamic-languag es-in-visual-studio.aspx For all those who have been asking about Visual Studio support, Laurence Moroney just posted about using Dynamic Languages in Silverlight with Visual Studio! Shows you how to start Chiron with F5 in a website solution. Let me know if anyone has any feedback for Laurence, as this will content will make it into his Silverlight 2 book! Thanks again Laurence! ~Jimmy From Jimmy.Schementi at microsoft.com Mon Mar 31 01:27:14 2008 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Sun, 30 Mar 2008 16:27:14 -0700 Subject: [IronPython] Mixing Languages with the DLR In-Reply-To: <47EFB105.3020004@voidspace.org.uk> Message-ID: I know this works between Jscript and Python. Ruby doesn't yet play by the rules for method lookup. Fire up dlrconsole and see for yourself: http://dynamicsilverlight.net/see/dlrconsole js> function foo() { js| return 42 js| } py> a = foo() py> a 42.0 js> a 42.0 How it works? I believe it's something to do with sharing scopes, but you can take a look @ http://dynamicsilverlight.net/see/dlrconsole.zip. Everything is in /app/app.py John, any idea when Ruby will play nicely with other languages? ~Jimmy On 3/30/08 8:25 AM, "Michael Foord" wrote: Hello all, A quick question on mixing languages with the DLR. If we have an execution scope that we have executed code in - can we execute code from another language in the same scope? If this is trivially easy (just use a different engine to execute the code in the same scope) then we could make Resolver One scriptable in the DLR language of your choosing... (Why anyone would want to use anything other than Python I don't know). Michael http://www.ironpythoninaction.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 michael.foord at resolversystems.com Mon Mar 31 13:20:21 2008 From: michael.foord at resolversystems.com (Michael Foord) Date: Mon, 31 Mar 2008 12:20:21 +0100 Subject: [IronPython] IronPython 2 Exception Handling from C# Message-ID: <47F0C8F5.1010601@resolversystems.com> Hello guys, I'm being lazy. Can anyone help translate the following IronPython 1 hosting code to the IP 2b1 API nearest equivalent. (I have already translated the code to execute the file - it is the exception handling code I need help with): try { engine.Sys.argv = List.Make(args); ScriptSource source = engine.CreateScriptSourceFromFile(Path.Combine(rootDir, (string)args[0]); source.Execute(); } catch (PythonSystemExitException e) { object o; return e.GetExitCode(out o); } catch (Exception e) { Console.Write(engine.FormatException(e)); return 1; } finally { PythonEngine.DumpDebugInfo(); } return 0; Thanks (in advance...) Michael -- Michael Foord Senior Software Engineer, Resolver Systems Ltd. michael.foord at resolversystems.com +44 (0) 20 7253 6372 We're hiring! http://www.resolversystems.com/jobs/ 17a Clerkenwell Road, London EC1M 5RD, UK VAT No.: GB 893 5643 79 Registered in England and Wales as company number 5467329. Registered address: 843 Finchley Road, London NW11 8NA, UK From michael.foord at resolversystems.com Mon Mar 31 13:51:00 2008 From: michael.foord at resolversystems.com (Michael Foord) Date: Mon, 31 Mar 2008 12:51:00 +0100 Subject: [IronPython] More IP2 Equivalents - setting argv and search path Message-ID: <47F0D024.2070307@resolversystems.com> Hello all, I'm searching for more IronPython 2 equivalents and wondering if anyone on list knows. :-) With IronPython 1 we would set 'sys.argv' with: engine.Sys.argv = List.Make(args); (I think List here is the PythonList.) We would also add paths to sys.path for an engine with: engine.AddToPath(path); I'm currently doing this by generating strings of 'sys.path.append(...)' and executing the code which is a bit clumsy. :-) I saw a post on the list recently about "ScriptEngine.SetScriptSourceSearchPaths", but this doesn't seem to exist in 2b1. Thanks Michael -- Michael Foord Senior Software Engineer, Resolver Systems Ltd. michael.foord at resolversystems.com +44 (0) 20 7253 6372 We're hiring! http://www.resolversystems.com/jobs/ 17a Clerkenwell Road, London EC1M 5RD, UK VAT No.: GB 893 5643 79 Registered in England and Wales as company number 5467329. Registered address: 843 Finchley Road, London NW11 8NA, UK From curt at hagenlocher.org Mon Mar 31 15:21:00 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 31 Mar 2008 06:21:00 -0700 Subject: [IronPython] More IP2 Equivalents - setting argv and search path In-Reply-To: <47F0D024.2070307@resolversystems.com> References: <47F0D024.2070307@resolversystems.com> Message-ID: On Mon, Mar 31, 2008 at 4:51 AM, Michael Foord wrote: > > I saw a post on the list recently about > "ScriptEngine.SetScriptSourceSearchPaths", but this doesn't seem to > exist in 2b1. I'm looking at it in 2b1 right now... -- Curt Hagenlocher curt at hagenlocher.org From fuzzyman at voidspace.org.uk Mon Mar 31 15:46:24 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 31 Mar 2008 14:46:24 +0100 Subject: [IronPython] More IP2 Equivalents - setting argv and search path In-Reply-To: References: <47F0D024.2070307@resolversystems.com> Message-ID: <47F0EB30.20704@voidspace.org.uk> Curt Hagenlocher wrote: > On Mon, Mar 31, 2008 at 4:51 AM, Michael Foord > wrote: > >> I saw a post on the list recently about >> "ScriptEngine.SetScriptSourceSearchPaths", but this doesn't seem to >> exist in 2b1. >> > > I'm looking at it in 2b1 right now... > Yeah - oops. Takes an array of strings. :-) Michael > -- > Curt Hagenlocher > curt at hagenlocher.org > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From michael.foord at resolversystems.com Mon Mar 31 17:10:09 2008 From: michael.foord at resolversystems.com (Michael Foord) Date: Mon, 31 Mar 2008 16:10:09 +0100 Subject: [IronPython] Semi-blocking bug in IP 2B1 Message-ID: <47F0FED1.3020007@resolversystems.com> Hello all, There is a bug in dictionaries in IronPython 2 beta 1. I found this trying to port Resolver One to IP 2. Whilst I can work round it in this case I wonder how many times this bug will bite us in our code base: >>> d = dict() >>> d[0, 0] = 3 >>> del d[0, 0] Traceback (most recent call last): File , line unknown, in Initialize##345 TypeError: __delitem__() takes exactly 1 argument (2 given) In general, error reporting/tracebacks seem to be much worse in IronPython 2. If I have time I will try and produce a repro... Michael -- Michael Foord Senior Software Engineer, Resolver Systems Ltd. michael.foord at resolversystems.com +44 (0) 20 7253 6372 We're hiring! http://www.resolversystems.com/jobs/ 17a Clerkenwell Road, London EC1M 5RD, UK VAT No.: GB 893 5643 79 Registered in England and Wales as company number 5467329. Registered address: 843 Finchley Road, London NW11 8NA, UK From curt at hagenlocher.org Mon Mar 31 17:34:44 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 31 Mar 2008 08:34:44 -0700 Subject: [IronPython] Semi-blocking bug in IP 2B1 In-Reply-To: <47F0FED1.3020007@resolversystems.com> References: <47F0FED1.3020007@resolversystems.com> Message-ID: On Mon, Mar 31, 2008 at 8:10 AM, Michael Foord wrote: > > In general, error reporting/tracebacks seem to be much worse in > IronPython 2. If I have time I will try and produce a repro... If you run with a -D flag, you get much better error reporting. This is equivalent to setting (ScriptRuntime).GlobalOptions.DebugMode = true in a hosting scenario. (Thanks to Jimmy Schementi's post on the IronRuby list for pointing me at this.) -- Curt Hagenlocher curt at hagenlocher.org From slide.o.mix at gmail.com Mon Mar 31 17:54:33 2008 From: slide.o.mix at gmail.com (Slide) Date: Mon, 31 Mar 2008 08:54:33 -0700 Subject: [IronPython] Creating Python classes in IP2 In-Reply-To: References: <47EF6495.7070600@iinet.net.au> Message-ID: I use the following for finding a class that implements a certain interface. IAttributesCollection attrs = IronPython.Runtime.Types.PythonModuleOps.Get__dict__(__main__); foreach (KeyValuePair attr in attrs) { IronPython.Runtime.Types.PythonType attr_type = attr.Value as IronPython.Runtime.Types.PythonType; if (attr_type != null) { foreach (IronPython.Runtime.Types.PythonType dt in attr_type.BaseTypes) { if (dt.UnderlyingSystemType != null && dt.UnderlyingSystemType == typeof(T)) { CodeContext context = new CodeContext(__main__.Scope, _context, new ModuleContext(__main__)); inst = (T)attr_type.CreateInstance(context); break; } } } } Is there a way that is more portable between the different languages? On Sun, Mar 30, 2008 at 4:53 AM, Curt Hagenlocher wrote: > On Sun, Mar 30, 2008 at 2:59 AM, Paul Turbett wrote: > > > > I've looked through the DLR hosting spec, and experimented a bit, but I > > can't see how to get the same thing working with DLR hosting. So, how do > > I create instances of python classes from C#? > > This is what works for me: > > ScriptRuntime runtime = ScriptRuntime.Create(); > ScriptEngine engine = runtime.GetEngine("py"); > > // These next two lines are needed if you expect to be able to import System > // without manually loading the assembly through Python > // runtime.LoadAssembly(typeof(string).Assembly); > // runtime.LoadAssembly(typeof(System.Diagnostics.Debug).Assembly); > > // File foo.py contains class Foo > ScriptScope scope = runtime.ExecuteFile("foo.py"); > object theClass; > scope.TryGetVariable("Foo", out theClass); > object theValue = PythonCalls.Call(theClass); > > -- > Curt Hagenlocher > curt at hagenlocher.org > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- slide-o-blog http://slide-o-blog.blogspot.com/ From dinov at exchange.microsoft.com Mon Mar 31 18:09:09 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 31 Mar 2008 09:09:09 -0700 Subject: [IronPython] IP 2 Hosting In-Reply-To: <47EE8185.5020804@voidspace.org.uk> References: <47EE75C4.6050209@voidspace.org.uk> <47EE7D1F.2020008@voidspace.org.uk> <47EE8185.5020804@voidspace.org.uk> Message-ID: <7AD436E4270DD54A94238001769C2227011D816E65DF@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Exactly, it's beta 1 - therefore the idea is that the API is basically fixed and we should see mostly bug fixes and tuning from here on out. It's not beta 2 yet! :) I think TrueDivision is another reason for us to expose a Python specific hosting API (yeah, I realize that conflicts with what I just said somewhat...). -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Saturday, March 29, 2008 10:51 AM To: Discussion of IronPython Subject: Re: [IronPython] IP 2 Hosting Curt Hagenlocher wrote: > On Sat, Mar 29, 2008 at 10:32 AM, Michael Foord > wrote: > >> In the old days a beta used to mean the API was fixed and it was only >> bugfixes that would go in... <0.5 wink> >> > > heh > > It seems to me that B1 is more consistent with the various published > DLR hosting specs than A9 was -- which suggests that the API churn for > the Microsoft.Scripting namespace is dying down. > Cool - I was just being rude. Any ideas on switching on TrueDivision for the scope? Michael > -- > Curt Hagenlocher > curt at hagenlocher.org > _______________________________________________ > 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 fuzzyman at voidspace.org.uk Mon Mar 31 18:03:35 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 31 Mar 2008 17:03:35 +0100 Subject: [IronPython] Semi-blocking bug in IP 2B1 In-Reply-To: References: <47F0FED1.3020007@resolversystems.com> Message-ID: <47F10B57.9090906@voidspace.org.uk> Curt Hagenlocher wrote: > On Mon, Mar 31, 2008 at 8:10 AM, Michael Foord > wrote: > >> In general, error reporting/tracebacks seem to be much worse in >> IronPython 2. If I have time I will try and produce a repro... >> > > If you run with a -D flag, you get much better error reporting. This > is equivalent to setting (ScriptRuntime).GlobalOptions.DebugMode = > true in a hosting scenario. > > (Thanks to Jimmy Schementi's post on the IronRuby list for pointing me at this.) > Ok - and thanks. But we generate and execute code at runtime and need good error reporting for our users. If there is a performance implication we wouldn't want to have to set this flag just to be able to give our users useful tracebacks! The IP traceback handling is generally fine for us - but I haven't *confirmed* that IP 2 is worse - it just feels worse... We have bigger problems anyway. Now I have ironed out the obvious problems, Resolver One runs on IP 2 but the user interface is completely broken. That is all pure-Python code so I have some digging to do... :-) Michael > -- > Curt Hagenlocher > curt at hagenlocher.org > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From curt at hagenlocher.org Mon Mar 31 18:12:02 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 31 Mar 2008 09:12:02 -0700 Subject: [IronPython] Creating Python classes in IP2 In-Reply-To: References: <47EF6495.7070600@iinet.net.au> Message-ID: On Mon, Mar 31, 2008 at 8:54 AM, Slide wrote: > I use the following for finding a class that implements a certain interface. > > [...] > > Is there a way that is more portable between the different languages? It looks like the DLR doesn't try to abstract "classness". And given that the semantics of a "class" vary so much between Python, Ruby and Javascript, this isn't really a surprise. -- Curt Hagenlocher curt at hagenlocher.org From dinov at exchange.microsoft.com Mon Mar 31 18:13:38 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 31 Mar 2008 09:13:38 -0700 Subject: [IronPython] Semi-blocking bug in IP 2B1 In-Reply-To: <47F10B57.9090906@voidspace.org.uk> References: <47F0FED1.3020007@resolversystems.com> <47F10B57.9090906@voidspace.org.uk> Message-ID: <7AD436E4270DD54A94238001769C2227011D816E65E5@DF-GRTDANE-MSG.exchange.corp.microsoft.com> It's actually something that's on our radar - it feels worse to me too. It's something I plan on taking a look at before 2.0 final ships. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Monday, March 31, 2008 9:04 AM To: Discussion of IronPython Subject: Re: [IronPython] Semi-blocking bug in IP 2B1 Curt Hagenlocher wrote: > On Mon, Mar 31, 2008 at 8:10 AM, Michael Foord > wrote: > >> In general, error reporting/tracebacks seem to be much worse in >> IronPython 2. If I have time I will try and produce a repro... >> > > If you run with a -D flag, you get much better error reporting. This > is equivalent to setting (ScriptRuntime).GlobalOptions.DebugMode = > true in a hosting scenario. > > (Thanks to Jimmy Schementi's post on the IronRuby list for pointing me at this.) > Ok - and thanks. But we generate and execute code at runtime and need good error reporting for our users. If there is a performance implication we wouldn't want to have to set this flag just to be able to give our users useful tracebacks! The IP traceback handling is generally fine for us - but I haven't *confirmed* that IP 2 is worse - it just feels worse... We have bigger problems anyway. Now I have ironed out the obvious problems, Resolver One runs on IP 2 but the user interface is completely broken. That is all pure-Python code so I have some digging to do... :-) Michael > -- > Curt Hagenlocher > curt at hagenlocher.org > _______________________________________________ > 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 fuzzyman at voidspace.org.uk Mon Mar 31 18:06:55 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 31 Mar 2008 17:06:55 +0100 Subject: [IronPython] IP 2 Hosting In-Reply-To: <7AD436E4270DD54A94238001769C2227011D816E65DF@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <47EE75C4.6050209@voidspace.org.uk> <47EE7D1F.2020008@voidspace.org.uk> <47EE8185.5020804@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011D816E65DF@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <47F10C1F.1050806@voidspace.org.uk> Dino Viehland wrote: > Exactly, it's beta 1 - therefore the idea is that the API is basically fixed and we should see mostly bug fixes and tuning from here on out. > > It's not beta 2 yet! :) > > I think TrueDivision is another reason for us to expose a Python specific hosting API (yeah, I realize that conflicts with what I just said somewhat...). > The more general DLR hosting API is much less suitable for Resolver One of course and a Python specific API would be very nice. If I get far enough I will try and post a bunch of questions about what is the *best* way of doing various things that we do with engines/scopes (beyond the questions I have already sent...). :-) Thanks Michael > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Saturday, March 29, 2008 10:51 AM > To: Discussion of IronPython > Subject: Re: [IronPython] IP 2 Hosting > > Curt Hagenlocher wrote: > >> On Sat, Mar 29, 2008 at 10:32 AM, Michael Foord >> wrote: >> >> >>> In the old days a beta used to mean the API was fixed and it was only >>> bugfixes that would go in... <0.5 wink> >>> >>> >> heh >> >> It seems to me that B1 is more consistent with the various published >> DLR hosting specs than A9 was -- which suggests that the API churn for >> the Microsoft.Scripting namespace is dying down. >> >> > > Cool - I was just being rude. > > Any ideas on switching on TrueDivision for the scope? > > Michael > > > > >> -- >> Curt Hagenlocher >> curt at hagenlocher.org >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From dinov at exchange.microsoft.com Mon Mar 31 18:17:06 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 31 Mar 2008 09:17:06 -0700 Subject: [IronPython] Semi-blocking bug in IP 2B1 In-Reply-To: <47F0FED1.3020007@resolversystems.com> References: <47F0FED1.3020007@resolversystems.com> Message-ID: <7AD436E4270DD54A94238001769C2227011D816E65E7@DF-GRTDANE-MSG.exchange.corp.microsoft.com> I've created a bug for this - http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=15882 Given that it's a pretty bad regression I'll take a look at it after I finish up the work I'm doing on startup perf right now. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Monday, March 31, 2008 8:10 AM To: Resolver Developers; Discussion of IronPython Subject: [IronPython] Semi-blocking bug in IP 2B1 Hello all, There is a bug in dictionaries in IronPython 2 beta 1. I found this trying to port Resolver One to IP 2. Whilst I can work round it in this case I wonder how many times this bug will bite us in our code base: >>> d = dict() >>> d[0, 0] = 3 >>> del d[0, 0] Traceback (most recent call last): File , line unknown, in Initialize##345 TypeError: __delitem__() takes exactly 1 argument (2 given) In general, error reporting/tracebacks seem to be much worse in IronPython 2. If I have time I will try and produce a repro... Michael -- Michael Foord Senior Software Engineer, Resolver Systems Ltd. michael.foord at resolversystems.com +44 (0) 20 7253 6372 We're hiring! http://www.resolversystems.com/jobs/ 17a Clerkenwell Road, London EC1M 5RD, UK VAT No.: GB 893 5643 79 Registered in England and Wales as company number 5467329. Registered address: 843 Finchley Road, London NW11 8NA, UK _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From curt at hagenlocher.org Mon Mar 31 18:19:38 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 31 Mar 2008 09:19:38 -0700 Subject: [IronPython] Semi-blocking bug in IP 2B1 In-Reply-To: <7AD436E4270DD54A94238001769C2227011D816E65E5@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <47F0FED1.3020007@resolversystems.com> <47F10B57.9090906@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011D816E65E5@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: LambdaCompiler.Statements.cs basically says "if (Options.DebugMode && Options.DynamicStackTraceSupport) EmitGetCurrentLine()". Maybe this should be "or" instead of "and"? On Mon, Mar 31, 2008 at 9:13 AM, Dino Viehland wrote: > It's actually something that's on our radar - it feels worse to me too. > It's something I plan on taking a look at before 2.0 final ships. > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Monday, March 31, 2008 9:04 AM > To: Discussion of IronPython > Subject: Re: [IronPython] Semi-blocking bug in IP 2B1 > > Curt Hagenlocher wrote: > > On Mon, Mar 31, 2008 at 8:10 AM, Michael Foord > > wrote: > > > >> In general, error reporting/tracebacks seem to be much worse in > >> IronPython 2. If I have time I will try and produce a repro... > >> > > > > If you run with a -D flag, you get much better error reporting. This > > is equivalent to setting (ScriptRuntime).GlobalOptions.DebugMode = > > true in a hosting scenario. > > > > (Thanks to Jimmy Schementi's post on the IronRuby list for pointing me > at this.) > > > > Ok - and thanks. But we generate and execute code at runtime and need > good error reporting for our users. If there is a performance > implication we wouldn't want to have to set this flag just to be able to > give our users useful tracebacks! The IP traceback handling is generally > fine for us - but I haven't *confirmed* that IP 2 is worse - it just > feels worse... > > We have bigger problems anyway. Now I have ironed out the obvious > problems, Resolver One runs on IP 2 but the user interface is completely > broken. That is all pure-Python code so I have some digging to do... :-) > > Michael > > > > > -- > > Curt Hagenlocher > > curt at hagenlocher.org > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Mon Mar 31 18:26:37 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 31 Mar 2008 09:26:37 -0700 Subject: [IronPython] Semi-blocking bug in IP 2B1 In-Reply-To: References: <47F0FED1.3020007@resolversystems.com> <47F10B57.9090906@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227011D816E65E5@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <7AD436E4270DD54A94238001769C2227011D816E65EA@DF-GRTDANE-MSG.exchange.corp.microsoft.com> There's actually a bunch of issues tangled together here but you're right, changing that statement would make the frames more usable... There's actually some thoughts that our dynamic stack trace support should be pulled up entirely into IronPython and that might just happen. The other issues are just related to how we generally produce frames. For example if you do: try: raise ZeroDivisionError except: # start extracting frames from sys.exc_info() In CPython you get a bunch of frames from above the except block and in IronPython you get no frames. Turns out the inspect module does this and the latest Django in source control relies on that working :). So to fix that bug requires that we always take a full stack trace when we get the frames. And that of course kills exception handling perf in a quite significant way (it gets 3x more expensive to throw an exception, and it's already really expensive). So we should bring this back w/o having the -D flag enabled, and we might also want to change how we track frames in general to do something better and more consistent w/ CPython. But we can't push that down into the DLR so there's a non-trivial amount of work here. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher Sent: Monday, March 31, 2008 9:20 AM To: Discussion of IronPython Subject: Re: [IronPython] Semi-blocking bug in IP 2B1 LambdaCompiler.Statements.cs basically says "if (Options.DebugMode && Options.DynamicStackTraceSupport) EmitGetCurrentLine()". Maybe this should be "or" instead of "and"? On Mon, Mar 31, 2008 at 9:13 AM, Dino Viehland > wrote: It's actually something that's on our radar - it feels worse to me too. It's something I plan on taking a look at before 2.0 final ships. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Monday, March 31, 2008 9:04 AM To: Discussion of IronPython Subject: Re: [IronPython] Semi-blocking bug in IP 2B1 Curt Hagenlocher wrote: > On Mon, Mar 31, 2008 at 8:10 AM, Michael Foord > > wrote: > >> In general, error reporting/tracebacks seem to be much worse in >> IronPython 2. If I have time I will try and produce a repro... >> > > If you run with a -D flag, you get much better error reporting. This > is equivalent to setting (ScriptRuntime).GlobalOptions.DebugMode = > true in a hosting scenario. > > (Thanks to Jimmy Schementi's post on the IronRuby list for pointing me at this.) > Ok - and thanks. But we generate and execute code at runtime and need good error reporting for our users. If there is a performance implication we wouldn't want to have to set this flag just to be able to give our users useful tracebacks! The IP traceback handling is generally fine for us - but I haven't *confirmed* that IP 2 is worse - it just feels worse... We have bigger problems anyway. Now I have ironed out the obvious problems, Resolver One runs on IP 2 but the user interface is completely broken. That is all pure-Python code so I have some digging to do... :-) Michael > -- > Curt Hagenlocher > curt at hagenlocher.org > _______________________________________________ > 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 fuzzyman at voidspace.org.uk Mon Mar 31 23:22:23 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 31 Mar 2008 22:22:23 +0100 Subject: [IronPython] Mixing Languages with the DLR In-Reply-To: References: Message-ID: <47F1560F.2010801@voidspace.org.uk> Jimmy Schementi wrote: > I know this works between Jscript and Python. Ruby doesn?t yet play by > the rules for method lookup. Fire up dlrconsole and see for yourself: Ok - something for us to watch. Allowing users to script Resolver One spreadsheets with Ruby could be fun. Michael http://www.ironpythoninaction.com > > http://dynamicsilverlight.net/see/dlrconsole > > js> function foo() { > js| return 42 > js| } > py> a = foo() > py> a > 42.0 > js> a > 42.0 > > How it works? I believe it?s something to do with sharing scopes, but > you can take a look @ > http://dynamicsilverlight.net/see/dlrconsole.zip. Everything is in > /app/app.py > > John, any idea when Ruby will play nicely with other languages? > > ~Jimmy > > On 3/30/08 8:25 AM, "Michael Foord" wrote: > > Hello all, > > A quick question on mixing languages with the DLR. If we have an > execution scope that we have executed code in - can we execute > code from > another language in the same scope? > > If this is trivially easy (just use a different engine to execute the > code in the same scope) then we could make Resolver One scriptable in > the DLR language of your choosing... (Why anyone would want to use > anything other than Python I don't know). > > Michael > http://www.ironpythoninaction.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >