From bakalarmh at mail.nih.gov Tue Jun 1 16:15:09 2010 From: bakalarmh at mail.nih.gov (Bakalar, Matthew (NIH/CIT) [C]) Date: Tue, 1 Jun 2010 10:15:09 -0400 Subject: [IronPython] Uninformative Type Error Message-ID: <69A3D9C1907FEF4388A1365AA59A9C7314044A0EB2@NIHMLBX05.nih.gov> Hello All, I am running into a frustrating exception. When attempting to instantiate a class with an argument that is an instance of a different class from a separate assembly, I receive an unhelpful type error from the IronPython interpreter: TypeError: expected XYZPositioner, got XYZPositioner Both assemblies were loaded using clr.AddReferenceToFileAndPath. I have tried to confirm the type of the object I am passing as an argument to the constructor: > A.GetType() == Target.Devices.XYZPositioner True Is there any way to get more information about the error? (The message reminds me of my days working in OCaml, where all of the error messages were translated from French grammar and it was never clear how to differentiate the object from the subject) Thanks, Matt Bakalar -------------- next part -------------- An HTML attachment was scrubbed... URL: From merllab at microsoft.com Tue Jun 1 17:52:51 2010 From: merllab at microsoft.com (merllab at microsoft.com) Date: Tue, 1 Jun 2010 08:52:51 -0700 Subject: [IronPython] IronPython 2.6 CodePlex Source Update Message-ID: This is an automated email letting you know that sources have recently been pushed out. You can download these newer sources directly from http://ironpython.codeplex.com/SourceControl/changeset/view/66364. MODIFIED SOURCES $/IronPython/IronPython_Main/Hosts/Silverlight/Chiron/Properties/AssemblyInfo.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting.Core/Properties/AssemblyInfo.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Properties/AssemblyInfo.cs $/IronPython/IronPython_Main/Languages/IronPython/AssemblyVersion.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting.Core/Properties/ExtensionAssemblyInfo.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting.Debugging/AssemblyInfo.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting/Properties/AssemblyInfo.cs From dinov at microsoft.com Tue Jun 1 19:34:03 2010 From: dinov at microsoft.com (Dino Viehland) Date: Tue, 1 Jun 2010 17:34:03 +0000 Subject: [IronPython] ctypes on Mono In-Reply-To: References: <1A472770E042064698CB5ADC83A12ACD48964922@TK5EX14MBXC118.redmond.corp.microsoft.com> Message-ID: <1A472770E042064698CB5ADC83A12ACD4896E2A9@TK5EX14MBXC118.redmond.corp.microsoft.com> Any chance you can put a print in any calls to dlopen in ctypes\__init__.py and see what we're trying to load? From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Tristan Zajonc Sent: Sunday, May 30, 2010 3:57 PM To: Discussion of IronPython Subject: Re: [IronPython] ctypes on Mono (I'll look into OSX issue, although am happy to hear a solution from other users) I'm not sure why I don't get line numbers. If I pass -XExceptionDetail, I don't get much more: tristanz at aontic1:~$ ipy -X:ExceptionDetail IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.1433 Type "help", "copyright", "credits" or "license" for more information. >>> import ctypes cannot load library LoadLibrary at offset 0 in file:line:column :0:0 dlopen at offset 0 in file:line:column :0:0 Invoke at offset 0 in file:line:column :0:0 at IronPython.Modules.CTypes.LoadLibrary (System.String library, Int32 mode) [0x00000] in :0 at IronPython.Modules.CTypes.dlopen (System.String library, Int32 mode) [0x00000] in :0 at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod*,object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0 OSError: IronPython.Runtime.Exceptions.OSException: cannot load library at IronPython.Modules.CTypes.LoadLibrary (System.String library, Int32 mode) [0x00000] in :0 at IronPython.Modules.CTypes.dlopen (System.String library, Int32 mode) [0x00000] in :0 at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod*,object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0 On Sun, May 30, 2010 at 6:24 PM, Dino Viehland > wrote: On OS/X I believe you need to use Mono's DllMap feature (http://www.mono-project.com/Config_DllMap) to map from the Linux library name (libdl.so) to the Mac OS/X library which exports dlopen. I actually have no clue what exports it and I don't see one listed over here: http://gemma.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man3/dlopen.3.html so hopefully someone else on the list knows. It looks like on Linux the -X:ExceptionDetail command line option is being passed which is preventing the stack trace from having any line number information - or maybe the stack trace is cut off? Either way it'd be useful to see the line number which is calling dlopen to understand what library we are failing to load. My guess would be that it's trying to load the Python library but I'd think that would work fine (it looks like we pass in a null path in that case which should be alright for dlopen). From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Tristan Zajonc Sent: Saturday, May 29, 2010 3:59 PM To: Discussion of IronPython Subject: [IronPython] ctypes on Mono I'm running the the latest IronPython 2.6.1 (.NET 2.0 version) with Mono. I cannot import ctypes. Is this behavior expected? Any solutions? Here are the exact results: On OSX: IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.1433 Type "help", "copyright", "credits" or "license" for more information. >>> import ctypes Traceback (most recent call last): SystemError: libdl.so On Ubuntu (using trunk Mono): IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.1433 Type "help", "copyright", "credits" or "license" for more information. >>> import ctypes Traceback (most recent call last): OSError: IronPython.Runtime.Exceptions.OSException: cannot load library at IronPython.Modules.CTypes.LoadLibrary (System.String library, Int32 mode) [0x00000] in :0 at IronPython.Modules.CTypes.dlopen (System.String library, Int32 mode) [0x00000] in :0 at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod*,object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0 Best, Tristan _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Tue Jun 1 19:41:23 2010 From: dinov at microsoft.com (Dino Viehland) Date: Tue, 1 Jun 2010 17:41:23 +0000 Subject: [IronPython] Uninformative Type Error In-Reply-To: <69A3D9C1907FEF4388A1365AA59A9C7314044A0EB2@NIHMLBX05.nih.gov> References: <69A3D9C1907FEF4388A1365AA59A9C7314044A0EB2@NIHMLBX05.nih.gov> Message-ID: <1A472770E042064698CB5ADC83A12ACD4896E44B@TK5EX14MBXC118.redmond.corp.microsoft.com> This is caused by having the same assembly loaded into 2 different loader contexts at once (loader contexts are a part of the CLR loading infrastructure). Adding references to assemblies by file can be tricky. One possible solution might be to install both assemblies into the GAC and then do clr.AddReference. Another might be to make sure they're next to ipy.exe (or whatever the host process is if it's not ipy.exe) and then also do a clr.AddReference. You could also attempt to debug where the assemblies are getting loaded and try to make the add reference to file work - that would involve using fuslogvw.exe (logging all loads) and probably looking at PythonContext.TryLoadAssemblyFromFileWithPath. But the other choices are probably much easier and more robust. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Bakalar, Matthew (NIH/CIT) [C] Sent: Tuesday, June 01, 2010 7:15 AM To: Discussion of IronPython Subject: [IronPython] Uninformative Type Error Hello All, I am running into a frustrating exception. When attempting to instantiate a class with an argument that is an instance of a different class from a separate assembly, I receive an unhelpful type error from the IronPython interpreter: TypeError: expected XYZPositioner, got XYZPositioner Both assemblies were loaded using clr.AddReferenceToFileAndPath. I have tried to confirm the type of the object I am passing as an argument to the constructor: > A.GetType() == Target.Devices.XYZPositioner True Is there any way to get more information about the error? (The message reminds me of my days working in OCaml, where all of the error messages were translated from French grammar and it was never clear how to differentiate the object from the subject) Thanks, Matt Bakalar -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Tue Jun 1 19:49:14 2010 From: dinov at microsoft.com (Dino Viehland) Date: Tue, 1 Jun 2010 17:49:14 +0000 Subject: [IronPython] possible bug with __delattr__ in Ipy 2.6 In-Reply-To: <26bf20a3c98f525d47c488b09bf58e18@mail.gmail.com> References: <26bf20a3c98f525d47c488b09bf58e18@mail.gmail.com> Message-ID: <1A472770E042064698CB5ADC83A12ACD4896E506@TK5EX14MBXC118.redmond.corp.microsoft.com> This is definitely a bug - I've filed this as http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=27247 Thanks for the report! From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Idan Zaltzberg Sent: Sunday, May 30, 2010 6:50 AM To: Discussion of IronPython Subject: [IronPython] possible bug with __delattr__ in Ipy 2.6 Hi, In IronPython 2.6 I ran the following code: class A(object): def f(self): self.__delattr__('x') a = A() a.x=1 a.f() Traceback (most recent call last): File "", line 1, in File "", line 3, in f AttributeError: 'A' object has no attribute 'x' This code runs ok on cpython so I'm guessing this is bug... -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcronin at asrclkrec.com Tue Jun 1 19:54:09 2010 From: tcronin at asrclkrec.com (Cronin, Ted) Date: Tue, 1 Jun 2010 10:54:09 -0700 Subject: [IronPython] Ironclad In-Reply-To: <1A472770E042064698CB5ADC83A12ACD4896E506@TK5EX14MBXC118.redmond.corp.microsoft.com> References: <26bf20a3c98f525d47c488b09bf58e18@mail.gmail.com> <1A472770E042064698CB5ADC83A12ACD4896E506@TK5EX14MBXC118.redmond.corp.microsoft.com> Message-ID: Issues with Ironclad at .net 4, After Unblocking still see this issue. >>> import ironclad Traceback (most recent call last): File "", line 1, in File "C:\Program Files (x86)\IronPython 2.6 for .NET 4.0\Lib\ironclad\__init__.py", line 21, in SystemError: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.micro soft.com/fwlink/?LinkId=155569 for more information. Ted Cronin ACR ValueGIS (951) 955 - 0487 -------------- next part -------------- An HTML attachment was scrubbed... URL: From tristanz at gmail.com Tue Jun 1 21:13:03 2010 From: tristanz at gmail.com (Tristan Zajonc) Date: Tue, 1 Jun 2010 15:13:03 -0400 Subject: [IronPython] ctypes on Mono In-Reply-To: <1A472770E042064698CB5ADC83A12ACD4896E2A9@TK5EX14MBXC118.redmond.corp.microsoft.com> References: <1A472770E042064698CB5ADC83A12ACD48964922@TK5EX14MBXC118.redmond.corp.microsoft.com> <1A472770E042064698CB5ADC83A12ACD4896E2A9@TK5EX14MBXC118.redmond.corp.microsoft.com> Message-ID: Both on OSX and Ubuntu it appears to fail on a call to PyDLL(None). The problematic call is from the block: if _os.name in ("nt", "ce"): pythonapi = PyDLL("python dll", None, _sys.dllhandle) elif _sys.platform == "cygwin": pythonapi = PyDLL("libpython%d.%d.dll" % _sys.version_info[:2]) else: print "DEBUG: NOT NT/CE OR CYGWIN." pythonapi = PyDLL(None) It goes to CDLL base class and dies exactly here: if handle is None: print "HANDLE: " + str(self._name) + str(mode) #prints None0 self._handle = _dlopen(self._name, mode) print "AFTER DLOPEN. DOESN'T PRINT." Hope this helps. Tristan On Tue, Jun 1, 2010 at 1:34 PM, Dino Viehland wrote: > Any chance you can put a print in any calls to dlopen in > ctypes\__init__.py and see what we?re trying to load? > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Tristan Zajonc > *Sent:* Sunday, May 30, 2010 3:57 PM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] ctypes on Mono > > > > (I'll look into OSX issue, although am happy to hear a solution from other > users) > > > > I'm not sure why I don't get line numbers. If I pass -XExceptionDetail, I > don't get much more: > > > > tristanz at aontic1:~$ ipy -X:ExceptionDetail > > IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.1433 > > Type "help", "copyright", "credits" or "license" for more information. > > >>> import ctypes > > cannot load library > > LoadLibrary at offset 0 in file:line:column :0:0 > > dlopen at offset 0 in file:line:column :0:0 > > Invoke at offset 0 in file:line:column :0:0 > > at IronPython.Modules.CTypes.LoadLibrary (System.String library, Int32 > mode) [0x00000] in :0 > > at IronPython.Modules.CTypes.dlopen (System.String library, Int32 mode) > [0x00000] in :0 > > at (wrapper managed-to-native) > System.Reflection.MonoMethod:InternalInvoke > (System.Reflection.MonoMethod*,object,object[],System.Exception&) > > at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags > invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, > System.Globalization.CultureInfo culture) [0x00000] in :0 > > OSError: IronPython.Runtime.Exceptions.OSException: cannot load library > > at IronPython.Modules.CTypes.LoadLibrary (System.String library, Int32 > mode) [0x00000] in :0 > > at IronPython.Modules.CTypes.dlopen (System.String library, Int32 mode) > [0x00000] in :0 > > at (wrapper managed-to-native) > System.Reflection.MonoMethod:InternalInvoke > (System.Reflection.MonoMethod*,object,object[],System.Exception&) > > at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags > invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, > System.Globalization.CultureInfo culture) [0x00000] in :0 > > > > > > On Sun, May 30, 2010 at 6:24 PM, Dino Viehland > wrote: > > On OS/X I believe you need to use Mono?s DllMap feature ( > http://www.mono-project.com/Config_DllMap) to map from the Linux library > name (libdl.so) to the Mac OS/X library which exports dlopen. I actually > have no clue what exports it and I don?t see one listed over here: > http://gemma.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man3/dlopen.3.htmlso hopefully someone else on the list knows. > > > > It looks like on Linux the ?X:ExceptionDetail command line option is being > passed which is preventing the stack trace from having any line number > information - or maybe the stack trace is cut off? Either way it?d be > useful to see the line number which is calling dlopen to understand what > library we are failing to load. My guess would be that it?s trying to load > the Python library but I?d think that would work fine (it looks like we pass > in a null path in that case which should be alright for dlopen). > > > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Tristan Zajonc > > > *Sent:* Saturday, May 29, 2010 3:59 PM > *To:* Discussion of IronPython > > *Subject:* [IronPython] ctypes on Mono > > > > I'm running the the latest IronPython 2.6.1 (.NET 2.0 version) with Mono. > I cannot import ctypes. > > > > Is this behavior expected? Any solutions? Here are the exact results: > > > > On OSX: > > IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.1433 > > Type "help", "copyright", "credits" or "license" for more information. > > >>> import ctypes > > Traceback (most recent call last): > > SystemError: libdl.so > > > > On Ubuntu (using trunk Mono): > > > > IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.1433 > > Type "help", "copyright", "credits" or "license" for more information. > > >>> import ctypes > > Traceback (most recent call last): > > OSError: IronPython.Runtime.Exceptions.OSException: cannot load library > > at IronPython.Modules.CTypes.LoadLibrary (System.String library, Int32 > mode) [0x00000] in :0 > > at IronPython.Modules.CTypes.dlopen (System.String library, Int32 mode) > [0x00000] in :0 > > at (wrapper managed-to-native) > System.Reflection.MonoMethod:InternalInvoke > (System.Reflection.MonoMethod*,object,object[],System.Exception&) > > at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags > invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, > System.Globalization.CultureInfo culture) [0x00000] in :0 > > > > > > Best, > > Tristan > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.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 bakalarmh at mail.nih.gov Tue Jun 1 21:34:39 2010 From: bakalarmh at mail.nih.gov (Bakalar, Matthew (NIH/CIT) [C]) Date: Tue, 1 Jun 2010 15:34:39 -0400 Subject: [IronPython] Uninformative Type Error In-Reply-To: <1A472770E042064698CB5ADC83A12ACD4896E44B@TK5EX14MBXC118.redmond.corp.microsoft.com> References: <69A3D9C1907FEF4388A1365AA59A9C7314044A0EB2@NIHMLBX05.nih.gov> <1A472770E042064698CB5ADC83A12ACD4896E44B@TK5EX14MBXC118.redmond.corp.microsoft.com> Message-ID: <69A3D9C1907FEF4388A1365AA59A9C7314044A0F0B@NIHMLBX05.nih.gov> Thank you very much Dino, I added the folders that contain my assemblies to sys.path and then used clr.AddReference to add a reference to them. The type error no longer exists. Matt Bakalar From: Dino Viehland [mailto:dinov at microsoft.com] Sent: Tuesday, June 01, 2010 1:41 PM To: Discussion of IronPython Subject: Re: [IronPython] Uninformative Type Error This is caused by having the same assembly loaded into 2 different loader contexts at once (loader contexts are a part of the CLR loading infrastructure). Adding references to assemblies by file can be tricky. One possible solution might be to install both assemblies into the GAC and then do clr.AddReference. Another might be to make sure they're next to ipy.exe (or whatever the host process is if it's not ipy.exe) and then also do a clr.AddReference. You could also attempt to debug where the assemblies are getting loaded and try to make the add reference to file work - that would involve using fuslogvw.exe (logging all loads) and probably looking at PythonContext.TryLoadAssemblyFromFileWithPath. But the other choices are probably much easier and more robust. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Bakalar, Matthew (NIH/CIT) [C] Sent: Tuesday, June 01, 2010 7:15 AM To: Discussion of IronPython Subject: [IronPython] Uninformative Type Error Hello All, I am running into a frustrating exception. When attempting to instantiate a class with an argument that is an instance of a different class from a separate assembly, I receive an unhelpful type error from the IronPython interpreter: TypeError: expected XYZPositioner, got XYZPositioner Both assemblies were loaded using clr.AddReferenceToFileAndPath. I have tried to confirm the type of the object I am passing as an argument to the constructor: > A.GetType() == Target.Devices.XYZPositioner True Is there any way to get more information about the error? (The message reminds me of my days working in OCaml, where all of the error messages were translated from French grammar and it was never clear how to differentiate the object from the subject) Thanks, Matt Bakalar -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Tue Jun 1 22:11:35 2010 From: dinov at microsoft.com (Dino Viehland) Date: Tue, 1 Jun 2010 20:11:35 +0000 Subject: [IronPython] Performance str.replace in Silverlight In-Reply-To: <4BFEA0B8.1080400@voidspace.org.uk> References: <4BFEA0B8.1080400@voidspace.org.uk> Message-ID: <1A472770E042064698CB5ADC83A12ACD4896F572@TK5EX14MBXC118.redmond.corp.microsoft.com> Michael wrote: > I just tracked down a really nasty performance bug in our Silverlight > application. It turned out that doing a simple string replace in a 400 > character string was taking 700ms. As we actually do two replaces and > the text is usually substantially longer this was a real problem. > > I fixed the problem by switching to explicitly calling the .NET > String.Replace instead of str.replace, so it looks like an IronPython > issue. It doesn't happen with *all* text, but it looks like non-ascii > exacerbates the problem. > > The particular text that triggered it was: > > Die Neuanlage einer Welle muss auch zu Eintr?gen in der Tabelle > dbo_tv_wellenwebsitesfirmenverbinder f?hren. Dabei werden die > Zuordnungen aus der Vorwelle bei der Neuanlage einer neuen Welle > einmalig ?bernommen. Jede Zeile der Vorwelle wird also kopiert und die > Kopie erh?lt die Welle_uniqueID der neuen Welle. Die Verbindung zwischen > Website_uniqueID <-> Firmen_uniqueID <-> FirmenAbrechnung_uniqueID > bleibt somit erhalten. > > The replace code was: > > text = text.replace('\r\n', '\n').replace('\r', '\n') > > The fix was: > > text = String.Replace(text, '\r\n', '\n') > text = String.Replace(text, '\r', '\n') Couple of follow up questions (a simple repro isn't working for me): Is this on your Mac? What locale is your machine set to? I'm guessing it's something like en-UK (or whatever the Mac equivalent is if it's different) or do you have it set to a German locale? If you're willing to try an experiment to re-build IronPython you could try changing the "v.IndexOf(oldString, start)" call in StringOps.cs to be: v.IndexOf(oldString, start, StringComparison.Ordinal) I think that's the only culture sensitive code path in our replace Implementation and so my guess is that's the problem. If you can't rebuild and try it out I can probably track down a Mac to try the repro on. From fuzzyman at voidspace.org.uk Tue Jun 1 23:46:51 2010 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 01 Jun 2010 22:46:51 +0100 Subject: [IronPython] Performance str.replace in Silverlight In-Reply-To: <1A472770E042064698CB5ADC83A12ACD4896F572@TK5EX14MBXC118.redmond.corp.microsoft.com> References: <4BFEA0B8.1080400@voidspace.org.uk> <1A472770E042064698CB5ADC83A12ACD4896F572@TK5EX14MBXC118.redmond.corp.microsoft.com> Message-ID: <4C057FCB.1080803@voidspace.org.uk> On 01/06/2010 21:11, Dino Viehland wrote: > Michael wrote: > >> I just tracked down a really nasty performance bug in our Silverlight >> application. It turned out that doing a simple string replace in a 400 >> character string was taking 700ms. As we actually do two replaces and >> the text is usually substantially longer this was a real problem. >> >> I fixed the problem by switching to explicitly calling the .NET >> String.Replace instead of str.replace, so it looks like an IronPython >> issue. It doesn't happen with *all* text, but it looks like non-ascii >> exacerbates the problem. >> >> The particular text that triggered it was: >> >> Die Neuanlage einer Welle muss auch zu Eintr?gen in der Tabelle >> dbo_tv_wellenwebsitesfirmenverbinder f?hren. Dabei werden die >> Zuordnungen aus der Vorwelle bei der Neuanlage einer neuen Welle >> einmalig ?bernommen. Jede Zeile der Vorwelle wird also kopiert und die >> Kopie erh?lt die Welle_uniqueID der neuen Welle. Die Verbindung zwischen >> Website_uniqueID<-> Firmen_uniqueID<-> FirmenAbrechnung_uniqueID >> bleibt somit erhalten. >> >> The replace code was: >> >> text = text.replace('\r\n', '\n').replace('\r', '\n') >> >> The fix was: >> >> text = String.Replace(text, '\r\n', '\n') >> text = String.Replace(text, '\r', '\n') >> > Couple of follow up questions (a simple repro isn't working for me): > Is this on your Mac? > What locale is your machine set to? I'm guessing it's something like > en-UK (or whatever the Mac equivalent is if it's different) or do you have it > set to a German locale? > > If you're willing to try an experiment to re-build IronPython you could try > changing the "v.IndexOf(oldString, start)" call in StringOps.cs to be: > > v.IndexOf(oldString, start, StringComparison.Ordinal) > > I think that's the only culture sensitive code path in our replace > Implementation and so my guess is that's the problem. If you can't rebuild > and try it out I can probably track down a Mac to try the repro on. > > Yes, sorry - it is with Silverlight 4 and IronPython 2.6.1 on the Mac. It reproduced for both myself (English locale) and on my colleague who has a German machine. I don't know how easy it is to compile IronPython for Silverlight - it certainly wasn't easy a while ago but I can try again. :-) All the best, Michael > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (?BOGUS AGREEMENTS?) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. From hfoffani at gmail.com Wed Jun 2 11:07:29 2010 From: hfoffani at gmail.com (Hernan M Foffani) Date: Wed, 2 Jun 2010 11:07:29 +0200 Subject: [IronPython] clr.CompileModules fails on some python standard lib modules Message-ID: Several standard lib modules fails to compile through the use of clr.CompileModules(..). Compiling modules like decimal.py, gettext.py, glob.py and others (nine in total) all fail with the same message: SystemError: CompileToMethod cannot compile constant 'IronPython.Runtime.Types.BuiltinFunction' because it is a non-trivial value, such as a live object. Instead, create an expression tree that can construct this value. Is this a known problem? Are we expecting too much trying to compile the standard library with clr.CompileModules() and this is not a supported behaviour? We are using IronPython 2.6.1 for .NET 2.0. Regards, -Hern?n. From cenovsky at bakalari.cz Wed Jun 2 11:39:34 2010 From: cenovsky at bakalari.cz (Lukas Cenovsky) Date: Wed, 02 Jun 2010 11:39:34 +0200 Subject: [IronPython] clr.CompileModules fails on some python standard lib modules In-Reply-To: References: Message-ID: <4C0626D6.2010508@bakalari.cz> This is a known issue (http://ironpython.codeplex.com/workitem/26593?ProjectName=ironpython) and as Dino mentioned recently it is already fixed in the main. Which brings a question - when is IronPython 2.6.2 scheduled for release? -- -- Luk?? Hernan M Foffani wrote: > Several standard lib modules fails to compile through the use of > clr.CompileModules(..). Compiling modules like decimal.py, gettext.py, > glob.py and others (nine in total) all fail with the same message: > > SystemError: CompileToMethod cannot compile constant > 'IronPython.Runtime.Types.BuiltinFunction' because it is a non-trivial > value, such as a live object. Instead, create an expression tree that > can construct this value. > > Is this a known problem? Are we expecting too much trying to compile > the standard library with clr.CompileModules() and this is not a > supported behaviour? > > We are using IronPython 2.6.1 for .NET 2.0. > > Regards, > -Hern?n. > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > From hfoffani at gmail.com Wed Jun 2 20:02:14 2010 From: hfoffani at gmail.com (Hernan) Date: Wed, 2 Jun 2010 11:02:14 -0700 (PDT) Subject: [IronPython] clr.CompileModules fails on some python standard lib modules In-Reply-To: <4C0626D6.2010508@bakalari.cz> References: <4C0626D6.2010508@bakalari.cz> Message-ID: <62a819ff-19bc-4af4-8f1e-4f5e91220bb8@b21g2000vbh.googlegroups.com> > This is a known issue > (http://ironpython.codeplex.com/workitem/26593?ProjectName=ironpython) > and as Dino mentioned recently it is already fixed in the main. Thanks. FWIW, I voted for it. From dinov at microsoft.com Wed Jun 2 23:44:09 2010 From: dinov at microsoft.com (Dino Viehland) Date: Wed, 2 Jun 2010 21:44:09 +0000 Subject: [IronPython] clr.CompileModules fails on some python standard lib modules In-Reply-To: <4C0626D6.2010508@bakalari.cz> References: <4C0626D6.2010508@bakalari.cz> Message-ID: <1A472770E042064698CB5ADC83A12ACD48976D03@TK5EX14MBXC118.redmond.corp.microsoft.com> Luk?? wrote: > This is a known issue > (http://ironpython.codeplex.com/workitem/26593?ProjectName=ironpython) > and as Dino mentioned recently it is already fixed in the main. > > Which brings a question - when is IronPython 2.6.2 scheduled for release? We haven't quite scheduled it yet - we've been waiting to make sure there were no other regressions introduced in 2.6.1. I've seen 1 or 2 other small bugs that I think we'd like to fix. Personally I'm thinking end of June-ish but I'll need to talk to the rest of the team about it. From cenovsky at bakalari.cz Thu Jun 3 00:32:31 2010 From: cenovsky at bakalari.cz (Lukas Cenovsky) Date: Thu, 03 Jun 2010 00:32:31 +0200 Subject: [IronPython] clr.CompileModules fails on some python standard lib modules In-Reply-To: <1A472770E042064698CB5ADC83A12ACD48976D03@TK5EX14MBXC118.redmond.corp.microsoft.com> References: <4C0626D6.2010508@bakalari.cz> <1A472770E042064698CB5ADC83A12ACD48976D03@TK5EX14MBXC118.redmond.corp.microsoft.com> Message-ID: <4C06DBFF.6060709@bakalari.cz> Dino Viehland wrote: > Luk?? wrote: > >> This is a known issue >> (http://ironpython.codeplex.com/workitem/26593?ProjectName=ironpython) >> and as Dino mentioned recently it is already fixed in the main. >> >> Which brings a question - when is IronPython 2.6.2 scheduled for release? >> > > > We haven't quite scheduled it yet - we've been waiting to make sure there were > no other regressions introduced in 2.6.1. I've seen 1 or 2 other small bugs > that I think we'd like to fix. Personally I'm thinking end of June-ish but I'll > need to talk to the rest of the team about it. For me, the biggest issue is the compiling. Would be nice to see some progress in compiling Silverlight code ;-) Also the line number issue in tracebacks is quite inconvenient (http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=26940). I've almost got used to it but it surprise me from time to time anyway. End of June/ start of July is fine for next release. -- -- Luk?? -------------- next part -------------- An HTML attachment was scrubbed... URL: From merllab at microsoft.com Thu Jun 3 17:07:45 2010 From: merllab at microsoft.com (merllab at microsoft.com) Date: Thu, 3 Jun 2010 08:07:45 -0700 Subject: [IronPython] IronPython 2.6 CodePlex Source Update Message-ID: This is an automated email letting you know that sources have recently been pushed out. You can download these newer sources directly from http://ironpython.codeplex.com/SourceControl/changeset/view/66529. MODIFIED SOURCES $/IronPython/IronPython_Main/Languages/IronPython/Tests/test_help.py $/IronPython/IronPython_Main/Languages/IronPython/Tests/test_imp.py CHECKIN COMMENTS -------------------------------------------------------------------------------- Changeset Id: 1844851 Date: 6/2/2010 10:30:44 PM - Partial switch to run 2.7 tests in SNAP - Adds -X:Frames to the tests that now require it - Updates ValidateCPyTests for new 2.7 tests - Fixes a few errors left over from the test merge (Shelveset: 27Snap01;REDMOND\ddicato | SNAP CheckinId: 10879) From evans.d.andrew at gmail.com Thu Jun 3 19:38:49 2010 From: evans.d.andrew at gmail.com (Andrew Evans) Date: Thu, 3 Jun 2010 10:38:49 -0700 Subject: [IronPython] No Module named Zlib import error after installing DLL Message-ID: Hello I am trying to import the Zlib module after I have installed the DLL in to the DLLs folder in IronPython I am getting a no module named zlib It probably has something to do with my environment variables, what do I need to do get them to import. Currently my Environment Variables are set to IRONPYTHONPATH C:\IronPython\DLLs\; PATH C:\IronPython\; Google isn't being all that helpful -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Thu Jun 3 20:04:13 2010 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Thu, 03 Jun 2010 19:04:13 +0100 Subject: [IronPython] No Module named Zlib import error after installing DLL In-Reply-To: References: Message-ID: <4C07EE9D.9090808@voidspace.org.uk> On 03/06/2010 18:38, Andrew Evans wrote: > Hello I am trying to import the Zlib module after I have installed the > DLL in to the DLLs folder in IronPython > > I am getting a no module named zlib Hello Andrew, I haven't tried this, but I assume you have to add a reference to the assembly before you can import from it. Try: import clr clr.AddReference('IronPython.Zlib') (Substitute the correct name of the dll into the AddReference call.) HTH, Michael Foord > > It probably has something to do with my environment variables, what do > I need to do get them to import. Currently my Environment Variables > are set to > > > IRONPYTHONPATH C:\IronPython\DLLs\; > PATH C:\IronPython\; > > Google isn't being all that helpful > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdhardy at gmail.com Thu Jun 3 20:51:14 2010 From: jdhardy at gmail.com (Jeff Hardy) Date: Thu, 3 Jun 2010 12:51:14 -0600 Subject: [IronPython] No Module named Zlib import error after installing DLL In-Reply-To: <4C07EE9D.9090808@voidspace.org.uk> References: <4C07EE9D.9090808@voidspace.org.uk> Message-ID: On Thu, Jun 3, 2010 at 12:04 PM, Michael Foord wrote: > I haven't tried this, but I assume you have to add a reference to the > assembly before you can import from it. Try: > > ??? import clr > ??? clr.AddReference('IronPython.Zlib') > This shouldn't be necessary, as any DLL in the DLLs folder is automatically referenced, but it is worth trying. If it fails, it might provide a more useful error message. Andrew: You shouldn't have to set any environment variables to use IronPython.Zlib; I have a feeling that, for some reason, the DLL is failing to load. Which versions of IronPython and IronPython.Zlib are you using? What path is your IronPython installed to? - Jeff From evans.d.andrew at gmail.com Thu Jun 3 21:09:54 2010 From: evans.d.andrew at gmail.com (Andrew Evans) Date: Thu, 3 Jun 2010 12:09:54 -0700 Subject: [IronPython] No Module named Zlib import error after installing DLL In-Reply-To: References: <4C07EE9D.9090808@voidspace.org.uk> Message-ID: Hello I thought I posted my previous messages to the list I guess not *confused. I am using IronPython 2.6.1 the latest I believe. and IronPython Zlib for 2.6 Iron Python is installed to C:\IronPython Below is the more useful error message cheers >>> import clr >>> clr.AddReference("IronPython.Zlib") Traceback (most recent call last): File "", line 1, in IOError: System.IO.IOException: Could not add reference to assembly IronPython.Z lib at Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call(Object[] arg s, Boolean& shouldOptimize) at IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`2.Call1(Cal lSite site, CodeContext context, TFuncType func, T0 arg0) at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite s ite, T0 arg0, T1 arg1, T2 arg2) at IronPython.Runtime.PythonFunction.FunctionCaller`1.Call1(CallSite site, Co deContext context, Object func, T0 arg0) at IronPython.Compiler.Ast.CallExpression.Invoke1Instruction.Run(InterpretedF rame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 a rg1) at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx) at IronPython.Compiler.PythonScriptCode.Run(Scope scope) at IronPython.Hosting.PythonCommandLine.<>c__DisplayClass1.b__0() On Thu, Jun 3, 2010 at 11:51 AM, Jeff Hardy wrote: > On Thu, Jun 3, 2010 at 12:04 PM, Michael Foord > wrote: > > I haven't tried this, but I assume you have to add a reference to the > > assembly before you can import from it. Try: > > > > import clr > > clr.AddReference('IronPython.Zlib') > > > > This shouldn't be necessary, as any DLL in the DLLs folder is > automatically referenced, but it is worth trying. If it fails, it > might provide a more useful error message. > > Andrew: You shouldn't have to set any environment variables to use > IronPython.Zlib; I have a feeling that, for some reason, the DLL is > failing to load. Which versions of IronPython and IronPython.Zlib are > you using? What path is your IronPython installed to? > > - Jeff > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From evans.d.andrew at gmail.com Thu Jun 3 21:42:25 2010 From: evans.d.andrew at gmail.com (Andrew Evans) Date: Thu, 3 Jun 2010 12:42:25 -0700 Subject: [IronPython] No Module named Zlib import error after installing DLL In-Reply-To: References: <4C07EE9D.9090808@voidspace.org.uk> Message-ID: Hello I downloaded IronPython 2.6 the one not using dot net framework 4 and everything works now :-) On Thu, Jun 3, 2010 at 12:09 PM, Andrew Evans wrote: > Hello I thought I posted my previous messages to the list I guess not > *confused. I am using IronPython 2.6.1 the latest I believe. and IronPython > Zlib for 2.6 > > Iron Python is installed to C:\IronPython > > Below is the more useful error message cheers > > > >>> import clr > > >>> clr.AddReference("IronPython.Zlib") > Traceback (most recent call last): > File "", line 1, in > IOError: System.IO.IOException: Could not add reference to assembly > IronPython.Z > lib > at > Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call(Object[] arg > s, Boolean& shouldOptimize) > at > IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`2.Call1(Cal > lSite site, CodeContext context, TFuncType func, T0 arg0) > at > System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite s > ite, T0 arg0, T1 arg1, T2 arg2) > at IronPython.Runtime.PythonFunction.FunctionCaller`1.Call1(CallSite > site, Co > deContext context, Object func, T0 arg0) > at > IronPython.Compiler.Ast.CallExpression.Invoke1Instruction.Run(InterpretedF > rame frame) > at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame > frame) > at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, > T1 a > rg1) > at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx) > at IronPython.Compiler.PythonScriptCode.Run(Scope scope) > at > IronPython.Hosting.PythonCommandLine.<>c__DisplayClass1. >b__0() > > > > > On Thu, Jun 3, 2010 at 11:51 AM, Jeff Hardy wrote: > >> On Thu, Jun 3, 2010 at 12:04 PM, Michael Foord >> wrote: >> > I haven't tried this, but I assume you have to add a reference to the >> > assembly before you can import from it. Try: >> > >> > import clr >> > clr.AddReference('IronPython.Zlib') >> > >> >> This shouldn't be necessary, as any DLL in the DLLs folder is >> automatically referenced, but it is worth trying. If it fails, it >> might provide a more useful error message. >> >> Andrew: You shouldn't have to set any environment variables to use >> IronPython.Zlib; I have a feeling that, for some reason, the DLL is >> failing to load. Which versions of IronPython and IronPython.Zlib are >> you using? What path is your IronPython installed to? >> >> - Jeff >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdhardy at gmail.com Thu Jun 3 22:10:39 2010 From: jdhardy at gmail.com (Jeff Hardy) Date: Thu, 3 Jun 2010 14:10:39 -0600 Subject: [IronPython] No Module named Zlib import error after installing DLL In-Reply-To: References: <4C07EE9D.9090808@voidspace.org.uk> Message-ID: On Thu, Jun 3, 2010 at 1:42 PM, Andrew Evans wrote: > Hello > > I downloaded IronPython 2.6 the one not using dot net framework 4 and > everything works now :-) That was going to be my next suggestion :). There is also a .NET 4 version of IronPython.Zlib available from http://bitbucket.org/jdhardy/ironpythonzlib/downloads. It would be nice to have one version for both but with the changes from .NET 2 to .NET 4 DLR I'm not sure that's possible. - Jeff From s.j.dower at gmail.com Fri Jun 4 02:41:25 2010 From: s.j.dower at gmail.com (Steve Dower) Date: Fri, 4 Jun 2010 10:41:25 +1000 Subject: [IronPython] IronPy Tools - updates? Message-ID: Hi, Just wondering what the outlook is for an update to IronPy Tools for VS? Normally I don't bug developers about this, but my motivation for asking this time is that I've actually stopped using it. I've been working on a Word document that's in my project root folder (-1 for putting binary files under version control, though TortoiseSVN nicely hooks into Word's 'compare documents' feature) and every time I save it - AFAICT, literally every time - VS crashes and restarts. I suspect it's to do with the temporary files that Word creates when saving and the implicit project feature of IronPy Tools, since this is already known to dislike things changing too quickly. (Yes, I could copy my document to another directory to work on it. Nobody else is touching the doc except me at the moment, but it turns out to be less painful to use Explorer and Notepad2 to get through the project for when I need a quick code reference.) I'm keen to keep sending feedback/bugs, though it's tough at this stage when the major issues in CTP2 are probably fixed or updated out (plus it would help my tester-fatigue to get a newer version :) ). Cheers, Steve From dinov at microsoft.com Fri Jun 4 20:50:05 2010 From: dinov at microsoft.com (Dino Viehland) Date: Fri, 4 Jun 2010 18:50:05 +0000 Subject: [IronPython] WPF Controls with Ipy In-Reply-To: References: <1A472770E042064698CB5ADC83A12ACD3967B0D8@TK5EX14MBXC116.redmond.corp.microsoft.com> <96E729AD36208D4DA2A5909C89A1C367138FE784@TK5EX14MBXW601.wingroup.windeploy.ntdev.microsoft.com> Message-ID: <1A472770E042064698CB5ADC83A12ACD4899F3BD@TK5EX14MBXC111.redmond.corp.microsoft.com> Ted wrote: > Trying to use third party controls with VS Tools for Ipy with WPF is not > working as expected. I can add a third party control if the language is c#, > but when I try and do the same thing using IronPython with WPF, the third > party controls do not get added to the designer as I expect. The VS interface > grays out for a second, and then it goes back to normal with nothing being > added. Could this be because we don't have a grid or canvas in the default template for a window? With our default templates I get this same experience (grey out, nothing happens) for both 3rd party and normal WPF controls. If I add a Canvas or a Grid then I'm able to drag and drop controls onto the surface. There's still issues at that point of not actually having the references added but I think if I made sure the assemblies were deployable and did a clr.AddReference then it'd work (we have plans to improve that). So I think we just need to update the template to match the same sort of template that C# produces by default. From dinov at microsoft.com Fri Jun 4 20:46:38 2010 From: dinov at microsoft.com (Dino Viehland) Date: Fri, 4 Jun 2010 18:46:38 +0000 Subject: [IronPython] IronPy Tools - updates? In-Reply-To: References: Message-ID: <1A472770E042064698CB5ADC83A12ACD4899F3C2@TK5EX14MBXC111.redmond.corp.microsoft.com> Steve wrote: > Just wondering what the outlook is for an update to IronPy Tools for > VS? Normally I don't bug developers about this, but my motivation for > asking this time is that I've actually stopped using it. > > I've been working on a Word document that's in my project root folder > (-1 for putting binary files under version control, though TortoiseSVN > nicely hooks into Word's 'compare documents' feature) and every time I > save it - AFAICT, literally every time - VS crashes and restarts. I > suspect it's to do with the temporary files that Word creates when > saving and the implicit project feature of IronPy Tools, since this is > already known to dislike things changing too quickly. > > (Yes, I could copy my document to another directory to work on it. > Nobody else is touching the doc except me at the moment, but it turns > out to be less painful to use Explorer and Notepad2 to get through the > project for when I need a quick code reference.) > > I'm keen to keep sending feedback/bugs, though it's tough at this > stage when the major issues in CTP2 are probably fixed or updated out > (plus it would help my tester-fatigue to get a newer version :) ). Bummer you've reached the point of unusability.... We'll probably try and get a new release out in the next couple of weeks. I'm at TechEd all next week but I still might be able to produce the build and go through all of the release process remotely. If not it'll have to wait until the week after that. From evans.d.andrew at gmail.com Sat Jun 5 01:04:36 2010 From: evans.d.andrew at gmail.com (Andrew Evans) Date: Fri, 4 Jun 2010 16:04:36 -0700 Subject: [IronPython] No Module named Zlib import error after installing DLL In-Reply-To: References: <4C07EE9D.9090808@voidspace.org.uk> Message-ID: Thanks for the help *cheers Andrew On Thu, Jun 3, 2010 at 1:10 PM, Jeff Hardy wrote: > On Thu, Jun 3, 2010 at 1:42 PM, Andrew Evans > wrote: > > Hello > > > > I downloaded IronPython 2.6 the one not using dot net framework 4 and > > everything works now :-) > > That was going to be my next suggestion :). There is also a .NET 4 > version of IronPython.Zlib available from > http://bitbucket.org/jdhardy/ironpythonzlib/downloads. > > It would be nice to have one version for both but with the changes > from .NET 2 to .NET 4 DLR I'm not sure that's possible. > > - Jeff > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From s.j.dower at gmail.com Sat Jun 5 01:22:45 2010 From: s.j.dower at gmail.com (Steve Dower) Date: Sat, 5 Jun 2010 09:22:45 +1000 Subject: [IronPython] IronPy Tools - updates? In-Reply-To: <1A472770E042064698CB5ADC83A12ACD4899F3C2@TK5EX14MBXC111.redmond.corp.microsoft.com> References: <1A472770E042064698CB5ADC83A12ACD4899F3C2@TK5EX14MBXC111.redmond.corp.microsoft.com> Message-ID: Sounds great. My next couple of weeks are put aside for documentation purposes anyway, so there's not much coding on the cards anyway. Cheers, Steve On Sat, Jun 5, 2010 at 04:46, Dino Viehland wrote: > Steve wrote: >> Just wondering what the outlook is for an update to IronPy Tools for >> VS? Normally I don't bug developers about this, but my motivation for >> asking this time is that I've actually stopped using it. >> >> I've been working on a Word document that's in my project root folder >> (-1 for putting binary files under version control, though TortoiseSVN >> nicely hooks into Word's 'compare documents' feature) and every time I >> save it - AFAICT, literally every time - VS crashes and restarts. I >> suspect it's to do with the temporary files that Word creates when >> saving and the implicit project feature of IronPy Tools, since this is >> already known to dislike things changing too quickly. >> >> (Yes, I could copy my document to another directory to work on it. >> Nobody else is touching the doc except me at the moment, but it turns >> out to be less painful to use Explorer and Notepad2 to get through the >> project for when I need a quick code reference.) >> >> I'm keen to keep sending feedback/bugs, though it's tough at this >> stage when the major issues in CTP2 are probably fixed or updated out >> (plus it would help my tester-fatigue to get a newer version :) ). > > > Bummer you've reached the point of unusability.... ?We'll probably try > and get a new release out in the next couple of weeks. ?I'm at TechEd > all next week but I still might be able to produce the build and go > through all of the release process remotely. ?If not it'll have to wait > until the week after that. > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From abrahams84 at gmail.com Sun Jun 6 07:57:20 2010 From: abrahams84 at gmail.com (Ashley Abraham) Date: Sun, 6 Jun 2010 00:57:20 -0500 Subject: [IronPython] how to convert C# MarshalAs code to IronPython Message-ID: Hi, I have the following C# code and I am trying to do the same functionality in IronPython, any help is appreciated. I was trying to do the same functionality in IronPython using the clrtype.py from the IronPython-2.6-Samples and I am able to connect to the library and the function but I am having trouble passing array of strings. With the current code it only passes the first letter and then it crashes. I am trying to call cwavec(int, int, char *) and it is a C function which is part of the vniwave.dll and I am trying access it in IronPython. C# code: namespace PVWave { public class OPI { [DllImport("C:\\datk_code\\VNI\\wave\\bin\\bin.i386nt\\vniwave.dll", EntryPoint = "cwavec", ExactSpelling = false, CharSet = CharSet.Ansi, SetLastError = true)] public static extern unsafe int cwavec(Int32 action, Int32 nCmds, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr, SizeParamIndex = 10)] string[] cmds); } } Here is my attempt in IronPython: import clrtype import System import sys class OPI(object): "Description of Class" # Note that you could also the "ctypes" modules instead of pinvoke declarations __metaclass__ = clrtype.ClrClass sys.path.append("C:\\datk_code\\VNI\\wave\\bin\\bin.i386nt") from System.Runtime.InteropServices import DllImportAttribute, PreserveSigAttribute DllImport = clrtype.attribute(DllImportAttribute) PreserveSig = clrtype.attribute(PreserveSigAttribute) @staticmethod @DllImport("vniwave.dll") @PreserveSig() @clrtype.accepts(System.Int32, System.Int32, System.Array[System.String]) @clrtype.returns() def cwavec(action, nCommands, commands): raise RuntimeError("this should not get called") def call_pinvoke_method_pvwave(): print "Calling pinvoke pvwave methods:" actionNum = 2 nCommands = 1 commands = System.Array[System.String](['PRINT, "Connected to PV-Wave from IronPython"']) print "cwavec(action, nCommands, commands):" OPI.cwavec(actionNum, nCommands, commands) call_pinvoke_method_pvwave() Thanks Ash -------------- next part -------------- An HTML attachment was scrubbed... URL: From kristian.jaksch at gmail.com Sun Jun 6 10:20:32 2010 From: kristian.jaksch at gmail.com (Kristian Jaksch) Date: Sun, 6 Jun 2010 10:20:32 +0200 Subject: [IronPython] Dynamic keyword, Ironpython and Silverlight? Message-ID: Sorry if I've double sent this mail but I wasn't registred the first time and I'm not sure it got through: Is it possible to access IronPython code by using the dynamic keyword in Silverlight 4? I've found some examples like below: var ipy = Python.CreateRuntime(); dynamic test = ipy.UseFile("test.py"); //This throws "The method or operation is not implemented." test.Simple(); But I cannot get it to work in Silverlight. You can see the error message I get. If it is possible, can someone point me to a working sample? Thanks for help! -------------- next part -------------- An HTML attachment was scrubbed... URL: From sunzhiyue at 24x7lab.com Sun Jun 6 11:55:24 2010 From: sunzhiyue at 24x7lab.com (Zhi-Yue Sun) Date: Sun, 6 Jun 2010 17:55:24 +0800 Subject: [IronPython] Dynamic keyword, Ironpython and Silverlight? In-Reply-To: References: Message-ID: Did you add this reference Microsoft.CSharp.dll? You should add this reference so that the dynamic keyword can work in the code. On Sun, Jun 6, 2010 at 4:20 PM, Kristian Jaksch wrote: > Sorry if I've double sent this mail but I wasn't registred the first time > and I'm not sure it got through: > > Is it possible to access IronPython code by using the dynamic keyword in > Silverlight 4? I've found some examples like below: > > var ipy = Python.CreateRuntime(); > dynamic test = ipy.UseFile("test.py"); //This throws "The > method or operation is not implemented." > test.Simple(); > > But I cannot get it to work in Silverlight. You can see the error message I > get. If it is possible, can someone point me to a working sample? > > Thanks for help! > _______________________________________________ > 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 Jun 6 16:48:43 2010 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sun, 6 Jun 2010 07:48:43 -0700 Subject: [IronPython] how to convert C# MarshalAs code to IronPython In-Reply-To: References: Message-ID: You'd need to decorate the string array parameter with a lot more information -- it's an ANSI string rather than a Unicode string, for instance, and there's another parameter that describes the length of the array. But I just looked at the code for clrtype.accepts, and it doesn't appear to support decorating the parameter types with additional attributes. If you can get at the TypeBuilder -- and I know this used to be possible -- then the easiest way to implement this is probably just to call TypeBuilder.DefinePInvokeMethod directly. Is there a typo in the C# code? It looks like SizeParamIndex should be 1 and not 10. On Sat, Jun 5, 2010 at 10:57 PM, Ashley Abraham wrote: > Hi, > I have the following C# code and I am trying to do the same > functionality in IronPython, any help is appreciated. > > I was trying to do the same functionality in IronPython using the > clrtype.py from the IronPython-2.6-Samples and I am able to connect to the > library and the function but I am having trouble passing array of strings. > With the current code it only passes the first letter and then it crashes. > > I am trying to call cwavec(int, int, char *) and it is a C function which > is part of the vniwave.dll and I am trying access it in IronPython. > > C# code: > > namespace PVWave > { > public class OPI > { > > [DllImport("C:\\datk_code\\VNI\\wave\\bin\\bin.i386nt\\vniwave.dll", > EntryPoint = "cwavec", > ExactSpelling = false, > CharSet = CharSet.Ansi, > SetLastError = true)] > public static extern unsafe int cwavec(Int32 action, Int32 nCmds, > [MarshalAs(UnmanagedType.LPArray, ArraySubType = > UnmanagedType.LPStr, SizeParamIndex = 10)] string[] cmds); > > } > } > > Here is my attempt in IronPython: > > import clrtype > import System > import sys > > class OPI(object): > "Description of Class" > > # Note that you could also the "ctypes" modules instead of pinvoke > declarations > __metaclass__ = clrtype.ClrClass > > sys.path.append("C:\\datk_code\\VNI\\wave\\bin\\bin.i386nt") > > from System.Runtime.InteropServices import DllImportAttribute, > PreserveSigAttribute > DllImport = clrtype.attribute(DllImportAttribute) > PreserveSig = clrtype.attribute(PreserveSigAttribute) > > > @staticmethod > @DllImport("vniwave.dll") > @PreserveSig() > @clrtype.accepts(System.Int32, System.Int32, > System.Array[System.String]) > @clrtype.returns() > def cwavec(action, nCommands, commands): raise RuntimeError("this > should not get called") > > def call_pinvoke_method_pvwave(): > print "Calling pinvoke pvwave methods:" > actionNum = 2 > nCommands = 1 > commands = System.Array[System.String](['PRINT, "Connected to PV-Wave > from IronPython"']) > print "cwavec(action, nCommands, commands):" > OPI.cwavec(actionNum, nCommands, commands) > > call_pinvoke_method_pvwave() > > Thanks > Ash > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kristian.jaksch at gmail.com Sun Jun 6 21:03:09 2010 From: kristian.jaksch at gmail.com (Kristian Jaksch) Date: Sun, 6 Jun 2010 21:03:09 +0200 Subject: [IronPython] Dynamic keyword, Ironpython and Silverlight? Message-ID: In the example I attached I'm not even sure that the "dynamic" keyword is the problem here. Even if I do like below (in silverlight): var ipy = Python.CreateRuntime(); ipy.UseFile("test.py"); //This still throws the same exception Does anyone perhaps has a working SL example that I can look at where the dynamic keyword is used with python files? Thanks for your help! -------------- next part -------------- An HTML attachment was scrubbed... URL: From abrahams84 at gmail.com Sun Jun 6 21:15:17 2010 From: abrahams84 at gmail.com (Ashley Abraham) Date: Sun, 6 Jun 2010 14:15:17 -0500 Subject: [IronPython] how to convert C# MarshalAs code to IronPython In-Reply-To: References: Message-ID: Is it a good approach to use clrtype.py or is there a better way to call the C function from IronPython... Also, the SizeParamIndex works ok when it is set to 10 in VS2005, but it does error out when used in VS2010, then I set it to 1. Thanks Ashley On Sun, Jun 6, 2010 at 9:48 AM, Curt Hagenlocher wrote: > You'd need to decorate the string array parameter with a lot more > information -- it's an ANSI string rather than a Unicode string, for > instance, and there's another parameter that describes the length of the > array. But I just looked at the code for clrtype.accepts, and it doesn't > appear to support decorating the parameter types with additional attributes. > If you can get at the TypeBuilder -- and I know this used to be possible -- > then the easiest way to implement this is probably just to call > TypeBuilder.DefinePInvokeMethod directly. > > > Is there a typo in the C# code? It looks like SizeParamIndex should be 1 > and not 10. > > On Sat, Jun 5, 2010 at 10:57 PM, Ashley Abraham wrote: > >> Hi, >> I have the following C# code and I am trying to do the same >> functionality in IronPython, any help is appreciated. >> >> I was trying to do the same functionality in IronPython using the >> clrtype.py from the IronPython-2.6-Samples and I am able to connect to the >> library and the function but I am having trouble passing array of strings. >> With the current code it only passes the first letter and then it crashes. >> >> I am trying to call cwavec(int, int, char *) and it is a C function >> which is part of the vniwave.dll and I am trying access it in IronPython. >> >> C# code: >> >> namespace PVWave >> { >> public class OPI >> { >> >> [DllImport("C:\\datk_code\\VNI\\wave\\bin\\bin.i386nt\\vniwave.dll", >> EntryPoint = "cwavec", >> ExactSpelling = false, >> CharSet = CharSet.Ansi, >> SetLastError = true)] >> public static extern unsafe int cwavec(Int32 action, Int32 nCmds, >> [MarshalAs(UnmanagedType.LPArray, ArraySubType = >> UnmanagedType.LPStr, SizeParamIndex = 10)] string[] cmds); >> >> } >> } >> >> Here is my attempt in IronPython: >> >> import clrtype >> import System >> import sys >> >> class OPI(object): >> "Description of Class" >> >> # Note that you could also the "ctypes" modules instead of pinvoke >> declarations >> __metaclass__ = clrtype.ClrClass >> >> sys.path.append("C:\\datk_code\\VNI\\wave\\bin\\bin.i386nt") >> >> from System.Runtime.InteropServices import DllImportAttribute, >> PreserveSigAttribute >> DllImport = clrtype.attribute(DllImportAttribute) >> PreserveSig = clrtype.attribute(PreserveSigAttribute) >> >> >> @staticmethod >> @DllImport("vniwave.dll") >> @PreserveSig() >> @clrtype.accepts(System.Int32, System.Int32, >> System.Array[System.String]) >> @clrtype.returns() >> def cwavec(action, nCommands, commands): raise RuntimeError("this >> should not get called") >> >> def call_pinvoke_method_pvwave(): >> print "Calling pinvoke pvwave methods:" >> actionNum = 2 >> nCommands = 1 >> commands = System.Array[System.String](['PRINT, "Connected to PV-Wave >> from IronPython"']) >> print "cwavec(action, nCommands, commands):" >> OPI.cwavec(actionNum, nCommands, commands) >> >> call_pinvoke_method_pvwave() >> >> Thanks >> Ash >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.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 jdhardy at gmail.com Mon Jun 7 04:07:22 2010 From: jdhardy at gmail.com (Jeff Hardy) Date: Sun, 6 Jun 2010 20:07:22 -0600 Subject: [IronPython] how to convert C# MarshalAs code to IronPython In-Reply-To: References: Message-ID: On Sun, Jun 6, 2010 at 1:15 PM, Ashley Abraham wrote: > Is it a good approach to use clrtype.py or is there a better way to call the > C function from IronPython... Try using ctypes (http://docs.python.org/library/ctypes.html) instead. It's a lot easier to use than P/Invoke, and your code should work on any Python implementation instead of just IronPython. - Jeff From abrahams84 at gmail.com Mon Jun 7 04:13:24 2010 From: abrahams84 at gmail.com (Ashley Abraham) Date: Sun, 6 Jun 2010 21:13:24 -0500 Subject: [IronPython] how to convert C# MarshalAs code to IronPython In-Reply-To: References: Message-ID: Our current app is Python based and I wanted to move to IronPython because of the .NET and WinForms. I have it working well with Python and swig and now I am trying to figure out how to do it using IronPython. I am very curious whether is there any direct conversion from C# code from my first post/email to IronPython code??? Thanks Ash On Sun, Jun 6, 2010 at 9:07 PM, Jeff Hardy wrote: > On Sun, Jun 6, 2010 at 1:15 PM, Ashley Abraham > wrote: > > Is it a good approach to use clrtype.py or is there a better way to call > the > > C function from IronPython... > > Try using ctypes (http://docs.python.org/library/ctypes.html) instead. > It's a lot easier to use than P/Invoke, and your code should work on > any Python implementation instead of just IronPython. > > - Jeff > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From abrahams84 at gmail.com Mon Jun 7 04:20:25 2010 From: abrahams84 at gmail.com (Ashley Abraham) Date: Sun, 6 Jun 2010 21:20:25 -0500 Subject: [IronPython] how to convert C# MarshalAs code to IronPython In-Reply-To: References: Message-ID: Jeff, I think I miss read your reply, what you are saying is that if it based on ctypes it will work in IronPython as well is it?? I thought you needed IronClad and so on make it work. Thanks Ash On Sun, Jun 6, 2010 at 9:13 PM, Ashley Abraham wrote: > Our current app is Python based and I wanted to move to IronPython because > of the .NET and WinForms. I have it working well with Python and swig and > now I am trying to figure out how to do it using IronPython. > > I am very curious whether is there any direct conversion from C# code from > my first post/email to IronPython code??? > > Thanks > Ash > > > On Sun, Jun 6, 2010 at 9:07 PM, Jeff Hardy wrote: > >> On Sun, Jun 6, 2010 at 1:15 PM, Ashley Abraham >> wrote: >> > Is it a good approach to use clrtype.py or is there a better way to call >> the >> > C function from IronPython... >> >> Try using ctypes (http://docs.python.org/library/ctypes.html) instead. >> It's a lot easier to use than P/Invoke, and your code should work on >> any Python implementation instead of just IronPython. >> >> - Jeff >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sunzhiyue at 24x7lab.com Mon Jun 7 04:50:12 2010 From: sunzhiyue at 24x7lab.com (Zhi-Yue Sun) Date: Mon, 7 Jun 2010 10:50:12 +0800 Subject: [IronPython] Dynamic keyword, Ironpython and Silverlight? In-Reply-To: References: Message-ID: Sorry, I can't see your attach. But there is an example Jimmy wrote. You can download it here http://jimmy.schementi.com/downloads/ipy-sl4-20100507.zip . Hope useful to you. -ZhiYue Sun On Mon, Jun 7, 2010 at 3:03 AM, Kristian Jaksch wrote: > In the example I attached I'm not even sure that the "dynamic" keyword is > the problem here. Even if I do like below (in silverlight): > > var ipy = Python.CreateRuntime(); > ipy.UseFile("test.py"); //This still throws the same exception > > Does anyone perhaps has a working SL example that I can look at where the > dynamic keyword is used with python files? > > Thanks for your help! > > > _______________________________________________ > 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 matt at tplus1.com Mon Jun 7 14:43:41 2010 From: matt at tplus1.com (Matthew Wilson) Date: Mon, 7 Jun 2010 12:43:41 +0000 (UTC) Subject: [IronPython] How should I install packages? Message-ID: I've got an all-python package that should be compatible with ironpython. It seems like distutils.setup doesn't exist though, so my original setup.py script won't work. I might tweak my setup.py so that when it can't find a distutils.setup, it goes into "ironpython mode" and then just manually copies stuff. So where should I install stuff? Just copy it somewhere in sys.path? Is there a convention other people are following? Matt PS and OT: I'm trying to use gmane to access this mailing list with slrn (a command-line newsreader) and while I can post to the list, no new posts ever show up. I use gmane and slrn to read a lot of other lists and they work fine. Any ideas? From ncichris at gmail.com Mon Jun 7 15:14:34 2010 From: ncichris at gmail.com (Christos Pavlides) Date: Mon, 7 Jun 2010 16:14:34 +0300 Subject: [IronPython] Multi threaded engine Message-ID: <000301cb0643$6076b940$21642bc0$@com> I am investigating different possibilities regarding multithreading and Iron Python and I would appreciate some pointers. What I am currently doing is I allow the user to enter some pseudocode that will become some business logic running in a high traffic application server. The main properties of this project is that the user has to be able to change these rules ad hoc and then ask then server to load the rules. The server will load the rules convert these to IronPython, compile the code and then for each message run the compile code against some parameters retrieved from the message. Since there are hundreds of messages coming in the server per second to make this work with multiple threads I defined the ScriptEngine and the CompiledCode as [ThreadStatic]. Therefore every time I have to use the engine and the engine is null I will create a new engine (one per thread). Then I will retrieve all the rules from the DB convert the rules to Python code, and compile the code using engine.CreateScriptSourceFromString(), source.Compile. Then to run the rules on the message I create a Microsoft.Scripting.ScopeStorage, call .SetValue to set each parameter that I want to be used by the script, then use the engine to CreateScope and use the compiled code and that Scope to execute the script. Everything seems to work fine but I am wondering if this is the proper way to do this. I have not seen anywhere any references to multithreaded uses of IronPython and this creates some uncertainties to me. What I would like to know is if there is a more elegant and faster way to do this, since the rules start getting bigger and bigger and this slows down both compilation and execution of the scripts. I am thinking that it could be better if the ScriptEngine and CompiledCode are thread safe, and if I create one static engine an one static CompliledCode then this will minimize the compile time since the rules will have to be compiled one time and then reused for all threads. Anyway any tips on running dynamic IronPython code are welcome. -------------- next part -------------- An HTML attachment was scrubbed... URL: From twyatt at ppi.ca Mon Jun 7 15:15:13 2010 From: twyatt at ppi.ca (Tim P. Wyatt) Date: Mon, 7 Jun 2010 06:15:13 -0700 Subject: [IronPython] Tim Wyatt is out of the office Message-ID: I will be out of the office starting 07/06/2010 and will not return until 09/06/2010. I will be reviewing my email less frequently than usual. For urgent matters please contact the Vancouver Help Desk at 1-800-661-7712 (helpdesk at ppi.ca) From jdhardy at gmail.com Mon Jun 7 17:02:09 2010 From: jdhardy at gmail.com (Jeff Hardy) Date: Mon, 7 Jun 2010 09:02:09 -0600 Subject: [IronPython] how to convert C# MarshalAs code to IronPython In-Reply-To: References: Message-ID: On Sun, Jun 6, 2010 at 8:20 PM, Ashley Abraham wrote: > Jeff, > ??? I think I miss read your reply, what you are saying is that if it based > on ctypes it will work in IronPython as well is it?? I thought you needed > IronClad and so on make it work. Yeah, with ctypes IronPython can call native code directly - it actually uses P/Invoke behind the scenes to do it. Python also implements ctypes, as do Jython and PyPy, so any code that you write using ctypes should work on any Python implementation. I haven't tested this (seeing as I don't have the exact DLL) but it should be pretty close: from ctypes import * vniwave = CDLL('vniwave.dll') cwavec = vniwave.cwavec cwavec.restype = c_int cwavec.argtypes = [c_int, c_int, POINTER(c_char_p)] The only part I'm not sure about is the string[] - I'm assuming the C function takes a char**. Alternatively, you could write the P/Invoke declarations in a C# class library and load that into IronPython using clr.AddReference, but I'd recommend using ctypes. - Jeff From jdhardy at gmail.com Mon Jun 7 17:08:44 2010 From: jdhardy at gmail.com (Jeff Hardy) Date: Mon, 7 Jun 2010 09:08:44 -0600 Subject: [IronPython] Multi threaded engine In-Reply-To: <000301cb0643$6076b940$21642bc0$@com> References: <000301cb0643$6076b940$21642bc0$@com> Message-ID: On Mon, Jun 7, 2010 at 7:14 AM, Christos Pavlides wrote: > I am thinking that it could be better if the ScriptEngine and CompiledCode > are thread safe, and if I create one static engine an one static > CompliledCode then this will minimize the compile time since the rules will > have to be compiled one time and then reused for all threads. My understanding is that this is the case - for NWSGI I use a single engine (per AppDomain, but that's not important) and each script is compiled once into a CompiledCode object. On each request it gets a new scope from the engine, finds the CompiledCode for the requested script, and executes it in that scope. IIS can have a lot of worker threads handling requests at any time, so it's basically the same scenario you have. As long as you don't reuse scopes (and they're very cheap to create) you should be just fine. - Jeff From merllab at microsoft.com Mon Jun 7 17:08:57 2010 From: merllab at microsoft.com (merllab at microsoft.com) Date: Mon, 7 Jun 2010 08:08:57 -0700 Subject: [IronPython] IronPython 2.6 CodePlex Source Update Message-ID: This is an automated email letting you know that sources have recently been pushed out. You can download these newer sources directly from http://ironpython.codeplex.com/SourceControl/changeset/view/67132. MODIFIED SOURCES $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting/Hosting/ObjectOperations.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Ast/GeneratorRewriter.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Ast/GeneratorExpression.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting/Hosting/ScriptScope.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting/Microsoft.Scripting.csproj $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting/Runtime/Scope.cs From dinov at microsoft.com Mon Jun 7 17:53:22 2010 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 7 Jun 2010 15:53:22 +0000 Subject: [IronPython] Multi threaded engine In-Reply-To: References: <000301cb0643$6076b940$21642bc0$@com> Message-ID: <1A472770E042064698CB5ADC83A12ACD489CFF61@TK5EX14MBXC111.redmond.corp.microsoft.com> Jeff wrote: > On Mon, Jun 7, 2010 at 7:14 AM, Christos Pavlides > wrote: > > I am thinking that it could be better if the ScriptEngine and > CompiledCode > > are thread safe, and if I create one static engine an one static > > CompliledCode then this will minimize the compile time since the > rules will > > have to be compiled one time and then reused for all threads. > > My understanding is that this is the case - for NWSGI I use a single > engine (per AppDomain, but that's not important) and each script is > compiled once into a CompiledCode object. On each request it gets a > new scope from the engine, finds the CompiledCode for the requested > script, and executes it in that scope. IIS can have a lot of worker > threads handling requests at any time, so it's basically the same > scenario you have. As long as you don't reuse scopes (and they're very > cheap to create) you should be just fine. This is correct and is definitely the recommended way to do this. The only reason to separate it out into separate ScriptEngine instances is if you want isolation between the script engines themselves so that one piece of user code cannot see another piece of user code. From jdhardy at gmail.com Mon Jun 7 18:39:52 2010 From: jdhardy at gmail.com (Jeff Hardy) Date: Mon, 7 Jun 2010 10:39:52 -0600 Subject: [IronPython] Multi threaded engine In-Reply-To: <1A472770E042064698CB5ADC83A12ACD489CFF61@TK5EX14MBXC111.redmond.corp.microsoft.com> References: <000301cb0643$6076b940$21642bc0$@com> <1A472770E042064698CB5ADC83A12ACD489CFF61@TK5EX14MBXC111.redmond.corp.microsoft.com> Message-ID: On Mon, Jun 7, 2010 at 9:53 AM, Dino Viehland wrote: > This is correct and is definitely the recommended way to do this. ?The > only reason to separate it out into separate ScriptEngine instances is > if you want isolation between the script engines themselves so that > one piece of user code cannot see another piece of user code. What do you mean be "see"? One script could potentially examine the code of another script in the same script engine? - Jeff From abrahams84 at gmail.com Mon Jun 7 18:41:14 2010 From: abrahams84 at gmail.com (Ashley Abraham) Date: Mon, 7 Jun 2010 11:41:14 -0500 Subject: [IronPython] Ironpython attribute validation Message-ID: Hi, In Python I am used to using enthought's Traits to validate attributes and explicitly declare variable types, is there anything similar to that in IronPython. Also, when I try to import enthought's traits module (with ironclad) in IronPython I get ImportError: No module named zipimport is there a way around to get around this??? is IronPython compatible with setuptools?? Thanks Ash -------------- next part -------------- An HTML attachment was scrubbed... URL: From abrahams84 at gmail.com Mon Jun 7 18:42:43 2010 From: abrahams84 at gmail.com (Ashley Abraham) Date: Mon, 7 Jun 2010 11:42:43 -0500 Subject: [IronPython] how to convert C# MarshalAs code to IronPython In-Reply-To: References: Message-ID: I'll try the ctypes... thanks for pointing me in the right direction and your help is much appreciated. Ash On Mon, Jun 7, 2010 at 10:02 AM, Jeff Hardy wrote: > On Sun, Jun 6, 2010 at 8:20 PM, Ashley Abraham > wrote: > > Jeff, > > I think I miss read your reply, what you are saying is that if it > based > > on ctypes it will work in IronPython as well is it?? I thought you needed > > IronClad and so on make it work. > > Yeah, with ctypes IronPython can call native code directly - it > actually uses P/Invoke behind the scenes to do it. Python also > implements ctypes, as do Jython and PyPy, so any code that you write > using ctypes should work on any Python implementation. > > I haven't tested this (seeing as I don't have the exact DLL) but it > should be pretty close: > > from ctypes import * > vniwave = CDLL('vniwave.dll') > > cwavec = vniwave.cwavec > cwavec.restype = c_int > cwavec.argtypes = [c_int, c_int, POINTER(c_char_p)] > > The only part I'm not sure about is the string[] - I'm assuming the C > function takes a char**. > > Alternatively, you could write the P/Invoke declarations in a C# class > library and load that into IronPython using clr.AddReference, but I'd > recommend using ctypes. > > - Jeff > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdhardy at gmail.com Mon Jun 7 18:49:32 2010 From: jdhardy at gmail.com (Jeff Hardy) Date: Mon, 7 Jun 2010 10:49:32 -0600 Subject: [IronPython] Ironpython attribute validation In-Reply-To: References: Message-ID: On Mon, Jun 7, 2010 at 10:41 AM, Ashley Abraham wrote: > Hi, > ?? In Python I am used to using enthought's Traits to validate attributes > and explicitly declare variable types, is there anything similar to that in > IronPython. Also, when I try to import enthought's traits module (with > ironclad) in IronPython I get ImportError: No module named zipimport is > there a way around to get around this??? is IronPython compatible with > setuptools?? There isn't a zipimport for IronPython, unfortunately. It's also the big hurdle preventing setuptools/distribute from fully working (it mostly works, if you can avoid zipped eggs). I tried to get it to work a long time ago but never had time to finish it. - Jeff From abrahams84 at gmail.com Mon Jun 7 19:33:28 2010 From: abrahams84 at gmail.com (Ashley Abraham) Date: Mon, 7 Jun 2010 12:33:28 -0500 Subject: [IronPython] Ironpython attribute validation In-Reply-To: References: Message-ID: is there any other module similar to Traits in IronPython which I can use to explicitly declare the attributes and to do type validation?? Thanks Ash On Mon, Jun 7, 2010 at 11:49 AM, Jeff Hardy wrote: > On Mon, Jun 7, 2010 at 10:41 AM, Ashley Abraham > wrote: > > Hi, > > In Python I am used to using enthought's Traits to validate attributes > > and explicitly declare variable types, is there anything similar to that > in > > IronPython. Also, when I try to import enthought's traits module (with > > ironclad) in IronPython I get ImportError: No module named zipimport is > > there a way around to get around this??? is IronPython compatible with > > setuptools?? > > There isn't a zipimport for IronPython, unfortunately. It's also the > big hurdle preventing setuptools/distribute from fully working (it > mostly works, if you can avoid zipped eggs). I tried to get it to work > a long time ago but never had time to finish it. > > - Jeff > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ncichris at gmail.com Mon Jun 7 19:55:21 2010 From: ncichris at gmail.com (Christos Pavlides) Date: Mon, 7 Jun 2010 20:55:21 +0300 Subject: [IronPython] Multi threaded engine In-Reply-To: References: <000301cb0643$6076b940$21642bc0$@com> Message-ID: <002201cb066a$9af923b0$d0eb6b10$@com> Thanks Jeff, This is the recommendation I was expecting to get. I will run a high concurrency test on a single engine and single compiled code, with new scopes for each request and see where it takes me. Do I need any locks on the engine itself when Getting the scope (which could be called from many threads at the same time)? I have another question related to performance. Right now I have a number of parameters that I need to pass to the CompiledCode and I use Microsoft.Scripting.ScopeStorage.SetValue and then create the scope using this. Is there a more efficient way to pass parameters to the CompiledCode? Like creating an single "parameter" object which is well known by both the IronPython code and my C# code? Thanks Christos -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jeff Hardy Sent: Monday, June 07, 2010 6:09 PM To: Discussion of IronPython Subject: Re: [IronPython] Multi threaded engine On Mon, Jun 7, 2010 at 7:14 AM, Christos Pavlides wrote: > I am thinking that it could be better if the ScriptEngine and CompiledCode > are thread safe, and if I create one static engine an one static > CompliledCode then this will minimize the compile time since the rules will > have to be compiled one time and then reused for all threads. My understanding is that this is the case - for NWSGI I use a single engine (per AppDomain, but that's not important) and each script is compiled once into a CompiledCode object. On each request it gets a new scope from the engine, finds the CompiledCode for the requested script, and executes it in that scope. IIS can have a lot of worker threads handling requests at any time, so it's basically the same scenario you have. As long as you don't reuse scopes (and they're very cheap to create) you should be just fine. - Jeff _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From jdhardy at gmail.com Mon Jun 7 20:04:41 2010 From: jdhardy at gmail.com (Jeff Hardy) Date: Mon, 7 Jun 2010 12:04:41 -0600 Subject: [IronPython] Ironpython attribute validation In-Reply-To: References: Message-ID: On Mon, Jun 7, 2010 at 11:33 AM, Ashley Abraham wrote: > is there any other module similar to Traits in IronPython which I can use to > explicitly declare the attributes and to do type validation?? It looks like Traits itself isn't dependent on zipimport (it depends on setuptools, which requires zipimport), so you should be able to get away with putting an empty zipimport.py file somewhere on sys.path. I've done this before to get things setuptools stuff working; as long as it doesn't try to *use* zipimport, you're OK. I don't know of anything else that works the same, but it should be possible to make it work, if you can get IronClad to handle the C portion of it (they don't have a pure Python version, *grumble grumble*). - Jeff From jdhardy at gmail.com Mon Jun 7 20:06:20 2010 From: jdhardy at gmail.com (Jeff Hardy) Date: Mon, 7 Jun 2010 12:06:20 -0600 Subject: [IronPython] Multi threaded engine In-Reply-To: <002201cb066a$9af923b0$d0eb6b10$@com> References: <000301cb0643$6076b940$21642bc0$@com> <002201cb066a$9af923b0$d0eb6b10$@com> Message-ID: On Mon, Jun 7, 2010 at 11:55 AM, Christos Pavlides wrote: > Do I need any locks on the engine itself when Getting the scope (which could > be called from many threads at the same time)? The engine should handle those locks itself, but I don't have the source handy to check for sure. I'll let Dino handle the performance question :). - Jeff From abrahams84 at gmail.com Mon Jun 7 20:06:31 2010 From: abrahams84 at gmail.com (Ashley Abraham) Date: Mon, 7 Jun 2010 13:06:31 -0500 Subject: [IronPython] Ironpython attribute validation In-Reply-To: References: Message-ID: Thanks, I'll try your suggestion. Ash On Mon, Jun 7, 2010 at 1:04 PM, Jeff Hardy wrote: > On Mon, Jun 7, 2010 at 11:33 AM, Ashley Abraham > wrote: > > is there any other module similar to Traits in IronPython which I can use > to > > explicitly declare the attributes and to do type validation?? > > It looks like Traits itself isn't dependent on zipimport (it depends > on setuptools, which requires zipimport), so you should be able to get > away with putting an empty zipimport.py file somewhere on sys.path. > I've done this before to get things setuptools stuff working; as long > as it doesn't try to *use* zipimport, you're OK. > > I don't know of anything else that works the same, but it should be > possible to make it work, if you can get IronClad to handle the C > portion of it (they don't have a pure Python version, *grumble > grumble*). > > - Jeff > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ncichris at gmail.com Mon Jun 7 20:43:01 2010 From: ncichris at gmail.com (Christos Pavlides) Date: Mon, 7 Jun 2010 21:43:01 +0300 Subject: [IronPython] Multi threaded engine In-Reply-To: References: <000301cb0643$6076b940$21642bc0$@com> <002201cb066a$9af923b0$d0eb6b10$@com> Message-ID: <002901cb0671$432991e0$c97cb5a0$@com> Thanks Jeff, I think I will start looking at the source code, but if Dino can give some definite answers it will speed up my evaluation tremendously. Christos -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jeff Hardy Sent: Monday, June 07, 2010 9:06 PM To: Discussion of IronPython Subject: Re: [IronPython] Multi threaded engine On Mon, Jun 7, 2010 at 11:55 AM, Christos Pavlides wrote: > Do I need any locks on the engine itself when Getting the scope (which could > be called from many threads at the same time)? The engine should handle those locks itself, but I don't have the source handy to check for sure. I'll let Dino handle the performance question :). - Jeff _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From peter.masiar at gmail.com Mon Jun 7 21:56:42 2010 From: peter.masiar at gmail.com (Peter Masiar) Date: Mon, 7 Jun 2010 15:56:42 -0400 Subject: [IronPython] datetime.strptime is missing in IronPython? Message-ID: Seems like datetime in Ironpython has only strftime, but no strptime? IronPython 2.0.3 (2.0.0.0) on .NET 2.0.50727.3603 Type "help", "copyright", "credits" or "license" for more information. >>> import datetime >>> dir(datetime.datetime) ['CompareTo', '__add__', '__class__', '__delattr__', '__doc__', '__eq__', '__ge_ _', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__l e__', '__lt__', '__ne__', '__new__', '__nonzero__', '__radd__', '__reduce__', '_ _reduce_ex__', '__repr__', '__rsub__', '__setattr__', '__str__', '__sub__', 'ast imezone', 'combine', 'ctime', 'date', 'day', 'dst', 'fromordinal', 'fromtimestam p', 'hour', 'isocalendar', 'isoformat', 'isoweekday', 'max', 'microsecond', 'min ', 'minute', 'month', 'now', 'replace', 'resolution', 'second', 'strftime', 'tim e', 'timetuple', 'timetz', 'today', 'toordinal', 'tzinfo', 'tzname', 'utcfromtim estamp', 'utcnow', 'utcoffset', 'utctimetuple', 'weekday', 'year'] >>> Or do I have wrong/obsolete IronPython? Which one has datetime.strptime()? What I am missing? What is recommended way in IronPython to parse date/time string back to date object? Thanks! -- ----- Peter Masiar From drken567 at gmail.com Mon Jun 7 22:12:17 2010 From: drken567 at gmail.com (Ken MacDonald) Date: Mon, 7 Jun 2010 16:12:17 -0400 Subject: [IronPython] datetime.strptime is missing in IronPython? In-Reply-To: References: Message-ID: Hi Peter, I just did this myself; starting with the times that I parsed out from a TextBox, plus the yr/mo/day values from 'now': from System import DateTime *<== note: DateTime not datetime* new_time = DateTime(yr, mo, day, self.hh, self.mm, self.ss) I did find some other ways to do this by googling, but this worked nicely for me as I had already parsed/validated the TextBox time; I did also find some suggestion that strptime might appear in a future release.... how future, I can't say. Good luck! Ken On Mon, Jun 7, 2010 at 3:56 PM, Peter Masiar wrote: > Seems like datetime in Ironpython has only strftime, but no strptime? > > IronPython 2.0.3 (2.0.0.0) on .NET 2.0.50727.3603 > Type "help", "copyright", "credits" or "license" for more information. > >>> import datetime > >>> dir(datetime.datetime) > ['CompareTo', '__add__', '__class__', '__delattr__', '__doc__', '__eq__', > '__ge_ > _', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__init__', > '__l > e__', '__lt__', '__ne__', '__new__', '__nonzero__', '__radd__', > '__reduce__', '_ > _reduce_ex__', '__repr__', '__rsub__', '__setattr__', '__str__', '__sub__', > 'ast > imezone', 'combine', 'ctime', 'date', 'day', 'dst', 'fromordinal', > 'fromtimestam > p', 'hour', 'isocalendar', 'isoformat', 'isoweekday', 'max', 'microsecond', > 'min > ', 'minute', 'month', 'now', 'replace', 'resolution', 'second', 'strftime', > 'tim > e', 'timetuple', 'timetz', 'today', 'toordinal', 'tzinfo', 'tzname', > 'utcfromtim > estamp', 'utcnow', 'utcoffset', 'utctimetuple', 'weekday', 'year'] > >>> > > Or do I have wrong/obsolete IronPython? Which one has datetime.strptime()? > What I am missing? > > What is recommended way in IronPython to parse date/time string back > to date object? > > Thanks! > -- > ----- > Peter Masiar > _______________________________________________ > 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 abrahams84 at gmail.com Mon Jun 7 22:15:44 2010 From: abrahams84 at gmail.com (Ashley Abraham) Date: Mon, 7 Jun 2010 15:15:44 -0500 Subject: [IronPython] Question about IronPython tools for Visual Studio Message-ID: I am trying to use IronPython tools for Visual Studio and didn't know to how to start the IronPython Interactive console window with extra parameters, such as: -X:Frames, so that I can import numpy (along with ironclad). Thanks Ash -------------- next part -------------- An HTML attachment was scrubbed... URL: From drken567 at gmail.com Mon Jun 7 22:26:26 2010 From: drken567 at gmail.com (Ken MacDonald) Date: Mon, 7 Jun 2010 16:26:26 -0400 Subject: [IronPython] WPF/IronPython event handlers question - multiple event handlers Message-ID: Hi, I've got a whole stack of event handlers, assigned via the usual something like.... my_button.Click += button_was_clicked As it turns out, the initialization for the thing that has all these handlers may need to be run several times, and it seems like I ended up with multiple copies of the same event handler, and "button_was_clicked()" now gets invoked multiple times for EACH time I click my_button. It seems to be solved by just skipping the handler assignment if I've already done it before, but it seems odd that the same EH would be assigned and fired twice. Is this really what I'm seeing? I can see a case for assigning multiple * different* EH's: my_button.Click += event_handler_1 my_button.Click += event_handler_2 but then this begs the question, is there a defined order in which the EH's will fire? I looked thru multiple python/IronPython books and googled, but came up empty on both questions..... Hopefully someone here understands these things better than I do.... Ken -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Mon Jun 7 23:16:12 2010 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 7 Jun 2010 21:16:12 +0000 Subject: [IronPython] Multi threaded engine In-Reply-To: References: <000301cb0643$6076b940$21642bc0$@com> <1A472770E042064698CB5ADC83A12ACD489CFF61@TK5EX14MBXC111.redmond.corp.microsoft.com> Message-ID: <1A472770E042064698CB5ADC83A12ACD489D1A10@TK5EX14MBXC111.redmond.corp.microsoft.com> Jeff wrote: > On Mon, Jun 7, 2010 at 9:53 AM, Dino Viehland > wrote: > > This is correct and is definitely the recommended way to do this. > ?The > > only reason to separate it out into separate ScriptEngine instances > is > > if you want isolation between the script engines themselves so that > > one piece of user code cannot see another piece of user code. > > What do you mean be "see"? One script could potentially examine the > code of another script in the same script engine? For example you could import sys, publish an attribute on it, and another script could read it. Or you could go in and change "min" or "max" in __builtin__. Or you could go and mutate some read/write static field in the .NET framework. Basically while everything is thread safe there's no level of isolation between the scripts. It's probably nothing to be too concerned about I thought I'd mention it for completeness. From dinov at microsoft.com Mon Jun 7 23:30:05 2010 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 7 Jun 2010 21:30:05 +0000 Subject: [IronPython] Multi threaded engine In-Reply-To: <002201cb066a$9af923b0$d0eb6b10$@com> References: <000301cb0643$6076b940$21642bc0$@com> <002201cb066a$9af923b0$d0eb6b10$@com> Message-ID: <1A472770E042064698CB5ADC83A12ACD489D1D5A@TK5EX14MBXC111.redmond.corp.microsoft.com> Christos wrote: > Thanks Jeff, > This is the recommendation I was expecting to get. > I will run a high concurrency test on a single engine and single > compiled > code, with new scopes for each request and see where it takes me. > Do I need any locks on the engine itself when Getting the scope (which > could > be called from many threads at the same time)? Nope - no locks required. > > I have another question related to performance. > Right now I have a number of parameters that I need to pass to the > CompiledCode and I use Microsoft.Scripting.ScopeStorage.SetValue and > then > create the scope using this. > Is there a more efficient way to pass parameters to the CompiledCode? > Like > creating an single "parameter" object which is well known by both the > IronPython code and my C# code? The best way is to create the storage for the scope yourself. Right now the simplest (and sure to work) way to do that is to implement IAttributesCollection and create a scope using that for the storage. Then you can respond to the lookups lazily. But setting multiple variables on a scope shouldn't be that expensive (at least in 2.6.1 - there were some issues w/ that in 2.6). From dinov at microsoft.com Mon Jun 7 23:30:37 2010 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 7 Jun 2010 21:30:37 +0000 Subject: [IronPython] Question about IronPython tools for Visual Studio In-Reply-To: References: Message-ID: <1A472770E042064698CB5ADC83A12ACD489D1D98@TK5EX14MBXC111.redmond.corp.microsoft.com> There's currently no way to do this - we should add this to the TODO list and make it an option in Tools->Options. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ashley Abraham Sent: Monday, June 07, 2010 3:16 PM To: Discussion of IronPython Subject: [IronPython] Question about IronPython tools for Visual Studio I am trying to use IronPython tools for Visual Studio and didn't know to how to start the IronPython Interactive console window with extra parameters, such as: -X:Frames, so that I can import numpy (along with ironclad). Thanks Ash -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Mon Jun 7 23:41:27 2010 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 7 Jun 2010 14:41:27 -0700 Subject: [IronPython] WPF/IronPython event handlers question - multiple event handlers In-Reply-To: References: Message-ID: These are CLR-level issues. The first basically comes down to the fact that there's really no way to enumerate the handlers which have already been added to an event. As for the second, there is no contract that defines the order on which the handler will be called. But I suspect that the default implementation of an event -- which corresponds to just declaring "public event EventHandler MyEvent;" in C# -- would probably give consistent in-order results. On Mon, Jun 7, 2010 at 1:26 PM, Ken MacDonald wrote: > Hi, > I've got a whole stack of event handlers, assigned via the usual something > like.... > > my_button.Click += button_was_clicked > > As it turns out, the initialization for the thing that has all these > handlers may need to be run several times, and it seems like I ended up with > multiple copies of the same event handler, and "button_was_clicked()" now > gets invoked multiple times for EACH time I click my_button. It seems to be > solved by just skipping the handler assignment if I've already done it > before, but it seems odd that the same EH would be assigned and fired twice. > Is this really what I'm seeing? I can see a case for assigning multiple * > different* EH's: > > my_button.Click += event_handler_1 > my_button.Click += event_handler_2 > > but then this begs the question, is there a defined order in which the EH's > will fire? I looked thru multiple python/IronPython books and googled, but > came up empty on both questions..... Hopefully someone here understands > these things better than I do.... > Ken > > _______________________________________________ > 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 stephen.p.lepisto at intel.com Mon Jun 7 23:49:42 2010 From: stephen.p.lepisto at intel.com (Lepisto, Stephen P) Date: Mon, 7 Jun 2010 14:49:42 -0700 Subject: [IronPython] WPF/IronPython event handlers question - multiple event handlers In-Reply-To: References: Message-ID: <6AF28EB9F93A354894F2F3916DF6F96E0CA9D33A6F@orsmsx510.amr.corp.intel.com> This link, http://msdn.microsoft.com/en-us/vcsharp/bb508935.aspx, has more information about event handlers and the order in which they are called. The order is not specified in the CLR reference and therefore you should not depend on a specific order. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher Sent: Monday, June 07, 2010 2:41 PM To: Discussion of IronPython Subject: Re: [IronPython] WPF/IronPython event handlers question - multiple event handlers These are CLR-level issues. The first basically comes down to the fact that there's really no way to enumerate the handlers which have already been added to an event. As for the second, there is no contract that defines the order on which the handler will be called. But I suspect that the default implementation of an event -- which corresponds to just declaring "public event EventHandler MyEvent;" in C# -- would probably give consistent in-order results. On Mon, Jun 7, 2010 at 1:26 PM, Ken MacDonald > wrote: Hi, I've got a whole stack of event handlers, assigned via the usual something like.... my_button.Click += button_was_clicked As it turns out, the initialization for the thing that has all these handlers may need to be run several times, and it seems like I ended up with multiple copies of the same event handler, and "button_was_clicked()" now gets invoked multiple times for EACH time I click my_button. It seems to be solved by just skipping the handler assignment if I've already done it before, but it seems odd that the same EH would be assigned and fired twice. Is this really what I'm seeing? I can see a case for assigning multiple different EH's: my_button.Click += event_handler_1 my_button.Click += event_handler_2 but then this begs the question, is there a defined order in which the EH's will fire? I looked thru multiple python/IronPython books and googled, but came up empty on both questions..... Hopefully someone here understands these things better than I do.... Ken _______________________________________________ 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 Mon Jun 7 23:49:57 2010 From: jdhardy at gmail.com (Jeff Hardy) Date: Mon, 7 Jun 2010 15:49:57 -0600 Subject: [IronPython] Multi threaded engine In-Reply-To: <1A472770E042064698CB5ADC83A12ACD489D1A10@TK5EX14MBXC111.redmond.corp.microsoft.com> References: <000301cb0643$6076b940$21642bc0$@com> <1A472770E042064698CB5ADC83A12ACD489CFF61@TK5EX14MBXC111.redmond.corp.microsoft.com> <1A472770E042064698CB5ADC83A12ACD489D1A10@TK5EX14MBXC111.redmond.corp.microsoft.com> Message-ID: On Mon, Jun 7, 2010 at 3:16 PM, Dino Viehland wrote: > For example you could import sys, publish an attribute on it, and another > script could read it. ?Or you could go in and change "min" or "max" in > __builtin__. ?Or you could go and mutate some read/write static field in > the .NET framework. ?Basically while everything is thread safe there's > no level of isolation between the scripts. ?It's probably nothing to be > too concerned about I thought I'd mention it for completeness. Ah, got it - IIS isolates scripts using AppDomains anyway, so it shouldn't be a concern for me. - Jeff From tcronin at asrclkrec.com Mon Jun 7 23:52:08 2010 From: tcronin at asrclkrec.com (Cronin, Ted) Date: Mon, 7 Jun 2010 14:52:08 -0700 Subject: [IronPython] WPF Controls with Ipy In-Reply-To: <1A472770E042064698CB5ADC83A12ACD4899F3BD@TK5EX14MBXC111.redmond.corp.microsoft.com> References: <1A472770E042064698CB5ADC83A12ACD3967B0D8@TK5EX14MBXC116.redmond.corp.microsoft.com> <96E729AD36208D4DA2A5909C89A1C367138FE784@TK5EX14MBXW601.wingroup.windeploy.ntdev.microsoft.com> <1A472770E042064698CB5ADC83A12ACD4899F3BD@TK5EX14MBXC111.redmond.corp.microsoft.com> Message-ID: Yep, that's it, that's the behavior. Yes, it would be nice to have this behavior on by default for the Ipy templates. At least I have a workaround. Plans to streamline the AddRef process would be nice, too, looking forward to the next CTP, regardless of the aforementioned behaviors ;) Thank You, Dino. Ted Cronin ACR ValueGIS (951) 955 - 0487 -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: Friday, June 04, 2010 11:50 AM To: Discussion of IronPython Subject: Re: [IronPython] WPF Controls with Ipy Ted wrote: > Trying to use third party controls with VS Tools for Ipy with WPF is not > working as expected. I can add a third party control if the language is c#, > but when I try and do the same thing using IronPython with WPF, the third > party controls do not get added to the designer as I expect. The VS interface > grays out for a second, and then it goes back to normal with nothing being > added. Could this be because we don't have a grid or canvas in the default template for a window? With our default templates I get this same experience (grey out, nothing happens) for both 3rd party and normal WPF controls. If I add a Canvas or a Grid then I'm able to drag and drop controls onto the surface. There's still issues at that point of not actually having the references added but I think if I made sure the assemblies were deployable and did a clr.AddReference then it'd work (we have plans to improve that). So I think we just need to update the template to match the same sort of template that C# produces by default. _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Mon Jun 7 23:56:01 2010 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 07 Jun 2010 22:56:01 +0100 Subject: [IronPython] WPF/IronPython event handlers question - multiple event handlers In-Reply-To: References: Message-ID: <4C0D6AF1.5010203@voidspace.org.uk> On 07/06/2010 21:26, Ken MacDonald wrote: > Hi, > I've got a whole stack of event handlers, assigned via the usual > something like.... > > my_button.Click += button_was_clicked > > As it turns out, the initialization for the thing that has all these > handlers may need to be run several times, and it seems like I ended > up with multiple copies of the same event handler, and > "button_was_clicked()" now gets invoked multiple times for EACH time I > click my_button. It seems to be solved by just skipping the handler > assignment if I've already done it before, but it seems odd that the > same EH would be assigned and fired twice. It would seem odder to me if you added an event handler multiple times and it *wasn't* called. :-) The less programming languages read your mind and work out what they *think* you meant the better. If you don't want an event handler installed multiple times then don't add it multiple times... Michael Foord > Is this really what I'm seeing? I can see a case for assigning > multiple *different* EH's: > > my_button.Click += event_handler_1 > my_button.Click += event_handler_2 > > but then this begs the question, is there a defined order in which the > EH's will fire? I looked thru multiple python/IronPython books and > googled, but came up empty on both questions..... Hopefully someone > here understands these things better than I do.... > Ken > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. -------------- next part -------------- An HTML attachment was scrubbed... URL: From sunzhiyue at 24x7lab.com Tue Jun 8 03:21:48 2010 From: sunzhiyue at 24x7lab.com (Zhi-Yue Sun) Date: Tue, 8 Jun 2010 09:21:48 +0800 Subject: [IronPython] Where can I download the IronPython Tools for Visual Studio 2010 Message-ID: Hi all, I'm a new to IronPython Tools. I heard that IronPython Toos is cool. Can anyone tell me Where can I download the IronPython Tools for Visaul Studio 2010. Thanks, -ZhiYue Sun -------------- next part -------------- An HTML attachment was scrubbed... URL: From brian.curtin at gmail.com Tue Jun 8 03:23:32 2010 From: brian.curtin at gmail.com (Brian Curtin) Date: Mon, 7 Jun 2010 20:23:32 -0500 Subject: [IronPython] Where can I download the IronPython Tools for Visual Studio 2010 In-Reply-To: References: Message-ID: On Mon, Jun 7, 2010 at 20:21, Zhi-Yue Sun wrote: > Hi all, > > I'm a new to IronPython Tools. I heard that IronPython Toos is cool. Can > anyone tell me Where can I download the IronPython Tools for Visaul Studio > 2010. > > Thanks, > -ZhiYue Sun > ZhiYue, Check out http://ironpython.net/ironpython/tools/ for the latest release and documentation. -------------- next part -------------- An HTML attachment was scrubbed... URL: From sunzhiyue at 24x7lab.com Tue Jun 8 03:39:20 2010 From: sunzhiyue at 24x7lab.com (Zhi-Yue Sun) Date: Tue, 8 Jun 2010 09:39:20 +0800 Subject: [IronPython] Where can I download the IronPython Tools for Visual Studio 2010 In-Reply-To: References: Message-ID: Hi Brian, I am sorry to tell you that I can't visit http://ironpython.net . There is any other address to download it? Or may you download it then send to me? Thanks, -ZhiYue Sun On Tue, Jun 8, 2010 at 9:23 AM, Brian Curtin wrote: > On Mon, Jun 7, 2010 at 20:21, Zhi-Yue Sun wrote: > >> Hi all, >> >> I'm a new to IronPython Tools. I heard that IronPython Toos is cool. Can >> anyone tell me Where can I download the IronPython Tools for Visaul Studio >> 2010. >> >> Thanks, >> -ZhiYue Sun >> > > ZhiYue, > > Check out http://ironpython.net/ironpython/tools/ for the latest release > and documentation. > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Tue Jun 8 06:46:23 2010 From: vernondcole at gmail.com (Vernon Cole) Date: Mon, 7 Jun 2010 22:46:23 -0600 Subject: [IronPython] datetime.strptime is missing in IronPython? In-Reply-To: References: Message-ID: The issue tracker for CPython [if I read it correctly] lists datetime.strptime as a new feature to be supported in python 2.7 and 3.2. It is not documented in the Python 2.6 manual. The current way of doing it seems to be: >>> import datetime >>> import time >>> d = datetime(*(time.strptime(date_string, format)[0:6])) I have not tested that, I just cut it out of the issue tracker. And, Yes, you are running an obsolete version of IronPython. You should upgrade to 2.6. But that will not fix your problem, since datetime.strptime is not present in the current version, either. -- Vernon Cole On Mon, Jun 7, 2010 at 1:56 PM, Peter Masiar wrote: > Seems like datetime in Ironpython has only strftime, but no strptime? > > IronPython 2.0.3 (2.0.0.0) on .NET 2.0.50727.3603 > Type "help", "copyright", "credits" or "license" for more information. >>>> import datetime >>>> dir(datetime.datetime) > ['CompareTo', '__add__', '__class__', '__delattr__', '__doc__', '__eq__', '__ge_ > _', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__l > e__', '__lt__', '__ne__', '__new__', '__nonzero__', '__radd__', '__reduce__', '_ > _reduce_ex__', '__repr__', '__rsub__', '__setattr__', '__str__', '__sub__', 'ast > imezone', 'combine', 'ctime', 'date', 'day', 'dst', 'fromordinal', 'fromtimestam > p', 'hour', 'isocalendar', 'isoformat', 'isoweekday', 'max', 'microsecond', 'min > ', 'minute', 'month', 'now', 'replace', 'resolution', 'second', 'strftime', 'tim > e', 'timetuple', 'timetz', 'today', 'toordinal', 'tzinfo', 'tzname', 'utcfromtim > estamp', 'utcnow', 'utcoffset', 'utctimetuple', 'weekday', 'year'] >>>> > > Or do I have wrong/obsolete IronPython? Which one has datetime.strptime()? > What I am missing? > > What is recommended way in IronPython to parse date/time string back > to date object? > > Thanks! > -- > ----- > Peter Masiar > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From ncichris at gmail.com Tue Jun 8 07:20:13 2010 From: ncichris at gmail.com (Christos Pavlides) Date: Tue, 8 Jun 2010 08:20:13 +0300 Subject: [IronPython] Multi threaded engine In-Reply-To: <1A472770E042064698CB5ADC83A12ACD489D1D5A@TK5EX14MBXC111.redmond.corp.microsoft.com> References: <000301cb0643$6076b940$21642bc0$@com> <002201cb066a$9af923b0$d0eb6b10$@com> <1A472770E042064698CB5ADC83A12ACD489D1D5A@TK5EX14MBXC111.redmond.corp.microsoft.com> Message-ID: <000001cb06ca$471351c0$d539f540$@com> Thanks Dino and Jeff, You guys are great, I was not expecting these fast responses. Thanks again, I will do a number of changes based on your comments and see if I have any issues. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: Tuesday, June 08, 2010 12:30 AM To: Discussion of IronPython Subject: Re: [IronPython] Multi threaded engine Christos wrote: > Thanks Jeff, > This is the recommendation I was expecting to get. > I will run a high concurrency test on a single engine and single > compiled > code, with new scopes for each request and see where it takes me. > Do I need any locks on the engine itself when Getting the scope (which > could > be called from many threads at the same time)? Nope - no locks required. > > I have another question related to performance. > Right now I have a number of parameters that I need to pass to the > CompiledCode and I use Microsoft.Scripting.ScopeStorage.SetValue and > then > create the scope using this. > Is there a more efficient way to pass parameters to the CompiledCode? > Like > creating an single "parameter" object which is well known by both the > IronPython code and my C# code? The best way is to create the storage for the scope yourself. Right now the simplest (and sure to work) way to do that is to implement IAttributesCollection and create a scope using that for the storage. Then you can respond to the lookups lazily. But setting multiple variables on a scope shouldn't be that expensive (at least in 2.6.1 - there were some issues w/ that in 2.6). _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From tony.meyer at gmail.com Tue Jun 8 07:27:03 2010 From: tony.meyer at gmail.com (Tony Meyer) Date: Tue, 8 Jun 2010 17:27:03 +1200 Subject: [IronPython] datetime.strptime is missing in IronPython? In-Reply-To: References: Message-ID: On Tue, Jun 8, 2010 at 4:46 PM, Vernon Cole wrote: > The issue tracker for CPython ?[if I read it correctly] lists > datetime.strptime as a new feature to be supported in python 2.7 and > 3.2. It is not documented in the Python 2.6 manual. datetime.datetime.strptime is definitely in CPython 2.5 and 2.6: """ tony-meyers-imac:~ tameyer$ python Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import datetime >>> datetime.datetime.strptime("2010 06 08", "%Y %m %d") datetime.datetime(2010, 6, 8, 0, 0) """ The only IP 2.6 I have handy is trypython.org, and the above code does fail there (no copy and paste from the site unfortunately). This is a known bug (so go vote!): http://ironpython.codeplex.com/workitem/17470 Cheers, Tony From makeyunbad at gmail.com Tue Jun 8 10:42:45 2010 From: makeyunbad at gmail.com (yang guang) Date: Tue, 8 Jun 2010 16:42:45 +0800 Subject: [IronPython] Where can I download the IronPython Tools for Visual Studio 2010 In-Reply-To: References: Message-ID: 2010/6/8 Zhi-Yue Sun : > Hi Brian, > I am sorry to tell you that I can't visit http://ironpython.net?. There is > any other address to download it? Or may you download it then send to me? > Thanks, > -ZhiYue Sun You can not access because Great Firewall of China has already closed the website, you can access this address through a proxy: http://qlba8.com/wy/us.html From sunzhiyue at 24x7lab.com Tue Jun 8 15:49:03 2010 From: sunzhiyue at 24x7lab.com (Zhi-Yue Sun) Date: Tue, 8 Jun 2010 21:49:03 +0800 Subject: [IronPython] Where can I download the IronPython Tools for Visual Studio 2010 In-Reply-To: References: Message-ID: yang guang, I have downloaded IronPython Tools through http://qlba8.com/wy/us.html. Thanks for your help. Thanks, -ZhiYue Sun On Tue, Jun 8, 2010 at 4:42 PM, yang guang wrote: > 2010/6/8 Zhi-Yue Sun : > > Hi Brian, > > I am sorry to tell you that I can't visit http://ironpython.net . There > is > > any other address to download it? Or may you download it then send to me? > > Thanks, > > -ZhiYue Sun > > You can not access because Great Firewall of China has already closed > the website, you can access this address through a proxy: > http://qlba8.com/wy/us.html > _______________________________________________ > 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 pablodalma93 at hotmail.com Tue Jun 8 16:06:07 2010 From: pablodalma93 at hotmail.com (Pablo Dalmazzo) Date: Tue, 8 Jun 2010 11:06:07 -0300 Subject: [IronPython] deepcopy Message-ID: Hi there, part of this question was posted by one of my co-workers in SO, but I thought it wouldnt hurt making it here too and more specific. We wanted to use deepcopy in an IronPython 2.6 asp.net webforms project. We abandoned the idea because it brought as conflict with a dll we use (cooperator.framework.web.dll) . It said an attribute was ambiguos in the namespace (sort of) We went back to IronPython 2.0, there we dont have that problem. So I took the copy.py and type.py modules from the IronPython 2.6 installation and moved them to the app_script folder of an IronPython asp.net project to see if they worked. They would seem to be working (the import didnt trigger any error and the copy.deepcopy didnt trigger any error either), but when we deepcopy a custom class object, the problem we have it's it seems it copies the attributes (that's what it shows the object inspector) but not everything in the object. When we try to do getattr(object, attribute) we get " object has no attribute 'getitem'" . But the object it's there and it has set its attributes. Now in the copy module it says "This version does not copy types like module, class, function, method, nor stack trace, stack frame, nor file, socket, window, nor array, nor any similar types." Does that mean the deepcopy we are making of the object it's not copying its methods (methods like getitem ) ? or simply the copy.py and type.py modules dont work well in IronPython 2.0? Or is it something else? Greetings, Pablo _________________________________________________________________ Ahora Hotmail te da 25 GB gratis. El complemento de espacio que te estaba faltando. Ver m?s http://www.descubrehotmail.com/almacenamiento.asp -------------- next part -------------- An HTML attachment was scrubbed... URL: From tristanz at gmail.com Tue Jun 8 17:26:23 2010 From: tristanz at gmail.com (Tristan Zajonc) Date: Tue, 8 Jun 2010 11:26:23 -0400 Subject: [IronPython] Checking for Python exception in C# Message-ID: Hi, I'm trying to get my head around the IronPython API by implementing a simple work-around for what I believe is a bug in the next() builtin,which I reported here: http://ironpython.codeplex.com/workitem/27383. This is my first look inside IronPython so this question, I assume, is pretty basic. How can I handle Python exceptions returned by TryInvokeUnaryOperator? I'm currently trying to do this to implement the default value argument in the next builtin. public static object next(CodeContext/*!*/ context, object o) { object value; if (PythonTypeOps.TryInvokeUnaryOperator(context, o, "next", out value)) { return value; } throw PythonOps.TypeError("{0} object is not an iterator.", PythonTypeOps.GetName(o)); } public static object next(CodeContext/*!*/ context, object o, object defaultVal) { object value = next(context, o); // This doesn't work. if (value is StopIterationException) { return defaultVal; } return value; } Thanks, Tristan -------------- next part -------------- An HTML attachment was scrubbed... URL: From pablodalma93 at hotmail.com Tue Jun 8 18:34:11 2010 From: pablodalma93 at hotmail.com (Pablo Dalmazzo) Date: Tue, 8 Jun 2010 13:34:11 -0300 Subject: [IronPython] deepcopy In-Reply-To: References: Message-ID: Nevermind, I found the problem. It had nothing to do with the module copy not working in IP 2.0, in fact the module copy with IP 2.0 works very well Greetings From: pablodalma93 at hotmail.com To: users at lists.ironpython.com Date: Tue, 8 Jun 2010 11:06:07 -0300 Subject: [IronPython] deepcopy Hi there, part of this question was posted by one of my co-workers in SO, but I thought it wouldnt hurt making it here too and more specific. We wanted to use deepcopy in an IronPython 2.6 asp.net webforms project. We abandoned the idea because it brought as conflict with a dll we use (cooperator.framework.web.dll) . It said an attribute was ambiguos in the namespace (sort of) We went back to IronPython 2.0, there we dont have that problem. So I took the copy.py and type.py modules from the IronPython 2.6 installation and moved them to the app_script folder of an IronPython asp.net project to see if they worked. They would seem to be working (the import didnt trigger any error and the copy.deepcopy didnt trigger any error either), but when we deepcopy a custom class object, the problem we have it's it seems it copies the attributes (that's what it shows the object inspector) but not everything in the object. When we try to do getattr(object, attribute) we get " object has no attribute 'getitem'" . But the object it's there and it has set its attributes. Now in the copy module it says "This version does not copy types like module, class, function, method, nor stack trace, stack frame, nor file, socket, window, nor array, nor any similar types." Does that mean the deepcopy we are making of the object it's not copying its methods (methods like getitem ) ? or simply the copy.py and type.py modules dont work well in IronPython 2.0? Or is it something else? Greetings, Pablo Tu vida no tiene l?mites, ahora Hotmail tampoco. 25 GB para organizar y compartir todo. Ver m?s _________________________________________________________________ Ahora Hotmail te da 25 GB gratis. El complemento de espacio que te estaba faltando. Ver m?s http://www.descubrehotmail.com/almacenamiento.asp -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Tue Jun 8 18:59:35 2010 From: vernondcole at gmail.com (Vernon Cole) Date: Tue, 8 Jun 2010 10:59:35 -0600 Subject: [IronPython] datetime.strptime is missing in IronPython? In-Reply-To: References: Message-ID: My error: The Python 2.6.5 documentation says: v v v v > classmethod datetime.strptime(date_string, format)? > > Return a datetime corresponding to date_string, parsed according to > format. This is equivalent to datetime(*(time.strptime(date_string, > format)[0:6])). ValueError is raised if the date_string and format can?t be > parsed by time.strptime() or if it returns a value which isn?t a time tuple. > See section strftime() and strptime() Behavior. > > New in version 2.5. > ^ ^ ^ ^ I will include this information as a comment on the codeplex 17470 workitem. Note that the equivalent code using "time.strptime()" is included in the above definition. -- Vernon Cole On Mon, Jun 7, 2010 at 11:27 PM, Tony Meyer wrote: > On Tue, Jun 8, 2010 at 4:46 PM, Vernon Cole wrote: >> The issue tracker for CPython [if I read it correctly] lists >> datetime.strptime as a new feature to be supported in python 2.7 and >> 3.2. It is not documented in the Python 2.6 manual. > > datetime.datetime.strptime is definitely in CPython 2.5 and 2.6: > > """ > tony-meyers-imac:~ tameyer$ python > Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12) > [GCC 4.0.1 (Apple Inc. build 5465)] on darwin > Type "help", "copyright", "credits" or "license" for more information. >>>> import datetime >>>> datetime.datetime.strptime("2010 06 08", "%Y %m %d") > datetime.datetime(2010, 6, 8, 0, 0) > """ > > The only IP 2.6 I have handy is trypython.org, and the above code does > fail there (no copy and paste from the site unfortunately). > > This is a known bug (so go vote!): > > http://ironpython.codeplex.com/workitem/17470 > > Cheers, > Tony > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Tue Jun 8 21:16:50 2010 From: dinov at microsoft.com (Dino Viehland) Date: Tue, 8 Jun 2010 19:16:50 +0000 Subject: [IronPython] Checking for Python exception in C# In-Reply-To: References: Message-ID: <1A472770E042064698CB5ADC83A12ACD489D9489@TK5EX14MBXC111.redmond.corp.microsoft.com> You can just use a normal try/catch. IronPython has a mapping between .NET exceptions and Python exceptions. We actually have documentation on this over here http://ironpython.codeplex.com/wikipage?title=Exception%20Model. But apparently it's out of date for StopIteration. For that we now define our own StopIterationException in IronPython.Runtime.Exceptions which you can catch. For 2.7 we've added support for light exceptions - so if you're downloading the source from CodePlex you'll see some methods are decorated with a [LightThrowing] attribute. Those methods will return a value which is actual a wrapped exception. For those you can use the LightExceptions class to see if the return value is a light exception and the code will look more like what you have below. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Tristan Zajonc Sent: Tuesday, June 08, 2010 10:26 AM To: Discussion of IronPython Subject: [IronPython] Checking for Python exception in C# Hi, I'm trying to get my head around the IronPython API by implementing a simple work-around for what I believe is a bug in the next() builtin,which I reported here: http://ironpython.codeplex.com/workitem/27383. This is my first look inside IronPython so this question, I assume, is pretty basic. How can I handle Python exceptions returned by TryInvokeUnaryOperator? I'm currently trying to do this to implement the default value argument in the next builtin. public static object next(CodeContext/*!*/ context, object o) { object value; if (PythonTypeOps.TryInvokeUnaryOperator(context, o, "next", out value)) { return value; } throw PythonOps.TypeError("{0} object is not an iterator.", PythonTypeOps.GetName(o)); } public static object next(CodeContext/*!*/ context, object o, object defaultVal) { object value = next(context, o); // This doesn't work. if (value is StopIterationException) { return defaultVal; } return value; } Thanks, Tristan -------------- next part -------------- An HTML attachment was scrubbed... URL: From merllab at microsoft.com Wed Jun 9 17:07:33 2010 From: merllab at microsoft.com (merllab at microsoft.com) Date: Wed, 9 Jun 2010 08:07:33 -0700 Subject: [IronPython] IronPython 2.6 CodePlex Source Update Message-ID: This is an automated email letting you know that sources have recently been pushed out. You can download these newer sources directly from http://ironpython.codeplex.com/SourceControl/changeset/view/67591. ADDED SOURCES $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Ast/Comprehension.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Ast/ComprehensionFor.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Ast/ComprehensionIf.cs $/IronPython/IronPython_Main/Languages/IronPython/Tests/Tools/baselines/itertools.log DELETED SOURCES $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Ast/ListComprehensionFor.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Ast/ListComprehension.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Ast/ListComprehensionIf.cs MODIFIED SOURCES $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Ast/Comprehension.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Ast/ComprehensionFor.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Ast/ComprehensionIf.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Ast/FlowChecker.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Ast/AstMethods.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Ast/PythonNameBinder.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython.Modules/IterTools.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/SetStorage.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Parser.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/IronPython.csproj $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Ast/PythonWalker.Generated.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Operations/PythonOps.cs $/IronPython/IronPython_Main/Languages/IronPython/Scripts/generate_alltypes.py $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Operations/LongOps.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Operations/IntOps.Generated.cs $/IronPython/IronPython_Main/Languages/IronPython/Tests/Tools/baselines/itertools.log $/IronPython/IronPython_Main/Languages/IronPython/Tests/Tools/baselines/types_only.log $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Math/BigIntegerV2.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Utils/DynamicUtils.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Utils/MathUtils.cs CHECKIN COMMENTS -------------------------------------------------------------------------------- Changeset Id: 1852414 Date: 6/8/2010 11:46:20 AM 2.7 Features: - dictionary and set comprehensions - bit_length() on integer types - implement itertools.compress, combinations_with_replacement - update itertools.count to accept arbitrary objects that implement __int__ or __float__, plus the new 'step' argument (Shelveset: 27Features01;REDMOND\ddicato | SNAP CheckinId: 10912) From fernandez.dan at gmail.com Wed Jun 9 17:55:21 2010 From: fernandez.dan at gmail.com (Danny Fernandez) Date: Wed, 9 Jun 2010 09:55:21 -0600 Subject: [IronPython] Using Epydoc with IronPython 2.6.1 Message-ID: Hi All, I am a newbie in IronPython world which by the way rocks. I tried posting yesterday so I am not sure what happened so sorry if there is a double post. I am having trouble trying to use epydoc. I have IronPython 2.6.1 for .NET 2.0 on my 32-bit Windows XP box. I am not sure if I have set it up correctly it is probably me not setting up things correctly. I installed the epydoc source in c:\python\epydoc and set IRONPATHHOME is set to C:\python\epydoc\. I am following an example of using epydoc from their website and added the debug arg to get more information so I cd in C:\python\epydoc\scripts and executed the following ipy epydoc.py --html --debug sys -o sys_docs Traceback (most recent call last):-] Building documentation: sys File "epydoc.py", line 16, in File "C:\python\epydoc\epydoc\cli.py", line 965, in cli File "C:\python\epydoc\epydoc\docbuilder.py", line 454, in _get_docs_from_pyname File "C:\python\epydoc\epydoc\docparser.py", line 209, in parse_docs File "C:\python\epydoc\epydoc\docintrospecter.py", line 131, in introspect_docs File "C:\python\epydoc\epydoc\docintrospecter.py", line 275, in introspect_module File "C:\python\epydoc\epydoc\docintrospecter.py", line 131, in introspect_docs File "C:\python\epydoc\epydoc\docintrospecter.py", line 392, in introspect_class TypeError: instancemethod.__cmp__(x,y) requires y to be a 'instancemethod', not a NoneType I tried find information on using IronPython with epydoc but with no luck. I got pydoc to work but it pulled documentation for the clr module which I use of course which took most of the documentation for my module. I thought I can try epydoc with the parse only feature. I appeciate any feedback. Thanks Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Wed Jun 9 18:56:40 2010 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Wed, 09 Jun 2010 17:56:40 +0100 Subject: [IronPython] Using Epydoc with IronPython 2.6.1 In-Reply-To: References: Message-ID: <4C0FC7C8.2030107@voidspace.org.uk> On 09/06/2010 16:55, Danny Fernandez wrote: > Hi All, > > I am a newbie in IronPython world which by the way rocks. I tried > posting yesterday so I am not sure what happened so sorry if there is > a double post. > I am having trouble trying to use epydoc. I have IronPython 2.6.1 for > .NET 2.0 on my 32-bit Windows XP box. I am not sure if I have set it > up correctly it is probably me not setting up things correctly. > > I installed the epydoc source in c:\python\epydoc and set IRONPATHHOME > is set to C:\python\epydoc\. I am following an example of using epydoc > from their website and added the debug arg to get more information so > I cd in C:\python\epydoc\scripts and executed the following > > ipy epydoc.py --html --debug sys -o sys_docs > > Traceback (most recent call last):-] Building documentation: sys > File "epydoc.py", line 16, in > File "C:\python\epydoc\epydoc\cli.py", line 965, in cli > File "C:\python\epydoc\epydoc\docbuilder.py", line 454, in > _get_docs_from_pyname > File "C:\python\epydoc\epydoc\docparser.py", line 209, in parse_docs > File "C:\python\epydoc\epydoc\docintrospecter.py", line 131, in > introspect_docs > File "C:\python\epydoc\epydoc\docintrospecter.py", line 275, in > introspect_module > File "C:\python\epydoc\epydoc\docintrospecter.py", line 131, in > introspect_docs > File "C:\python\epydoc\epydoc\docintrospecter.py", line 392, in > introspect_class > TypeError: instancemethod.__cmp__(x,y) requires y to be a > 'instancemethod', not a NoneType > > > I tried find information on using IronPython with epydoc but with no > luck. I got pydoc to work but it pulled documentation for the clr > module which I use of course which took most of the documentation for > my module. I thought I can try epydoc with the parse only feature. I > appeciate any feedback. Hmm... no idea on the specific problem - but this *may* be related: IronPython 2.6.1: >>> class X(object): ... def f(s): pass ... >>> >>> a = X() >>> a.f.__cmp__ Traceback (most recent call last): File "", line 1, in AttributeError: 'instancemethod' object has no attribute '__cmp__' CPython 2.6.5: >>> class X(object): ... def f(s): pass ... >>> a = X() >>> a.f.__cmp__ Michael > > Thanks > > Danny > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. -------------- next part -------------- An HTML attachment was scrubbed... URL: From fernandez.dan at gmail.com Thu Jun 10 00:43:59 2010 From: fernandez.dan at gmail.com (Danny Fernandez) Date: Wed, 9 Jun 2010 16:43:59 -0600 Subject: [IronPython] Using Epydoc with IronPython 2.6.1 In-Reply-To: <4C0FC7C8.2030107@voidspace.org.uk> References: <4C0FC7C8.2030107@voidspace.org.uk> Message-ID: Hi Michael, Are there any documentation tools that would work with IronPython that you would recommend? I got pydoc to work on a small sample python file but the html documentation included imports. I had small python file but the clr module took most of the html documentation. I am newbie so I could be setting pydoc incorrectly. Thanks. Danny On Wed, Jun 9, 2010 at 10:56 AM, Michael Foord wrote: > On 09/06/2010 16:55, Danny Fernandez wrote: > > Hi All, > > I am a newbie in IronPython world which by the way rocks. I tried posting > yesterday so I am not sure what happened so sorry if there is a double post. > > > I am having trouble trying to use epydoc. I have IronPython 2.6.1 for .NET > 2.0 on my 32-bit Windows XP box. I am not sure if I have set it up correctly > it is probably me not setting up things correctly. > > I installed the epydoc source in c:\python\epydoc and set IRONPATHHOME is > set to C:\python\epydoc\. I am following an example of using epydoc from > their website and added the debug arg to get more information so I cd in > C:\python\epydoc\scripts and executed the following > > ipy epydoc.py --html --debug sys -o sys_docs > > Traceback (most recent call last):-] Building documentation: sys > File "epydoc.py", line 16, in > File "C:\python\epydoc\epydoc\cli.py", line 965, in cli > File "C:\python\epydoc\epydoc\docbuilder.py", line 454, in > _get_docs_from_pyname > File "C:\python\epydoc\epydoc\docparser.py", line 209, in parse_docs > File "C:\python\epydoc\epydoc\docintrospecter.py", line 131, in > introspect_docs > File "C:\python\epydoc\epydoc\docintrospecter.py", line 275, in > introspect_module > File "C:\python\epydoc\epydoc\docintrospecter.py", line 131, in > introspect_docs > File "C:\python\epydoc\epydoc\docintrospecter.py", line 392, in > introspect_class > TypeError: instancemethod.__cmp__(x,y) requires y to be a 'instancemethod', > not a NoneType > > > I tried find information on using IronPython with epydoc but with no luck. > I got pydoc to work but it pulled documentation for the clr module which I > use of course which took most of the documentation for my module. I thought > I can try epydoc with the parse only feature. I appeciate any feedback. > > > > Hmm... no idea on the specific problem - but this *may* be related: > > IronPython 2.6.1: > > >>> class X(object): > ... def f(s): pass > ... > >>> > >>> a = X() > >>> a.f.__cmp__ > > Traceback (most recent call last): > File "", line 1, in > AttributeError: 'instancemethod' object has no attribute '__cmp__' > > CPython 2.6.5: > > >>> class X(object): > ... def f(s): pass > ... > >>> a = X() > >>> a.f.__cmp__ > > > > Michael > > Thanks > > Danny > > > _______________________________________________ > Users mailing listUsers at lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > -- http://www.ironpythoninaction.com/http://www.voidspace.org.uk/blog > > READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (?BOGUS AGREEMENTS?) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Thu Jun 10 01:25:03 2010 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Thu, 10 Jun 2010 00:25:03 +0100 Subject: [IronPython] Using Epydoc with IronPython 2.6.1 In-Reply-To: References: <4C0FC7C8.2030107@voidspace.org.uk> Message-ID: <4C1022CF.9090208@voidspace.org.uk> On 09/06/2010 23:43, Danny Fernandez wrote: > Hi Michael, > > Are there any documentation tools that would work with IronPython that > you would recommend? Hmmm... in terms of automatically generating api documentation from docstrings there are embarrassingly few for Python - let alone IronPython. Sphinx is great for building documentation but doesn't need to be run *with* IronPython and won't pull docstrings from your API for you. Maybe other people have suggestions. All the best, Michael > I got pydoc to work on a small sample python file but the html > documentation included imports. I had small > python file but the clr module took most of the html documentation. I > am newbie so I could be setting pydoc > incorrectly. > Thanks. > > Danny > > > On Wed, Jun 9, 2010 at 10:56 AM, Michael Foord > > wrote: > > On 09/06/2010 16:55, Danny Fernandez wrote: >> Hi All, >> >> I am a newbie in IronPython world which by the way rocks. I tried >> posting yesterday so I am not sure what happened so sorry if >> there is a double post. >> I am having trouble trying to use epydoc. I have IronPython 2.6.1 >> for .NET 2.0 on my 32-bit Windows XP box. I am not sure if I have >> set it up correctly it is probably me not setting up things >> correctly. >> >> I installed the epydoc source in c:\python\epydoc and set >> IRONPATHHOME is set to C:\python\epydoc\. I am following an >> example of using epydoc from their website and added the debug >> arg to get more information so I cd in C:\python\epydoc\scripts >> and executed the following >> >> ipy epydoc.py --html --debug sys -o sys_docs >> >> Traceback (most recent call last):-] Building documentation: sys >> File "epydoc.py", line 16, in >> File "C:\python\epydoc\epydoc\cli.py", line 965, in cli >> File "C:\python\epydoc\epydoc\docbuilder.py", line 454, in >> _get_docs_from_pyname >> File "C:\python\epydoc\epydoc\docparser.py", line 209, in >> parse_docs >> File "C:\python\epydoc\epydoc\docintrospecter.py", line 131, in >> introspect_docs >> File "C:\python\epydoc\epydoc\docintrospecter.py", line 275, in >> introspect_module >> File "C:\python\epydoc\epydoc\docintrospecter.py", line 131, in >> introspect_docs >> File "C:\python\epydoc\epydoc\docintrospecter.py", line 392, in >> introspect_class >> TypeError: instancemethod.__cmp__(x,y) requires y to be a >> 'instancemethod', not a NoneType >> >> >> I tried find information on using IronPython with epydoc but with >> no luck. I got pydoc to work but it pulled documentation for the >> clr module which I use of course which took most of the >> documentation for my module. I thought I can try epydoc with the >> parse only feature. I appeciate any feedback. > > > Hmm... no idea on the specific problem - but this *may* be related: > > IronPython 2.6.1: > > >>> class X(object): > ... def f(s): pass > ... > >>> > >>> a = X() > >>> a.f.__cmp__ > > Traceback (most recent call last): > File "", line 1, in > AttributeError: 'instancemethod' object has no attribute '__cmp__' > > CPython 2.6.5: > > >>> class X(object): > ... def f(s): pass > ... > >>> a = X() > >>> a.f.__cmp__ > > > > Michael >> >> Thanks >> >> Danny >> >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (?BOGUS AGREEMENTS?) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. > > > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (?BOGUS AGREEMENTS?) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Thu Jun 10 02:01:42 2010 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Thu, 10 Jun 2010 01:01:42 +0100 Subject: [IronPython] How should I install packages? In-Reply-To: References: Message-ID: <4C102B66.9090404@voidspace.org.uk> On 07/06/2010 13:43, Matthew Wilson wrote: > I've got an all-python package that should be compatible with > ironpython. It seems like distutils.setup doesn't exist though, so my > original setup.py script won't work. > > I might tweak my setup.py so that when it can't find a distutils.setup, > it goes into "ironpython mode" and then just manually copies stuff. > > So where should I install stuff? Just copy it somewhere in sys.path? > > I think that's about the current practise... :-) Michael > Is there a convention other people are following? > > Matt > > PS and OT: I'm trying to use gmane to access this mailing list with slrn (a > command-line newsreader) and while I can post to the list, no new posts > ever show up. > > I use gmane and slrn to read a lot of other lists and they work fine. > Any ideas? > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (?BOGUS AGREEMENTS?) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. From tristanz at gmail.com Thu Jun 10 02:03:46 2010 From: tristanz at gmail.com (Tristan Zajonc) Date: Wed, 9 Jun 2010 20:03:46 -0400 Subject: [IronPython] ctypes on Mono In-Reply-To: References: <1A472770E042064698CB5ADC83A12ACD48964922@TK5EX14MBXC118.redmond.corp.microsoft.com> <1A472770E042064698CB5ADC83A12ACD4896E2A9@TK5EX14MBXC118.redmond.corp.microsoft.com> Message-ID: I looked into the ctypes on mono problem a bit (MONO_LOG_LEVEL=debug mono ipy.exe is helpful here). There seem to be three issues: 1) libdl.so is libdl.dylib on OSX and there is no dllmap that does this automatically on Mono. It checks for libdl.so.dylib and a few other places but not libdl.dylib. This can be fixed by creating a symbolic link or changing the DLLImport to libdl without the ".so". Unfortunately the latter approach breaks breaks linux support. So I just created this symlink by hand, which is not ideal. 2) On linux, it seems that RTLD_NOW (2) should be passed to the dlopen call. (See http://www.mail-archive.com/mono-list at lists.ximian.com/msg30407.html). Without this import ctypes works on OSX but not linux, with it things seem to work on both platforms. 3) LocalAlloc needs a posix equivalent. I added a calloc(1, size), which seemed to do the trick. I'm not expert here, I assume some of the other public methods should be ported too? With these changes basic libc calls, like abs(), work on windows, osx, and linux. Lots stuff doesn't work. Printf gives one character everywhere and segfaults on linux, but this seems to be the general state of ctypes support even on Windows. Unfortunately fcntl through ctypes also doesn't seem to work, which is why I was looking into ctypes to start with. Below are my changes to NativeFunctions.cs, which are a partial solution at best. Tristan --- // unix entry points, VM needs to map the filenames. [DllImport("libdl.so", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] private static extern IntPtr dlopen([In] string filename, [In] int flags); [DllImport("libdl.so", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] private static extern IntPtr dlsym([In] IntPtr handle, [In] string symbol); [DllImport("libdl.so")] private static extern IntPtr calloc(uint nelem, IntPtr size); // Required for Unix not OSX. private const int RTLD_NOW = 2; public static IntPtr LoadDLL(string filename, int flags) { if (Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX) { return dlopen(filename, RTLD_NOW); } return LoadLibrary(filename); } [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public static IntPtr Calloc(IntPtr size) { if (Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX) { return calloc(1, size); } return LocalAlloc(LMEM_ZEROINIT, size); } --- On Tue, Jun 1, 2010 at 3:13 PM, Tristan Zajonc wrote: > Both on OSX and Ubuntu it appears to fail on a call to PyDLL(None). The > problematic call is from the block: > > if _os.name in ("nt", "ce"): > pythonapi = PyDLL("python dll", None, _sys.dllhandle) > elif _sys.platform == "cygwin": > pythonapi = PyDLL("libpython%d.%d.dll" % _sys.version_info[:2]) > else: > print "DEBUG: NOT NT/CE OR CYGWIN." > pythonapi = PyDLL(None) > > It goes to CDLL base class and dies exactly here: > > if handle is None: > print "HANDLE: " + str(self._name) + str(mode) #prints None0 > self._handle = _dlopen(self._name, mode) > print "AFTER DLOPEN. DOESN'T PRINT." > > Hope this helps. > > Tristan > > On Tue, Jun 1, 2010 at 1:34 PM, Dino Viehland wrote: > >> Any chance you can put a print in any calls to dlopen in >> ctypes\__init__.py and see what we?re trying to load? >> >> >> >> *From:* users-bounces at lists.ironpython.com [mailto: >> users-bounces at lists.ironpython.com] *On Behalf Of *Tristan Zajonc >> *Sent:* Sunday, May 30, 2010 3:57 PM >> *To:* Discussion of IronPython >> *Subject:* Re: [IronPython] ctypes on Mono >> >> >> >> (I'll look into OSX issue, although am happy to hear a solution from other >> users) >> >> >> >> I'm not sure why I don't get line numbers. If I pass -XExceptionDetail, I >> don't get much more: >> >> >> >> tristanz at aontic1:~$ ipy -X:ExceptionDetail >> >> IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.1433 >> >> Type "help", "copyright", "credits" or "license" for more information. >> >> >>> import ctypes >> >> cannot load library >> >> LoadLibrary at offset 0 in file:line:column :0:0 >> >> dlopen at offset 0 in file:line:column :0:0 >> >> Invoke at offset 0 in file:line:column :0:0 >> >> at IronPython.Modules.CTypes.LoadLibrary (System.String library, Int32 >> mode) [0x00000] in :0 >> >> at IronPython.Modules.CTypes.dlopen (System.String library, Int32 mode) >> [0x00000] in :0 >> >> at (wrapper managed-to-native) >> System.Reflection.MonoMethod:InternalInvoke >> (System.Reflection.MonoMethod*,object,object[],System.Exception&) >> >> at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags >> invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, >> System.Globalization.CultureInfo culture) [0x00000] in :0 >> >> OSError: IronPython.Runtime.Exceptions.OSException: cannot load library >> >> at IronPython.Modules.CTypes.LoadLibrary (System.String library, Int32 >> mode) [0x00000] in :0 >> >> at IronPython.Modules.CTypes.dlopen (System.String library, Int32 mode) >> [0x00000] in :0 >> >> at (wrapper managed-to-native) >> System.Reflection.MonoMethod:InternalInvoke >> (System.Reflection.MonoMethod*,object,object[],System.Exception&) >> >> at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags >> invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, >> System.Globalization.CultureInfo culture) [0x00000] in :0 >> >> >> >> >> >> On Sun, May 30, 2010 at 6:24 PM, Dino Viehland >> wrote: >> >> On OS/X I believe you need to use Mono?s DllMap feature ( >> http://www.mono-project.com/Config_DllMap) to map from the Linux library >> name (libdl.so) to the Mac OS/X library which exports dlopen. I actually >> have no clue what exports it and I don?t see one listed over here: >> http://gemma.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man3/dlopen.3.htmlso hopefully someone else on the list knows. >> >> >> >> It looks like on Linux the ?X:ExceptionDetail command line option is being >> passed which is preventing the stack trace from having any line number >> information - or maybe the stack trace is cut off? Either way it?d be >> useful to see the line number which is calling dlopen to understand what >> library we are failing to load. My guess would be that it?s trying to load >> the Python library but I?d think that would work fine (it looks like we pass >> in a null path in that case which should be alright for dlopen). >> >> >> >> >> >> *From:* users-bounces at lists.ironpython.com [mailto: >> users-bounces at lists.ironpython.com] *On Behalf Of *Tristan Zajonc >> >> >> *Sent:* Saturday, May 29, 2010 3:59 PM >> *To:* Discussion of IronPython >> >> *Subject:* [IronPython] ctypes on Mono >> >> >> >> I'm running the the latest IronPython 2.6.1 (.NET 2.0 version) with Mono. >> I cannot import ctypes. >> >> >> >> Is this behavior expected? Any solutions? Here are the exact results: >> >> >> >> On OSX: >> >> IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.1433 >> >> Type "help", "copyright", "credits" or "license" for more information. >> >> >>> import ctypes >> >> Traceback (most recent call last): >> >> SystemError: libdl.so >> >> >> >> On Ubuntu (using trunk Mono): >> >> >> >> IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.1433 >> >> Type "help", "copyright", "credits" or "license" for more information. >> >> >>> import ctypes >> >> Traceback (most recent call last): >> >> OSError: IronPython.Runtime.Exceptions.OSException: cannot load library >> >> at IronPython.Modules.CTypes.LoadLibrary (System.String library, Int32 >> mode) [0x00000] in :0 >> >> at IronPython.Modules.CTypes.dlopen (System.String library, Int32 mode) >> [0x00000] in :0 >> >> at (wrapper managed-to-native) >> System.Reflection.MonoMethod:InternalInvoke >> (System.Reflection.MonoMethod*,object,object[],System.Exception&) >> >> at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags >> invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, >> System.Globalization.CultureInfo culture) [0x00000] in :0 >> >> >> >> >> >> Best, >> >> Tristan >> >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.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 williamj at tenbase2.com Thu Jun 10 13:05:50 2010 From: williamj at tenbase2.com (William Johnston) Date: Thu, 10 Jun 2010 07:05:50 -0400 Subject: [IronPython] NLTK in C# application? Message-ID: <000001cb088d$01a03a80$04e0af80$@com> Hello, How do I include the NLTK modules in a C# application? There is already code for embedded Python. Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Thu Jun 10 13:10:41 2010 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Thu, 10 Jun 2010 12:10:41 +0100 Subject: [IronPython] NLTK in C# application? In-Reply-To: <000001cb088d$01a03a80$04e0af80$@com> References: <000001cb088d$01a03a80$04e0af80$@com> Message-ID: <4C10C831.7000308@voidspace.org.uk> On 10/06/2010 12:05, William Johnston wrote: > > Hello, > > How do I include the NLTK modules in a C# application? > > There is already code for embedded Python. > The first step is to try importing it and running some examples from in IronPython. If that works then you just need to provide a 'bridge' layer that embeds IronPython in your C# app and allows you to call into IronPython to use NLTK. If NLTK *doesn't* work from IronPython it will probably be because it uses C extension modules not available in IronPython. One way round this is to use Ironclad. Again, try some NLTK examples from IronPython but with Ironclad and see if that works. http://www.resolversystems.com/products/ironclad/ If it still doesn't work it may be worth reporting back here with the problems to see if they are resolvable. All the best, Michael Foord > Thanks. > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. -------------- next part -------------- An HTML attachment was scrubbed... URL: From pablodalma93 at hotmail.com Thu Jun 10 14:56:45 2010 From: pablodalma93 at hotmail.com (Pablo Dalmazzo) Date: Thu, 10 Jun 2010 09:56:45 -0300 Subject: [IronPython] deepcopy Message-ID: Hi there, Im getting this error in the copy module. I moved the copy module from the IronPython 2.6 installation to work withIronPython 2.0 for some compatibility problem I had with IronPython 2.6 dll with another dll we use. The only difference I see between the cases which works and those which doesnt are, in the succesful case it is a custom class object "alone", and in the error case is the deepcopy of a custom class object which contains a list with other instances of that object.Could that have anything to do with the problem? Is that a limitation of the copy module in Python or it should work? error description: No se puede encontrar el m?todo 'DBNull..ctor'. Error de c?digo fuente: L?nea 322: args = deepcopy(args, memo) L?nea 323: L?nea 324: y = callable(*args) L?nea 325: L?nea 326: memo[id(x)] = y Archivo de origen: /SistemaVentaBaseIP2/App_Script/copy.py _________________________________________________________________ Filtro Anti Spam mejorado de Hotmail. La forma m?s segura de proteger tu casilla. Ver m?s http://www.descubrehotmail.com/anti-spam.asp -------------- next part -------------- An HTML attachment was scrubbed... URL: From williamj at tenbase2.com Thu Jun 10 15:57:53 2010 From: williamj at tenbase2.com (William Johnston) Date: Thu, 10 Jun 2010 09:57:53 -0400 Subject: [IronPython] NLTK in C# application? In-Reply-To: <4C10C831.7000308@voidspace.org.uk> References: <000001cb088d$01a03a80$04e0af80$@com> <4C10C831.7000308@voidspace.org.uk> Message-ID: <001201cb08a4$ec999ce0$c5ccd6a0$@com> Hello, In order for NLTK to work, I need to install PyYaml. However, the PyYaml installer does not recognize the IronPython installation in the Registry. How do I alter the registry? Thanks. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Thursday, June 10, 2010 7:11 AM To: Discussion of IronPython Subject: Re: [IronPython] NLTK in C# application? On 10/06/2010 12:05, William Johnston wrote: Hello, How do I include the NLTK modules in a C# application? There is already code for embedded Python. The first step is to try importing it and running some examples from in IronPython. If that works then you just need to provide a 'bridge' layer that embeds IronPython in your C# app and allows you to call into IronPython to use NLTK. If NLTK *doesn't* work from IronPython it will probably be because it uses C extension modules not available in IronPython. One way round this is to use Ironclad. Again, try some NLTK examples from IronPython but with Ironclad and see if that works. http://www.resolversystems.com/products/ironclad/ If it still doesn't work it may be worth reporting back here with the problems to see if they are resolvable. All the best, Michael Foord Thanks. _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. -------------- next part -------------- An HTML attachment was scrubbed... URL: From merllab at microsoft.com Thu Jun 10 17:08:03 2010 From: merllab at microsoft.com (merllab at microsoft.com) Date: Thu, 10 Jun 2010 08:08:03 -0700 Subject: [IronPython] IronPython 2.6 CodePlex Source Update Message-ID: <0e508d07-1f95-42bf-8d84-ec988f5e69fd@tk5-exsmh-c101.redmond.corp.microsoft.com> This is an automated email letting you know that sources have recently been pushed out. You can download these newer sources directly from http://ironpython.codeplex.com/SourceControl/changeset/view/67754. MODIFIED SOURCES $/IronPython/IronPython_Main/Hosts/Silverlight/Microsoft.Scripting.SilverLight/Microsoft.Scripting.Silverlight.csproj $/IronPython/IronPython_Main/Languages/IronPython/IronPython/IronPython.csproj $/IronPython/IronPython_Main/Languages/IronPython/IronPython.Modules/IronPython.Modules.csproj $/IronPython/IronPython_Main/Hosts/Silverlight/Chiron/Chiron.csproj $/IronPython/IronPython_Main/Languages/IronPython/IronPythonConsoleAny/IronPythonConsoleAny.csproj $/IronPython/IronPython_Main/Languages/IronPython/Tests/compat/common.py $/IronPython/IronPython_Main/Languages/IronPython/Tests/silverlight_sanity/app/app.py $/IronPython/IronPython_Main/Languages/IronPython/IronPythonWindow/IronPythonWindow.csproj $/IronPython/IronPython_Main/Languages/IronPython/IronPythonConsole/IronPythonConsole.csproj $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Microsoft.Dynamic.csproj $/IronPython/IronPython_Main/Languages/IronPython/IronPythonTest/IronPythonTest.csproj $/IronPython/IronPython_Main/Languages/IronPython/IronPythonWindowAny/IronPythonWindowAny.csproj $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting/Microsoft.Scripting.csproj $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting.Core/Microsoft.Scripting.Core.csproj $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting.Debugging/Microsoft.Scripting.Debugging.csproj $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting.Core/Microsoft.Scripting.ExtensionAttribute.csproj $/IronPython/IronPython_Main/Solutions/IronPython.sln $/IronPython/IronPython_Main/Test/ClrAssembly/ClrAssembly.csproj CHECKIN COMMENTS -------------------------------------------------------------------------------- Changeset Id: 1859462 Date: 6/9/2010 2:34:06 PM Adjusted build configurations: * "Silverlight Release" => "Silverlight3Release" * "Silverlight Debug" => "Silverlight3Debug" * "Silverlight 4 Release" => "Silverlight4Release" * "Silverlight 4 Debug" => "Silverlight4Debug" * "V4 Release" => "v4Release" * "V4 Debug" => "v4Debug" (Shelveset: BCONFIG03_TMP;REDMOND\dfugate | SNAP CheckinId: 10915) -------------------------------------------------------------------------------- Changeset Id: 1859462 Date: 6/9/2010 2:34:06 PM Adjusted build configurations: * "Silverlight Release" => "Silverlight3Release" * "Silverlight Debug" => "Silverlight3Debug" * "Silverlight 4 Release" => "Silverlight4Release" * "Silverlight 4 Debug" => "Silverlight4Debug" * "V4 Release" => "v4Release" * "V4 Debug" => "v4Debug" (Shelveset: BCONFIG03_TMP;REDMOND\dfugate | SNAP CheckinId: 10915) From fuzzyman at voidspace.org.uk Thu Jun 10 17:28:58 2010 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Thu, 10 Jun 2010 16:28:58 +0100 Subject: [IronPython] NLTK in C# application? In-Reply-To: <001201cb08a4$ec999ce0$c5ccd6a0$@com> References: <000001cb088d$01a03a80$04e0af80$@com> <4C10C831.7000308@voidspace.org.uk> <001201cb08a4$ec999ce0$c5ccd6a0$@com> Message-ID: <4C1104BA.2090705@voidspace.org.uk> On 10/06/2010 14:57, William Johnston wrote: > > Hello, > > > In order for NLTK to work, I need to install PyYaml. > > > However, the PyYaml installer does not recognize the IronPython > installation in the Registry. > > > How do I alter the registry? > I don't know - the folks on the pywin32 mailing list could probably tell you. An easier route would be to install Python, then install PyYaml, then either copy the files to somewhere on sys.path for IronPython (or add your Python site-packages folder to sys.path in your IronPython code). All the best, Michael Foord > Thanks. > > *From:* users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Michael Foord > *Sent:* Thursday, June 10, 2010 7:11 AM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] NLTK in C# application? > > On 10/06/2010 12:05, William Johnston wrote: > > Hello, > > How do I include the NLTK modules in a C# application? > > There is already code for embedded Python. > > > The first step is to try importing it and running some examples from > in IronPython. If that works then you just need to provide a 'bridge' > layer that embeds IronPython in your C# app and allows you to call > into IronPython to use NLTK. > > If NLTK *doesn't* work from IronPython it will probably be because it > uses C extension modules not available in IronPython. One way round > this is to use Ironclad. Again, try some NLTK examples from IronPython > but with Ironclad and see if that works. > > http://www.resolversystems.com/products/ironclad/ > > If it still doesn't work it may be worth reporting back here with the > problems to see if they are resolvable. > > All the best, > > Michael Foord > > > Thanks. > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Thu Jun 10 17:56:50 2010 From: dinov at microsoft.com (Dino Viehland) Date: Thu, 10 Jun 2010 15:56:50 +0000 Subject: [IronPython] deepcopy In-Reply-To: References: Message-ID: <1A472770E042064698CB5ADC83A12ACD489E0AB8@TK5EX14MBXC111.redmond.corp.microsoft.com> Is there a DBNull value somewhere in your object? DBNull is a singleton and I'd guess we'd need to add some custom logic which says the way we deserialize it is by pulling the singleton from DBNull.Value. You can probably use copy_reg.pickle to register something which will handle objects of type DBNull that just returns DBNull.Value. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Pablo Dalmazzo Sent: Thursday, June 10, 2010 7:57 AM To: IronPython Mailing list Subject: [IronPython] deepcopy Hi there, Im getting this error in the copy module. I moved the copy module from the IronPython 2.6 installation to work with IronPython 2.0 for some compatibility problem I had with IronPython 2.6 dll with another dll we use. The only difference I see between the cases which works and those which doesnt are, in the succesful case it is a custom class object "alone", and in the error case is the deepcopy of a custom class object which contains a list with other instances of that object. Could that have anything to do with the problem? Is that a limitation of the copy module in Python or it should work? error description: No se puede encontrar el m?todo 'DBNull..ctor'. Error de c?digo fuente: L?nea 322: args = deepcopy(args, memo) L?nea 323: L?nea 324: y = callable(*args) L?nea 325: L?nea 326: memo[id(x)] = y Archivo de origen: /SistemaVentaBaseIP2/App_Script/copy.py ________________________________ Hotmail es m?s seguro. Con el Filtro Anti Spam tu cuenta est? mucho m?s protegida. Ver m?s -------------- next part -------------- An HTML attachment was scrubbed... URL: From pablodalma93 at hotmail.com Thu Jun 10 20:24:10 2010 From: pablodalma93 at hotmail.com (Pablo Dalmazzo) Date: Thu, 10 Jun 2010 15:24:10 -0300 Subject: [IronPython] deepcopy In-Reply-To: <1A472770E042064698CB5ADC83A12ACD489E0AB8@TK5EX14MBXC111.redmond.corp.microsoft.com> References: , <1A472770E042064698CB5ADC83A12ACD489E0AB8@TK5EX14MBXC111.redmond.corp.microsoft.com> Message-ID: Hi, yes there is a DBNull value. Thanks. From: dinov at microsoft.com To: users at lists.ironpython.com Date: Thu, 10 Jun 2010 15:56:50 +0000 Subject: Re: [IronPython] deepcopy Is there a DBNull value somewhere in your object? DBNull is a singleton and I?d guess we?d need to add some custom logic which says the way we deserialize it is by pulling the singleton from DBNull.Value. You can probably use copy_reg.pickle to register something which will handle objects of type DBNull that just returns DBNull.Value. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Pablo Dalmazzo Sent: Thursday, June 10, 2010 7:57 AM To: IronPython Mailing list Subject: [IronPython] deepcopy Hi there, Im getting this error in the copy module. I moved the copy module from the IronPython 2.6 installation to work with IronPython 2.0 for some compatibility problem I had with IronPython 2.6 dll with another dll we use. The only difference I see between the cases which works and those which doesnt are, in the succesful case it is a custom class object "alone", and in the error case is the deepcopy of a custom class object which contains a list with other instances of that object. Could that have anything to do with the problem? Is that a limitation of the copy module in Python or it should work? error description: No se puede encontrar el m?todo 'DBNull..ctor'. Error de c?digo fuente: L?nea 322: args = deepcopy(args, memo) L?nea 323: L?nea 324: y = callable(*args) L?nea 325: L?nea 326: memo[id(x)] = y Archivo de origen: /SistemaVentaBaseIP2/App_Script/copy.py Hotmail es m?s seguro. Con el Filtro Anti Spam tu cuenta est? mucho m?s protegida. Ver m?s _________________________________________________________________ ?Ten?s poco tiempo? Acced? a Hotmail mucho m?s r?pido. Ver m?s http://www.descubrehotmail.com/velocidad.asp -------------- next part -------------- An HTML attachment was scrubbed... URL: From aho1 at rockwellcollins.com Fri Jun 11 02:02:22 2010 From: aho1 at rockwellcollins.com (aho1 at rockwellcollins.com) Date: Thu, 10 Jun 2010 19:02:22 -0500 Subject: [IronPython] Accessing Iron Python Abstract Syntax Tree Message-ID: Hi, I am trying to use Iron Python's Compiler to generate an abstract syntax tree that I can use, something similar to compile(expr, filename, mode, ast.PyCF_ONLY_AST)in CPython. I can't seem to find a compatible module in Iron Python, though. I'm assuming this is possible because I can see that the code is there inside Iron Python's source code, but I can't seem to figure out what how to access this code from the outside. I do not want to create my own source code to AST parser, I just want to use Iron Python's default parser so I can process some Iron Python code. Thanks in advance. --- Andrew Ho Undergraduate Technical Intern Rockwell Collins -------------- next part -------------- An HTML attachment was scrubbed... URL: From nico at ramasoft.com Fri Jun 11 09:59:53 2010 From: nico at ramasoft.com (Nico Picavet) Date: Fri, 11 Jun 2010 09:59:53 +0200 Subject: [IronPython] call .net module from ironPython Message-ID: <5807998F14A141B4875628B4E795B7A8@NicoPC> Hi there, I run python scripts from within a vb.net sollution. I can add references to our dll's and call all classes, functions, subs etc. but now I run into a specific problem. In one of our dll's we have a module 'scriptutills' with a public function 'GetMaxIdentifier'that returns a unique number as a sort of identifier for a new project. I can add a reference to the containing dll but when I call scriptutills.'GetMaxIdentifier'() I get an error "'type' object has no attribute 'GetMaxIdentifier'" If I change the module into a class with the same subs, I c?n call the 'GetMaxIdentifier' function without any problems. Does anybody has a sollution for this? Thanks a lot. Nico -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Fri Jun 11 15:28:08 2010 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Fri, 11 Jun 2010 14:28:08 +0100 Subject: [IronPython] NLTK in C# application? In-Reply-To: <034501cb0956$15cf0f80$416d2e80$@com> References: <000001cb088d$01a03a80$04e0af80$@com> <4C10C831.7000308@voidspace.org.uk> <001201cb08a4$ec999ce0$c5ccd6a0$@com> <4C1104BA.2090705@voidspace.org.uk> <034501cb0956$15cf0f80$416d2e80$@com> Message-ID: <4C1239E8.8070007@voidspace.org.uk> On 11/06/2010 12:06, William Johnston wrote: > > Hello, > > Where is the sys.path file located? > If you start the IronPython console and execute "import sys", then "print sys.path" it will show you all the directories it looks when you try to import a module. You can manually add a directory to this path ("sys.path.append(r'c:\SomePath')") at the start of your code to add extra locations to your import path. All the best, Michael > Thanks. > > *From:* Michael Foord [mailto:fuzzyman at voidspace.org.uk] > *Sent:* Thursday, June 10, 2010 11:29 AM > *To:* Discussion of IronPython > *Cc:* William Johnston > *Subject:* Re: [IronPython] NLTK in C# application? > > On 10/06/2010 14:57, William Johnston wrote: > > Hello, > > > In order for NLTK to work, I need to install PyYaml. > > > However, the PyYaml installer does not recognize the IronPython > installation in the Registry. > > > How do I alter the registry? > > > I don't know - the folks on the pywin32 mailing list could probably > tell you. An easier route would be to install Python, then install > PyYaml, then either copy the files to somewhere on sys.path for > IronPython (or add your Python site-packages folder to sys.path in > your IronPython code). > > All the best, > > Michael Foord > > > > Thanks. > > *From:* users-bounces at lists.ironpython.com > > [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Michael Foord > *Sent:* Thursday, June 10, 2010 7:11 AM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] NLTK in C# application? > > On 10/06/2010 12:05, William Johnston wrote: > > Hello, > > How do I include the NLTK modules in a C# application? > > There is already code for embedded Python. > > > The first step is to try importing it and running some examples from > in IronPython. If that works then you just need to provide a 'bridge' > layer that embeds IronPython in your C# app and allows you to call > into IronPython to use NLTK. > > If NLTK *doesn't* work from IronPython it will probably be because it > uses C extension modules not available in IronPython. One way round > this is to use Ironclad. Again, try some NLTK examples from IronPython > but with Ironclad and see if that works. > > http://www.resolversystems.com/products/ironclad/ > > If it still doesn't work it may be worth reporting back here with the > problems to see if they are resolvable. > > All the best, > > Michael Foord > > > > Thanks. > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Fri Jun 11 15:56:20 2010 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Fri, 11 Jun 2010 14:56:20 +0100 Subject: [IronPython] NLTK in C# application? In-Reply-To: <00db01cb096d$7f2dbbe0$7d8933a0$@com> References: <000001cb088d$01a03a80$04e0af80$@com> <4C10C831.7000308@voidspace.org.uk> <001201cb08a4$ec999ce0$c5ccd6a0$@com> <4C1104BA.2090705@voidspace.org.uk> <034501cb0956$15cf0f80$416d2e80$@com> <4C1239E8.8070007@voidspace.org.uk> <00db01cb096d$7f2dbbe0$7d8933a0$@com> Message-ID: <4C124084.5010305@voidspace.org.uk> On 11/06/2010 14:53, William Johnston wrote: > > Mr. Foord: > > I apologize for so many questions. > > But it seems I cannot perform the folllowing statement: > > >>>import subprocess > > Which returns "No module named subprocess." > > Could you explain this? > I'm afraid there is no subprocess module (yet) for IronPython. Two alternatives are: http://www.ironpython.info/index.php/Launching_Sub-Processes http://www.ironpython.info/index.php/The_subprocess_module All the best, Michael Foord > As an aside, this works for Python 2.6. > > Thanks. > > *From:* Michael Foord [mailto:fuzzyman at voidspace.org.uk] > *Sent:* Friday, June 11, 2010 9:28 AM > *To:* William Johnston > *Cc:* Discussion of IronPython > *Subject:* Re: [IronPython] NLTK in C# application? > > On 11/06/2010 12:06, William Johnston wrote: > > Hello, > > Where is the sys.path file located? > > > If you start the IronPython console and execute "import sys", then > "print sys.path" it will show you all the directories it looks when > you try to import a module. > > You can manually add a directory to this path > ("sys.path.append(r'c:\SomePath')") at the start of your code to add > extra locations to your import path. > > All the best, > > Michael > > > Thanks. > > *From:* Michael Foord [mailto:fuzzyman at voidspace.org.uk] > *Sent:* Thursday, June 10, 2010 11:29 AM > *To:* Discussion of IronPython > *Cc:* William Johnston > *Subject:* Re: [IronPython] NLTK in C# application? > > On 10/06/2010 14:57, William Johnston wrote: > > Hello, > > > In order for NLTK to work, I need to install PyYaml. > > > However, the PyYaml installer does not recognize the IronPython > installation in the Registry. > > > How do I alter the registry? > > > I don't know - the folks on the pywin32 mailing list could probably > tell you. An easier route would be to install Python, then install > PyYaml, then either copy the files to somewhere on sys.path for > IronPython (or add your Python site-packages folder to sys.path in > your IronPython code). > > All the best, > > Michael Foord > > > > > Thanks. > > *From:* users-bounces at lists.ironpython.com > > [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Michael Foord > *Sent:* Thursday, June 10, 2010 7:11 AM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] NLTK in C# application? > > On 10/06/2010 12:05, William Johnston wrote: > > Hello, > > How do I include the NLTK modules in a C# application? > > There is already code for embedded Python. > > > The first step is to try importing it and running some examples from > in IronPython. If that works then you just need to provide a 'bridge' > layer that embeds IronPython in your C# app and allows you to call > into IronPython to use NLTK. > > If NLTK *doesn't* work from IronPython it will probably be because it > uses C extension modules not available in IronPython. One way round > this is to use Ironclad. Again, try some NLTK examples from IronPython > but with Ironclad and see if that works. > > http://www.resolversystems.com/products/ironclad/ > > If it still doesn't work it may be worth reporting back here with the > problems to see if they are resolvable. > > All the best, > > Michael Foord > > > > > Thanks. > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. > > > > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdhardy at gmail.com Fri Jun 11 17:06:46 2010 From: jdhardy at gmail.com (Jeff Hardy) Date: Fri, 11 Jun 2010 09:06:46 -0600 Subject: [IronPython] Accessing Iron Python Abstract Syntax Tree In-Reply-To: References: Message-ID: On Thu, Jun 10, 2010 at 6:02 PM, wrote: > I do not want to create my own source code to AST parser, I just want to use > Iron Python's default parser so I can process some Iron Python code. There's an implementation of the standard library 'ast' module (http://docs.python.org/library/ast.html) available at http://bitbucket.org/jdhardy/_ast/. You'll have to compile it from source, which may mean tweaking the references in the .csproj file. Let me know if you have any issues (I really should post some binaries...). - Jeff From merllab at microsoft.com Fri Jun 11 17:08:21 2010 From: merllab at microsoft.com (merllab at microsoft.com) Date: Fri, 11 Jun 2010 08:08:21 -0700 Subject: [IronPython] IronPython 2.6 CodePlex Source Update Message-ID: This is an automated email letting you know that sources have recently been pushed out. You can download these newer sources directly from http://ironpython.codeplex.com/SourceControl/changeset/view/67986. ADDED SOURCES $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/ClrStubs.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MemoryBlock.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MemoryMapping.V2.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MemoryReader.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MetadataExtensions.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MetadataImport.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MetadataName.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MetadataTableEnumerator.CCI.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MetadataTableImplementations.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MetadataTables.CCI.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MetadataTables.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/PEFileStructures.cs MODIFIED SOURCES $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/ClrStubs.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MemoryBlock.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MemoryMapping.V2.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MemoryReader.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MetadataExtensions.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MetadataImport.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MetadataName.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MetadataTableEnumerator.CCI.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MetadataTableImplementations.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MetadataTables.CCI.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MetadataTables.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/PEFileStructures.cs From curt at hagenlocher.org Fri Jun 11 17:40:07 2010 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Fri, 11 Jun 2010 08:40:07 -0700 Subject: [IronPython] call .net module from ironPython In-Reply-To: <5807998F14A141B4875628B4E795B7A8@NicoPC> References: <5807998F14A141B4875628B4E795B7A8@NicoPC> Message-ID: I created a project VbClassLibrary which contains a public module Module1. The module contains a public function GetMaxIdentifier. From IronPython 2.6, I say IronPython 2.6 (2.6.10920.0) on .NET 4.0.30319.1 Type "help", "copyright", "credits" or "license" for more information. >>> import clr >>> clr.AddReference('VbClassLibrary') >>> from VbClassLibrary import Module1 >>> Module1.GetMaxIdentifier >>> Module1.GetMaxIdentifier(2) 4 >>> So there doesn't seem to be a general problem accessing functions in VB.NETmodules. On Fri, Jun 11, 2010 at 12:59 AM, Nico Picavet wrote: > Hi there, > > I run python scripts from within a vb.net sollution. > I can add references to our dll's and call all classes, functions, subs > etc. but now I run into a specific problem. > In one of our dll's we have a module 'scriptutills' with a public function > 'GetMaxIdentifier'that returns a unique number as a sort of identifier for a > new project. > I can add a reference to the containing dll but when I call > scriptutills.'GetMaxIdentifier'() I get an error "'type' object has no > attribute 'GetMaxIdentifier'" > If I change the module into a class with the same subs, I c?n call the > 'GetMaxIdentifier' function without any problems. Does anybody has a > sollution for this? > Thanks a lot. > > Nico > > _______________________________________________ > 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 marcel.vandendungen at gmail.com Sat Jun 12 06:51:31 2010 From: marcel.vandendungen at gmail.com (Marcel) Date: Fri, 11 Jun 2010 21:51:31 -0700 (PDT) Subject: [IronPython] Convert between python array and .NET Array Message-ID: <8a6c92fd-2586-4c9d-8beb-eebccf6411ad@40g2000pry.googlegroups.com> I have a python method that returns a Python byte array.array('c'). Now, I want to copy this array using System.Runtime.InteropServices.Marshal.Copy. This method however expects a .NET Array. import array from System.Runtime.InteropServices import Marshal bytes = array.array('c') bytes.append('a') bytes.append('b') bytes.append('c') Marshal.Copy(bytes, dest, 0, 3) Is there a way to make this work without copying the data? If not, how do I convert the data in the Python array to the .NET array? Thanks, -- Marcel From davidescobar at ieee.org Sat Jun 12 08:27:39 2010 From: davidescobar at ieee.org (David Escobar) Date: Fri, 11 Jun 2010 23:27:39 -0700 Subject: [IronPython] Convert between python array and .NET Array In-Reply-To: <8a6c92fd-2586-4c9d-8beb-eebccf6411ad@40g2000pry.googlegroups.com> References: <8a6c92fd-2586-4c9d-8beb-eebccf6411ad@40g2000pry.googlegroups.com> Message-ID: This worked for me (based on the code you provided): import clr from System import Array dest = Array[str](bytes) On Fri, Jun 11, 2010 at 9:51 PM, Marcel wrote: > I have a python method that returns a Python byte array.array('c'). > > Now, I want to copy this array using > System.Runtime.InteropServices.Marshal.Copy. This method however > expects a .NET Array. > > import array > from System.Runtime.InteropServices import Marshal > > bytes = array.array('c') > bytes.append('a') > bytes.append('b') > bytes.append('c') > Marshal.Copy(bytes, dest, 0, 3) > > Is there a way to make this work without copying the data? If not, how > do I convert the data in the Python array to the .NET array? > > Thanks, > -- Marcel > _______________________________________________ > 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 nutter78 at gmail.com Sat Jun 12 17:22:29 2010 From: nutter78 at gmail.com (Anthony) Date: Sat, 12 Jun 2010 17:22:29 +0200 Subject: [IronPython] Problem Closing Application Message-ID: Hi All Just to state - I'm a real newbie to programming & ironpython I have an application that has 2 forms. The application gets started in the progam.py module(btw i'm using #develop). This calls another module - login.py. This is a login form which validates user names/passwords. Once this is validated I *hide* the form and call the second module - MainForm.py. The program runs fine - except that when I close the MainForm form - the application is still running. I know it's because a login.py object is hidden. What I'm asking is how construct the programming in such a way that this does not happen - that when the second form is closed - the application closes; or is there a better way to do this? Regards Anthony -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Sun Jun 13 01:52:03 2010 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sun, 13 Jun 2010 00:52:03 +0100 Subject: [IronPython] Problem Closing Application In-Reply-To: References: Message-ID: <4C141DA3.7060308@voidspace.org.uk> On 12/06/2010 16:22, Anthony wrote: > Hi All > > Just to state - I'm a real newbie to programming & ironpython > I have an application that has 2 forms. The application gets started > in the progam.py module(btw i'm using #develop). This calls another > module - login.py. This is a login form which validates user > names/passwords. Once this is validated I _hide_ the form and call the > second module - MainForm.py. The program runs fine - except that when > I close the MainForm form - the application is still running. I know > it's because a login.py object is hidden. What I'm asking is how > construct the programming in such a way that this does not happen - > that when the second form is closed - the application closes; or is > there a better way to do this? How about closing the login form instead of hiding it? Another way is to handle the Closing event on your main form and close the login form then. You can also call Application.Exit() (I believe - this is off the top of my head so you should check) to exit the GUI event loop. All the best, Michael > > Regards > > Anthony > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. -------------- next part -------------- An HTML attachment was scrubbed... URL: From evans.d.andrew at gmail.com Sun Jun 13 05:20:21 2010 From: evans.d.andrew at gmail.com (Andrew Evans) Date: Sat, 12 Jun 2010 20:20:21 -0700 Subject: [IronPython] IronPython ASP.net MVC Message-ID: Hello I am running IronPython 2.6 and have installed IIS. I am curious where to put the dlls and Web.config in my set up for using IronPython with asp.net Would appreciate any help Cheers Andrew -------------- next part -------------- An HTML attachment was scrubbed... URL: From marcel.vandendungen at gmail.com Sun Jun 13 07:07:56 2010 From: marcel.vandendungen at gmail.com (Marcel) Date: Sat, 12 Jun 2010 22:07:56 -0700 (PDT) Subject: [IronPython] Convert between python array and .NET Array In-Reply-To: References: <8a6c92fd-2586-4c9d-8beb-eebccf6411ad@40g2000pry.googlegroups.com> Message-ID: <01ba1ba5-ca1a-4893-b54d-ba791aad54fb@n20g2000prh.googlegroups.com> I think I simplified my example a little too far. I'm trying to display a Bitmap from bytes generated in Python code. bytes = array.array('c') # tried 'B' also # generate bitmap bytes ... bitmap = Bitmap(width, height, PixelFormat.Format24bppRgb) bmData = bitmap.LockBits(Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb) total_bytes = (bmData.Stride) * bmData.Height Marshal.Copy(bytes, 0, bmData.Scan0, total_bytes); bitmap.UnlockBits(bmData) The IronPython exception I'm getting is: TypeError: expected IntPtr, got array Casting the bytes array to IntPtr changed the error into: TypeError: expected int, got array I'm using IronPython 2.6 (2.6.10920.0) on .NET 2.0.50727.4927 Any idea? Thanks, -- Marcel On Jun 11, 11:27?pm, David Escobar wrote: > This worked for me (based on the code you provided): > > import clr > from System import Array > > dest = Array[str](bytes) > > On Fri, Jun 11, 2010 at 9:51 PM, Marcel wrote: > > > I have a python method that returns a Python byte array.array('c'). > > > Now, I want to copy this array using > > System.Runtime.InteropServices.Marshal.Copy. This method however > > expects a .NET Array. > > > import array > > from System.Runtime.InteropServices import Marshal > > > bytes = array.array('c') > > bytes.append('a') > > bytes.append('b') > > bytes.append('c') > > Marshal.Copy(bytes, dest, 0, 3) > > > Is there a way to make this work without copying the data? If not, how > > do I convert the data in the Python array to the .NET array? > > > Thanks, > > -- Marcel > > _______________________________________________ > > Users mailing list > > Us... at lists.ironpython.com > >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > Users mailing list > Us... at lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users-ironpython.com From curt at hagenlocher.org Sun Jun 13 07:27:59 2010 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sat, 12 Jun 2010 22:27:59 -0700 Subject: [IronPython] Convert between python array and .NET Array In-Reply-To: <01ba1ba5-ca1a-4893-b54d-ba791aad54fb@n20g2000prh.googlegroups.com> References: <8a6c92fd-2586-4c9d-8beb-eebccf6411ad@40g2000pry.googlegroups.com> <01ba1ba5-ca1a-4893-b54d-ba791aad54fb@n20g2000prh.googlegroups.com> Message-ID: It looks like the automatic overload resolution may be failing -- at least, it's worth trying to resolve the overload manually. This would be something like from System import Array, Byte, IntPtr Marshal.Copy.Overloads[Array[Byte], int, IntPtr, int](bytes, 0, bmData.Scan0, total_bytes) On Sat, Jun 12, 2010 at 10:07 PM, Marcel wrote: > I think I simplified my example a little too far. I'm trying to > display a Bitmap from bytes generated in Python code. > > bytes = array.array('c') # tried 'B' also > # generate bitmap bytes ... > > bitmap = Bitmap(width, height, PixelFormat.Format24bppRgb) > > bmData = bitmap.LockBits(Rectangle(0, 0, bitmap.Width, > bitmap.Height), > ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb) > > total_bytes = (bmData.Stride) * bmData.Height > > Marshal.Copy(bytes, 0, bmData.Scan0, total_bytes); > > bitmap.UnlockBits(bmData) > > The IronPython exception I'm getting is: > TypeError: expected IntPtr, got array > > Casting the bytes array to IntPtr changed the error into: > TypeError: expected int, got array > > I'm using IronPython 2.6 (2.6.10920.0) on .NET 2.0.50727.4927 > > Any idea? > > Thanks, > -- Marcel > > On Jun 11, 11:27 pm, David Escobar wrote: > > This worked for me (based on the code you provided): > > > > import clr > > from System import Array > > > > dest = Array[str](bytes) > > > > On Fri, Jun 11, 2010 at 9:51 PM, Marcel >wrote: > > > > > I have a python method that returns a Python byte array.array('c'). > > > > > Now, I want to copy this array using > > > System.Runtime.InteropServices.Marshal.Copy. This method however > > > expects a .NET Array. > > > > > import array > > > from System.Runtime.InteropServices import Marshal > > > > > bytes = array.array('c') > > > bytes.append('a') > > > bytes.append('b') > > > bytes.append('c') > > > Marshal.Copy(bytes, dest, 0, 3) > > > > > Is there a way to make this work without copying the data? If not, how > > > do I convert the data in the Python array to the .NET array? > > > > > Thanks, > > > -- Marcel > > > _______________________________________________ > > > Users mailing list > > > Us... at lists.ironpython.com > > >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > > > _______________________________________________ > > Users mailing list > > Us... at lists.ironpython.comhttp:// > lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > 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 yngipy at gmail.com Sun Jun 13 08:41:29 2010 From: yngipy at gmail.com (yngipy hernan) Date: Sun, 13 Jun 2010 01:41:29 -0500 Subject: [IronPython] Debugging IronPython script using "IronPython tools for Visual Studio(CP2) Message-ID: Hi all, I am trying to debug my scripts using VS2010 Pro, for non-class based code it is working as expected. But got hiccups inside a class, this is what I am getting: 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\ipy.exe' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\Microsoft.Dynamic.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\Microsoft.Scripting.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\IronPython.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\IronPython.Modules.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.debug.scripting' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\ISymWrapper\v4.0_4.0.0.0__b03f5f7f11d50a3a\ISymWrapper.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Anonymously Hosted DynamicMethods Assembly' A first chance exception of type 'Microsoft.Scripting.ArgumentTypeException' occurred in Snippets.debug.scripting 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.scripting' A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in Microsoft.Dynamic.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in Microsoft.Dynamic.dll A first chance exception of type 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll A first chance exception of type 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll The program '[3216] ipy.exe: Managed (v4.0.30319)' has exited with code 1 (0x1). Regards, Yngipy -------------- next part -------------- An HTML attachment was scrubbed... URL: From yngipy at gmail.com Sun Jun 13 08:44:32 2010 From: yngipy at gmail.com (yngipy hernan) Date: Sun, 13 Jun 2010 01:44:32 -0500 Subject: [IronPython] Debugging IronPython script using "IronPython tools for Visual Studio(CP2) In-Reply-To: References: Message-ID: Seems like it only happens when I am using UI Automation, is this known issue? Regards, Yngipy On Sun, Jun 13, 2010 at 1:41 AM, yngipy hernan wrote: > Hi all, > > I am trying to debug my scripts using VS2010 Pro, for non-class based code > it is working as expected. But got hiccups inside a class, this is what I am > getting: > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll' > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\ipy.exe' > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\Microsoft.Dynamic.dll' > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\Microsoft.Scripting.dll' > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll' > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll' > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll' > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\IronPython.dll' > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll' > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll' > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\IronPython.Modules.dll' > 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.debug.scripting' > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_32\ISymWrapper\v4.0_4.0.0.0__b03f5f7f11d50a3a\ISymWrapper.dll' > 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Anonymously Hosted DynamicMethods > Assembly' > A first chance exception of type > 'Microsoft.Scripting.ArgumentTypeException' occurred in > Snippets.debug.scripting > 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.scripting' > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in IronPython.dll > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in IronPython.dll > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in IronPython.dll > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in IronPython.dll > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in IronPython.Modules.dll > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in IronPython.Modules.dll > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in Microsoft.Dynamic.dll > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in IronPython.Modules.dll > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in IronPython.Modules.dll > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in Microsoft.Dynamic.dll > A first chance exception of type > 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll > A first chance exception of type > 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll > The program '[3216] ipy.exe: Managed (v4.0.30319)' has exited with code 1 > (0x1). > > Regards, > Yngipy > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Sun Jun 13 21:33:06 2010 From: dinov at microsoft.com (Dino Viehland) Date: Sun, 13 Jun 2010 19:33:06 +0000 Subject: [IronPython] Debugging IronPython script using "IronPython tools for Visual Studio(CP2) In-Reply-To: References: Message-ID: <1A472770E042064698CB5ADC83A12ACD489EED38@TK5EX14MBXC111.redmond.corp.microsoft.com> I'm assuming the problem here is that this is exiting w/ a non-zero exit code indicating something went wrong. But what went wrong really depends on what the last exception is - there appears to be some failure to import something. The other exceptions are expected as the standard library throws exceptions on startup. Can you enable breaking on the import exception (or all exceptions and continue after these) and see what the last exception is? From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of yngipy hernan Sent: Saturday, June 12, 2010 11:41 PM To: users at lists.ironpython.com Subject: [IronPython] Debugging IronPython script using "IronPython tools for Visual Studio(CP2) Hi all, I am trying to debug my scripts using VS2010 Pro, for non-class based code it is working as expected. But got hiccups inside a class, this is what I am getting: 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\ipy.exe' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\Microsoft.Dynamic.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\Microsoft.Scripting.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\IronPython.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\IronPython.Modules.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.debug.scripting' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\ISymWrapper\v4.0_4.0.0.0__b03f5f7f11d50a3a\ISymWrapper.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Anonymously Hosted DynamicMethods Assembly' A first chance exception of type 'Microsoft.Scripting.ArgumentTypeException' occurred in Snippets.debug.scripting 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.scripting' A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in Microsoft.Dynamic.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in Microsoft.Dynamic.dll A first chance exception of type 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll A first chance exception of type 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll The program '[3216] ipy.exe: Managed (v4.0.30319)' has exited with code 1 (0x1). Regards, Yngipy -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at voidspace.org.uk Mon Jun 14 00:30:54 2010 From: michael at voidspace.org.uk (Michael Foord) Date: Sun, 13 Jun 2010 23:30:54 +0100 Subject: [IronPython] Problem with ScriptSource.GetCodeProperties() Message-ID: <4C155C1E.3040005@voidspace.org.uk> Hello all, IronPython 2.6.1: >>> import clr >>> clr.AddReference('IronPython') >>> clr.AddReference('Microsoft.Scripting') >>> from IronPython.Hosting import Python >>> from Microsoft.Scripting import SourceCodeKind >>> engine = Python.CreateEngine() >>> scope = engine.CreateScope() >>> text = 'lambda' >>> source = engine.CreateScriptSourceFromString(text, 'stdin', SourceCodeKind.InteractiveCode) >>> result = source.GetCodeProperties() Traceback (most recent call last): File "", line 1, in TypeError: Value cannot be null. Parameter name: parameters If instead of 'stdin' I use '' like I used to it throws for that as well. All the best, Michael Foord -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (?BOGUS AGREEMENTS?) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. From marcel.vandendungen at gmail.com Mon Jun 14 00:51:07 2010 From: marcel.vandendungen at gmail.com (Marcel) Date: Sun, 13 Jun 2010 15:51:07 -0700 (PDT) Subject: [IronPython] Convert between python array and .NET Array In-Reply-To: References: <8a6c92fd-2586-4c9d-8beb-eebccf6411ad@40g2000pry.googlegroups.com> <01ba1ba5-ca1a-4893-b54d-ba791aad54fb@n20g2000prh.googlegroups.com> Message-ID: <0fed1f28-0aee-4107-bc80-f0d74673b32e@40g2000pry.googlegroups.com> Hi Curt, Your suggestion gives me: TypeError: expected Array[Byte], got array bytes is a Python array. I tried: Marshal.Copy.Overloads[Array[Byte], int, IntPtr, int] (bytes.buffer_info()[0], 0, bmData.Scan0, total_bytes) but that gave the error: TypeError: expected Array[Byte], got int This small sample application demonstrates the issue: import array import struct import StringIO import clr clr.AddReference("System.Windows.Forms") clr.AddReference("System.Drawing") from System import Array, Byte, Char, IntPtr from System.Windows.Forms import Application, Form, PictureBox from System.Drawing import Size, Point, Bitmap, Color, Rectangle from System.Drawing.Imaging import PixelFormat, ImageLockMode from System.Runtime.InteropServices import Marshal class IForm(Form): def __init__(self): bytes = array.array('B') width = 25 height = 20 for i in range(width * height): bytes.append(i % 256) # R bytes.append(i % 256) # G bytes.append(i % 256) # B bitmap = Bitmap(width, height, PixelFormat.Format24bppRgb) bmData = bitmap.LockBits(Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb) total_bytes = (bmData.Stride) * bmData.Height Marshal.Copy.Overloads[Array[Byte], int, IntPtr, int]( bytes.buffer_info()[0], 0, bmData.Scan0, total_bytes) bitmap.UnlockBits(bmData) ## for x in range(width): ## for y in range(height): ## i = y * width + x ## bitmap.SetPixel(x, y, Color.FromArgb(bytes[i], bytes[i+1], bytes[i+2])) pb = PictureBox() pb.Size = Size(bitmap.Width, bitmap.Height) pb.Location = Point(2, 2) pb.Image = bitmap pb.Parent = self self.Size = Size(bitmap.Width + 20, bitmap.Height + 45) self.CenterToScreen() Application.Run(IForm()) Using bitmap.SetPixel works, but I cannot find how to make it work using the LockBits and Marshal.Copy. Thanks, -- Marcel On Jun 12, 10:27?pm, Curt Hagenlocher wrote: > It looks like the automatic overload resolution may be failing -- at least, > it's worth trying to resolve the overload manually. This would be something > like > > from System import Array, Byte, IntPtr > Marshal.Copy.Overloads[Array[Byte], int, IntPtr, int](bytes, 0, > bmData.Scan0, total_bytes) > > On Sat, Jun 12, 2010 at 10:07 PM, Marcel wrote: > > > I think I simplified my example a little too far. I'm trying to > > display a Bitmap from bytes generated in Python code. > > > ? ? ? ?bytes = array.array('c') # tried 'B' also > > ? ? ? ?# generate bitmap bytes ... > > > ? ? ? ?bitmap = Bitmap(width, height, PixelFormat.Format24bppRgb) > > > ? ? ? ?bmData = bitmap.LockBits(Rectangle(0, 0, bitmap.Width, > > bitmap.Height), > > ? ? ? ? ?ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb) > > > ? ? ? ?total_bytes = (bmData.Stride) * bmData.Height > > > ? ? ? ?Marshal.Copy(bytes, 0, bmData.Scan0, total_bytes); > > > ? ? ? ?bitmap.UnlockBits(bmData) > > > The IronPython exception I'm getting is: > > TypeError: expected IntPtr, got array > > > Casting the bytes array to IntPtr changed the error into: > > TypeError: expected int, got array > > > I'm using IronPython 2.6 (2.6.10920.0) on .NET 2.0.50727.4927 > > > Any idea? > > > Thanks, > > -- Marcel > > > On Jun 11, 11:27 pm, David Escobar wrote: > > > This worked for me (based on the code you provided): > > > > import clr > > > from System import Array > > > > dest = Array[str](bytes) > > > > On Fri, Jun 11, 2010 at 9:51 PM, Marcel > >wrote: > > > > > I have a python method that returns a Python byte array.array('c'). > > > > > Now, I want to copy this array using > > > > System.Runtime.InteropServices.Marshal.Copy. This method however > > > > expects a .NET Array. > > > > > import array > > > > from System.Runtime.InteropServices import Marshal > > > > > bytes = array.array('c') > > > > bytes.append('a') > > > > bytes.append('b') > > > > bytes.append('c') > > > > Marshal.Copy(bytes, dest, 0, 3) > > > > > Is there a way to make this work without copying the data? If not, how > > > > do I convert the data in the Python array to the .NET array? > > > > > Thanks, > > > > -- Marcel > > > > _______________________________________________ > > > > Users mailing list > > > > Us... at lists.ironpython.com > > > >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > > > Users mailing list > > > Us... at lists.ironpython.comhttp:// > > lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > > Users mailing list > > Us... at lists.ironpython.com > >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > Users mailing list > Us... at lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users-ironpython.com From yngipy at gmail.com Mon Jun 14 05:53:26 2010 From: yngipy at gmail.com (yngipy hernan) Date: Mon, 14 Jun 2010 11:53:26 +0800 Subject: [IronPython] Debugging IronPython script using "IronPython tools for Visual Studio(CP2) In-Reply-To: <1A472770E042064698CB5ADC83A12ACD489EED38@TK5EX14MBXC111.redmond.corp.microsoft.com> References: <1A472770E042064698CB5ADC83A12ACD489EED38@TK5EX14MBXC111.redmond.corp.microsoft.com> Message-ID: *RE: Can you enable breaking on the import exception (or all exceptions and continue after these) and see what the last exception is?* Sorry, I am not familiar how to do this. I search for some tutorial, but if you have some wiki out there I can use, I can probably give it a try. Regards, Yngipy On Mon, Jun 14, 2010 at 3:33 AM, Dino Viehland wrote: > I?m assuming the problem here is that this is exiting w/ a non-zero exit > code indicating something went wrong. But what went wrong really depends on > what the last exception is ? there appears to be some failure to import > something. The other exceptions are expected as the standard library throws > exceptions on startup. Can you enable breaking on the import exception (or > all exceptions and continue after these) and see what the last exception is? > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *yngipy hernan > *Sent:* Saturday, June 12, 2010 11:41 PM > *To:* users at lists.ironpython.com > *Subject:* [IronPython] Debugging IronPython script using "IronPython > tools for Visual Studio(CP2) > > > > Hi all, > > > > I am trying to debug my scripts using VS2010 Pro, for non-class based code > it is working as expected. But got hiccups inside a class, this is what I am > getting: > > > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\ipy.exe' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\Microsoft.Dynamic.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\Microsoft.Scripting.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\IronPython.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\IronPython.Modules.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.debug.scripting' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_32\ISymWrapper\v4.0_4.0.0.0__b03f5f7f11d50a3a\ISymWrapper.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Anonymously Hosted DynamicMethods > Assembly' > > A first chance exception of type > 'Microsoft.Scripting.ArgumentTypeException' occurred in > Snippets.debug.scripting > > 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.scripting' > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in IronPython.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in IronPython.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in IronPython.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in IronPython.dll > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in IronPython.Modules.dll > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in IronPython.Modules.dll > > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in Microsoft.Dynamic.dll > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in IronPython.Modules.dll > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in IronPython.Modules.dll > > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in Microsoft.Dynamic.dll > > A first chance exception of type > 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll > > A first chance exception of type > 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll > > The program '[3216] ipy.exe: Managed (v4.0.30319)' has exited with code 1 > (0x1). > > > > Regards, > > Yngipy > > _______________________________________________ > 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 nutter78 at gmail.com Mon Jun 14 09:53:55 2010 From: nutter78 at gmail.com (Anthony) Date: Mon, 14 Jun 2010 09:53:55 +0200 Subject: [IronPython] Problem Closing Application In-Reply-To: <4C141DA3.7060308@voidspace.org.uk> References: <4C141DA3.7060308@voidspace.org.uk> Message-ID: Hi Michael Sorry for the late reply - only got back to my email this morning :-) I tried to close the form - but when doing that - the whole application closed - I think this was mainly due to the fact that that form was seen as the "main form"?? Sorry about this real noob question - but I'm just starting out - and this is very frustrating for me, I know it's probably something stupid that I'm doing! Let me post my code here - and see what you can see! Here is my code Program.py import clr clr.AddReference('System.Windows.Forms') clr.AddReference('System.Drawing') #clr.AddReference('System.Data.SQLite') #clr.AddReference('Ironpython') #clr.AddReference('System.Security.Policy') from System.Security.Policy import Hash from System.Data.SQLite import * import sys sys.path.append("C:\Python26\Lib") sys.path.append("C:\Program Files\IronPython 2.6\Lib") from System.Windows.Forms import Application import Log_In import MainForm import sqlite3 Application.EnableVisualStyles() #form = MainForm.Log_In() form = Log_In.Log_In() Application.Run(form) ********************************************** Log_In.py import System.Drawing import System.Windows.Forms from System.Drawing import * from System.Windows.Forms import * import MainForm #import sqlite3 #import System.Data.SQLite class Log_In(Form): def __init__(self): self.InitializeComponent() def InitializeComponent(self): self._label1 = System.Windows.Forms.Label() self._txt_Login = System.Windows.Forms.TextBox() self._label2 = System.Windows.Forms.Label() self._txt_pwd = System.Windows.Forms.MaskedTextBox() self._bt_login = System.Windows.Forms.Button() self._bt_cancel = System.Windows.Forms.Button() self.SuspendLayout() # # label1 # self._label1.Location = System.Drawing.Point(40, 116) self._label1.Name = "label1" self._label1.Size = System.Drawing.Size(107, 25) self._label1.TabIndex = 0 self._label1.Text = "Login Name" self._label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter # # txt_Login # self._txt_Login.Location = System.Drawing.Point(173, 121) self._txt_Login.Name = "txt_Login" self._txt_Login.Size = System.Drawing.Size(160, 20) self._txt_Login.TabIndex = 1 self._txt_Login.Text = "cc" self._txt_Login.TextChanged += self.Txt_LoginTextChanged # # label2 # self._label2.Location = System.Drawing.Point(40, 174) self._label2.Name = "label2" self._label2.Size = System.Drawing.Size(107, 22) self._label2.TabIndex = 2 self._label2.Text = "Password" self._label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter # # txt_pwd # self._txt_pwd.Location = System.Drawing.Point(173, 174) self._txt_pwd.Name = "txt_pwd" self._txt_pwd.PasswordChar = "*" self._txt_pwd.Size = System.Drawing.Size(160, 20) self._txt_pwd.TabIndex = 3 # # bt_login # self._bt_login.Location = System.Drawing.Point(85, 252) self._bt_login.Name = "bt_login" self._bt_login.Size = System.Drawing.Size(164, 41) self._bt_login.TabIndex = 4 self._bt_login.Text = "Login" self._bt_login.UseVisualStyleBackColor = True self._bt_login.Click += self.Bt_loginClick # # bt_cancel # self._bt_cancel.Location = System.Drawing.Point(346, 255) self._bt_cancel.Name = "bt_cancel" self._bt_cancel.Size = System.Drawing.Size(165, 37) self._bt_cancel.TabIndex = 5 self._bt_cancel.Text = "Cancel" self._bt_cancel.UseVisualStyleBackColor = True self._bt_cancel.Click += self.Bt_cancelClick # # Log_In # self.AcceptButton = self._bt_login self.ClientSize = System.Drawing.Size(649, 401) self.Controls.Add(self._bt_cancel) self.Controls.Add(self._bt_login) self.Controls.Add(self._txt_pwd) self.Controls.Add(self._label2) self.Controls.Add(self._txt_Login) self.Controls.Add(self._label1) self.Name = "Log_In" self.Text = """ Description of Class1. """ self.ResumeLayout(False) self.PerformLayout() def Bt_loginClick(self, sender, e): MsgBox = System.Windows.Forms.MessageBox if self._txt_Login.Text == "test" and self._txt_pwd.Text == "test": #MsgBox.Show("Welcome to the Wonderful World of Visual Basic") MF = mf() MF.Show() MF.Activate() MF.Select() self.Hide() #MF.SetTopLevel = "True" else: MsgBox.Show("UserName Or Password Incorrect") #pass def Txt_LoginTextChanged(self, sender, e): pass def Bt_cancelClick(self, sender, e): self.Close() class mf(MainForm.MainForm): pass #conn = sqlite3.connect(r"c:\tester.sqlite") #c = conn.cursor() #c.execute("""insert into test values (Null,'Bozz11','Crazyman11')""") #conn.commit() #c.close() class encrypt_a(object): def EncryptString(self, strEncrypted): b = System.Text.ASCIIEncoding.ASCII.GetBytes(strEncrypted) encryptedConnectionString = System.Convert.ToBase64String(b) return encryptedConnectionString def __init__(self): pass class decrypt_a(object): def DecryptString(self, encrString): b = System.Convert.FromBase64String(encrString) decryptedConnectionString = System.Text.ASCIIEncoding.ASCII.GetString(b) return decryptedConnectionString #ac = "Anthony" #cc = encrypt_a().EncryptString(ac) #cca = Log_In()._txt_Login.Text = "tett ******************************************************************************* MainForm.py import System.Drawing import System.Windows.Forms from System.Drawing import * from System.Windows.Forms import * import Log_In class MainForm(Form): def __init__(self): #pass self.InitializeComponent() def InitializeComponent(self): #xx.Close() self._textBox1 = System.Windows.Forms.TextBox() self.SuspendLayout() # # textBox1 # self._textBox1.Location = System.Drawing.Point(129, 101) self._textBox1.Name = "textBox1" self._textBox1.Size = System.Drawing.Size(231, 20) self._textBox1.TabIndex = 0 # # MainForm # self.ClientSize = System.Drawing.Size(503, 356) self.Controls.Add(self._textBox1) self.Name = "MainForm" self.Text = "HS&E" self.Load += self.MainFormLoad self.ResumeLayout(False) #self.PerformLayout() #self.OnFormClosing(Application.Exit()) def MainFormLoad(self, sender, e): pass Hope you can help out with this! On Sun, Jun 13, 2010 at 1:52 AM, Michael Foord wrote: > On 12/06/2010 16:22, Anthony wrote: > > Hi All > > Just to state - I'm a real newbie to programming & ironpython > I have an application that has 2 forms. The application gets started in the > progam.py module(btw i'm using #develop). This calls another module - > login.py. This is a login form which validates user names/passwords. Once > this is validated I *hide* the form and call the second module - > MainForm.py. The program runs fine - except that when I close the MainForm > form - the application is still running. I know it's because a login.py > object is hidden. What I'm asking is how construct the programming in such a > way that this does not happen - that when the second form is closed - the > application closes; or is there a better way to do this? > > > How about closing the login form instead of hiding it? Another way is to > handle the Closing event on your main form and close the login form then. > You can also call Application.Exit() (I believe - this is off the top of my > head so you should check) to exit the GUI event loop. > > All the best, > > Michael > > > Regards > > Anthony > > > _______________________________________________ > Users mailing listUsers at lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > -- http://www.ironpythoninaction.com/http://www.voidspace.org.uk/blog > > READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (?BOGUS AGREEMENTS?) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From seob at gmx.ch Mon Jun 14 11:12:15 2010 From: seob at gmx.ch (Severin Obertuefer) Date: Mon, 14 Jun 2010 11:12:15 +0200 Subject: [IronPython] Expression and lambda functions Message-ID: Hello I have an c# class with a method taking an expression: *Refresh(System.Linq.Expressions.Expression> predicate)* in c# I can call it like; *Refresh(a => a.ShopArtikel == true);* is it possible to call the method from python in a similar way? I'm thinking of *Refresh(lambda a: a.ShopArtikel == true)* * * how can I convert the lambda function to the expeced expression type? best, Severin -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Mon Jun 14 12:03:38 2010 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 14 Jun 2010 11:03:38 +0100 Subject: [IronPython] Problem Closing Application In-Reply-To: References: <4C141DA3.7060308@voidspace.org.uk> Message-ID: <4C15FE7A.50801@voidspace.org.uk> On 14/06/2010 08:53, Anthony wrote: > Hi Michael > > Sorry for the late reply - only got back to my email this morning :-) > I tried to close the form - but when doing that - the whole > application closed - I think this was mainly due to the fact that that > form was seen as the "main form"?? I thought closing the whole application was what you wanted to do? In your original email you asked: The program runs fine - except that when I close the MainForm form - the application is still running. I know it's because a login.py object is hidden. What I'm asking is how construct the programming in such a way that this does not happen - that when the second form is closed - the application closes; So now the application closing is a problem? All the best, Michael > Sorry about this real noob question - but I'm just starting out - and > this is very frustrating for me, I know it's probably something stupid > that I'm doing! Let me post my code here - and see what you can see! > Here is my code > > Program.py > import clr > clr.AddReference('System.Windows.Forms') > clr.AddReference('System.Drawing') > #clr.AddReference('System.Data.SQLite') > #clr.AddReference('Ironpython') > #clr.AddReference('System.Security.Policy') > from System.Security.Policy import Hash > from System.Data.SQLite import * > import sys > sys.path.append("C:\Python26\Lib") > sys.path.append("C:\Program Files\IronPython 2.6\Lib") > from System.Windows.Forms import Application > > import Log_In > import MainForm > import sqlite3 > > > Application.EnableVisualStyles() > #form = MainForm.Log_In() > form = Log_In.Log_In() > Application.Run(form) > > > ********************************************** > > > > Log_In.py > > > import System.Drawing > import System.Windows.Forms > > from System.Drawing import * > from System.Windows.Forms import * > import MainForm > #import sqlite3 > > #import System.Data.SQLite > > > > class Log_In(Form): > def __init__(self): > self.InitializeComponent() > > def InitializeComponent(self): > self._label1 = System.Windows.Forms.Label() > self._txt_Login = System.Windows.Forms.TextBox() > self._label2 = System.Windows.Forms.Label() > self._txt_pwd = System.Windows.Forms.MaskedTextBox() > self._bt_login = System.Windows.Forms.Button() > self._bt_cancel = System.Windows.Forms.Button() > self.SuspendLayout() > # > # label1 > # > self._label1.Location = System.Drawing.Point(40, 116) > self._label1.Name = "label1" > self._label1.Size = System.Drawing.Size(107, 25) > self._label1.TabIndex = 0 > self._label1.Text = "Login Name" > self._label1.TextAlign = > System.Drawing.ContentAlignment.MiddleCenter > # > # txt_Login > # > self._txt_Login.Location = System.Drawing.Point(173, 121) > self._txt_Login.Name = "txt_Login" > self._txt_Login.Size = System.Drawing.Size(160, 20) > self._txt_Login.TabIndex = 1 > self._txt_Login.Text = "cc" > self._txt_Login.TextChanged += self.Txt_LoginTextChanged > # > # label2 > # > self._label2.Location = System.Drawing.Point(40, 174) > self._label2.Name = "label2" > self._label2.Size = System.Drawing.Size(107, 22) > self._label2.TabIndex = 2 > self._label2.Text = "Password" > self._label2.TextAlign = > System.Drawing.ContentAlignment.MiddleCenter > # > # txt_pwd > # > self._txt_pwd.Location = System.Drawing.Point(173, 174) > self._txt_pwd.Name = "txt_pwd" > self._txt_pwd.PasswordChar = "*" > self._txt_pwd.Size = System.Drawing.Size(160, 20) > self._txt_pwd.TabIndex = 3 > # > # bt_login > # > self._bt_login.Location = System.Drawing.Point(85, 252) > self._bt_login.Name = "bt_login" > self._bt_login.Size = System.Drawing.Size(164, 41) > self._bt_login.TabIndex = 4 > self._bt_login.Text = "Login" > self._bt_login.UseVisualStyleBackColor = True > self._bt_login.Click += self.Bt_loginClick > # > # bt_cancel > # > self._bt_cancel.Location = System.Drawing.Point(346, 255) > self._bt_cancel.Name = "bt_cancel" > self._bt_cancel.Size = System.Drawing.Size(165, 37) > self._bt_cancel.TabIndex = 5 > self._bt_cancel.Text = "Cancel" > self._bt_cancel.UseVisualStyleBackColor = True > self._bt_cancel.Click += self.Bt_cancelClick > # > # Log_In > # > self.AcceptButton = self._bt_login > self.ClientSize = System.Drawing.Size(649, 401) > self.Controls.Add(self._bt_cancel) > self.Controls.Add(self._bt_login) > self.Controls.Add(self._txt_pwd) > self.Controls.Add(self._label2) > self.Controls.Add(self._txt_Login) > self.Controls.Add(self._label1) > self.Name = "Log_In" > self.Text = """ > Description of Class1. > > """ > self.ResumeLayout(False) > self.PerformLayout() > > > def Bt_loginClick(self, sender, e): > MsgBox = System.Windows.Forms.MessageBox > > if self._txt_Login.Text == "test" and self._txt_pwd.Text == > "test": > #MsgBox.Show("Welcome to the Wonderful World of Visual Basic") > MF = mf() > MF.Show() > MF.Activate() > MF.Select() > self.Hide() > #MF.SetTopLevel = "True" > else: > MsgBox.Show("UserName Or Password Incorrect") > > #pass > > def Txt_LoginTextChanged(self, sender, e): > pass > > def Bt_cancelClick(self, sender, e): > self.Close() > > class mf(MainForm.MainForm): > pass > #conn = sqlite3.connect(r"c:\tester.sqlite") > #c = conn.cursor() > #c.execute("""insert into test values (Null,'Bozz11','Crazyman11')""") > #conn.commit() > #c.close() > > > > class encrypt_a(object): > > def EncryptString(self, strEncrypted): > b = System.Text.ASCIIEncoding.ASCII.GetBytes(strEncrypted) > encryptedConnectionString = System.Convert.ToBase64String(b) > return encryptedConnectionString > > def __init__(self): > pass > > class decrypt_a(object): > > def DecryptString(self, encrString): > b = System.Convert.FromBase64String(encrString) > decryptedConnectionString = > System.Text.ASCIIEncoding.ASCII.GetString(b) > return decryptedConnectionString > > #ac = "Anthony" > #cc = encrypt_a().EncryptString(ac) > #cca = Log_In()._txt_Login.Text = "tett > > > > ******************************************************************************* > > MainForm.py > > > import System.Drawing > import System.Windows.Forms > > from System.Drawing import * > from System.Windows.Forms import * > import Log_In > > > > > class MainForm(Form): > def __init__(self): > #pass > > self.InitializeComponent() > > > def InitializeComponent(self): > #xx.Close() > self._textBox1 = System.Windows.Forms.TextBox() > self.SuspendLayout() > # > # textBox1 > # > self._textBox1.Location = System.Drawing.Point(129, 101) > self._textBox1.Name = "textBox1" > self._textBox1.Size = System.Drawing.Size(231, 20) > self._textBox1.TabIndex = 0 > # > # MainForm > # > self.ClientSize = System.Drawing.Size(503, 356) > self.Controls.Add(self._textBox1) > self.Name = "MainForm" > self.Text = "HS&E" > self.Load += self.MainFormLoad > self.ResumeLayout(False) > #self.PerformLayout() > #self.OnFormClosing(Application.Exit()) > > > > > > > def MainFormLoad(self, sender, e): > pass > > > > > Hope you can help out with this! > > > > > > > > > > On Sun, Jun 13, 2010 at 1:52 AM, Michael Foord > > wrote: > > On 12/06/2010 16:22, Anthony wrote: >> Hi All >> >> Just to state - I'm a real newbie to programming & ironpython >> I have an application that has 2 forms. The application gets >> started in the progam.py module(btw i'm using #develop). This >> calls another module - login.py. This is a login form which >> validates user names/passwords. Once this is validated I _hide_ >> the form and call the second module - MainForm.py. The program >> runs fine - except that when I close the MainForm form - the >> application is still running. I know it's because a login.py >> object is hidden. What I'm asking is how construct the >> programming in such a way that this does not happen - that when >> the second form is closed - the application closes; or is there a >> better way to do this? > > How about closing the login form instead of hiding it? Another way > is to handle the Closing event on your main form and close the > login form then. You can also call Application.Exit() (I believe > - this is off the top of my head so you should check) to exit the > GUI event loop. > > All the best, > > Michael > >> >> Regards >> >> Anthony >> >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (?BOGUS AGREEMENTS?) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. > > > > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (?BOGUS AGREEMENTS?) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. -------------- next part -------------- An HTML attachment was scrubbed... URL: From nutter78 at gmail.com Mon Jun 14 12:09:08 2010 From: nutter78 at gmail.com (Anthony) Date: Mon, 14 Jun 2010 12:09:08 +0200 Subject: [IronPython] Problem Closing Application In-Reply-To: <4C15FE7A.50801@voidspace.org.uk> References: <4C141DA3.7060308@voidspace.org.uk> <4C15FE7A.50801@voidspace.org.uk> Message-ID: Hi No if I run that code - and I am presented with the MainForm form, when I hit the close button on the top of the form - the application is still running in the background. If I try to close the Log_In form programatically, instead of just hiding it, the whole application closes - without letting me go the MainForm form. So not to sure how to accomplish this - have spent quite a lot of time on the net trying to get the answer - to no avail. Hope that you'll be able to resolve this issue for me, as I'm stuck in my project, until I can get this right! Regards Anthony On Mon, Jun 14, 2010 at 12:03 PM, Michael Foord wrote: > On 14/06/2010 08:53, Anthony wrote: > > Hi Michael > > Sorry for the late reply - only got back to my email this morning :-) > I tried to close the form - but when doing that - the whole application > closed - I think this was mainly due to the fact that that form was seen as > the "main form"?? > > > I thought closing the whole application was what you wanted to do? In your > original email you asked: > > > The program runs fine - except that when I close the MainForm form - > the application is still running. I know it's because a login.py object is > hidden. What I'm asking is how construct the programming in such a way that > this does not happen - that when the second form is closed - the application > closes; > > So now the application closing is a problem? > > All the best, > > Michael > > > > Sorry about this real noob question - but I'm just starting out - and this > is very frustrating for me, I know it's probably something stupid that I'm > doing! Let me post my code here - and see what you can see! > Here is my code > > Program.py > import clr > clr.AddReference('System.Windows.Forms') > clr.AddReference('System.Drawing') > #clr.AddReference('System.Data.SQLite') > #clr.AddReference('Ironpython') > #clr.AddReference('System.Security.Policy') > from System.Security.Policy import Hash > from System.Data.SQLite import * > import sys > sys.path.append("C:\Python26\Lib") > sys.path.append("C:\Program Files\IronPython 2.6\Lib") > from System.Windows.Forms import Application > > import Log_In > import MainForm > import sqlite3 > > > Application.EnableVisualStyles() > #form = MainForm.Log_In() > form = Log_In.Log_In() > Application.Run(form) > > > ********************************************** > > > > Log_In.py > > > import System.Drawing > import System.Windows.Forms > > from System.Drawing import * > from System.Windows.Forms import * > import MainForm > #import sqlite3 > > #import System.Data.SQLite > > > > class Log_In(Form): > def __init__(self): > self.InitializeComponent() > > def InitializeComponent(self): > self._label1 = System.Windows.Forms.Label() > self._txt_Login = System.Windows.Forms.TextBox() > self._label2 = System.Windows.Forms.Label() > self._txt_pwd = System.Windows.Forms.MaskedTextBox() > self._bt_login = System.Windows.Forms.Button() > self._bt_cancel = System.Windows.Forms.Button() > self.SuspendLayout() > # > # label1 > # > self._label1.Location = System.Drawing.Point(40, 116) > self._label1.Name = "label1" > self._label1.Size = System.Drawing.Size(107, 25) > self._label1.TabIndex = 0 > self._label1.Text = "Login Name" > self._label1.TextAlign = > System.Drawing.ContentAlignment.MiddleCenter > # > # txt_Login > # > self._txt_Login.Location = System.Drawing.Point(173, 121) > self._txt_Login.Name = "txt_Login" > self._txt_Login.Size = System.Drawing.Size(160, 20) > self._txt_Login.TabIndex = 1 > self._txt_Login.Text = "cc" > self._txt_Login.TextChanged += self.Txt_LoginTextChanged > # > # label2 > # > self._label2.Location = System.Drawing.Point(40, 174) > self._label2.Name = "label2" > self._label2.Size = System.Drawing.Size(107, 22) > self._label2.TabIndex = 2 > self._label2.Text = "Password" > self._label2.TextAlign = > System.Drawing.ContentAlignment.MiddleCenter > # > # txt_pwd > # > self._txt_pwd.Location = System.Drawing.Point(173, 174) > self._txt_pwd.Name = "txt_pwd" > self._txt_pwd.PasswordChar = "*" > self._txt_pwd.Size = System.Drawing.Size(160, 20) > self._txt_pwd.TabIndex = 3 > # > # bt_login > # > self._bt_login.Location = System.Drawing.Point(85, 252) > self._bt_login.Name = "bt_login" > self._bt_login.Size = System.Drawing.Size(164, 41) > self._bt_login.TabIndex = 4 > self._bt_login.Text = "Login" > self._bt_login.UseVisualStyleBackColor = True > self._bt_login.Click += self.Bt_loginClick > # > # bt_cancel > # > self._bt_cancel.Location = System.Drawing.Point(346, 255) > self._bt_cancel.Name = "bt_cancel" > self._bt_cancel.Size = System.Drawing.Size(165, 37) > self._bt_cancel.TabIndex = 5 > self._bt_cancel.Text = "Cancel" > self._bt_cancel.UseVisualStyleBackColor = True > self._bt_cancel.Click += self.Bt_cancelClick > # > # Log_In > # > self.AcceptButton = self._bt_login > self.ClientSize = System.Drawing.Size(649, 401) > self.Controls.Add(self._bt_cancel) > self.Controls.Add(self._bt_login) > self.Controls.Add(self._txt_pwd) > self.Controls.Add(self._label2) > self.Controls.Add(self._txt_Login) > self.Controls.Add(self._label1) > self.Name = "Log_In" > self.Text = """ > Description of Class1. > > """ > self.ResumeLayout(False) > self.PerformLayout() > > > def Bt_loginClick(self, sender, e): > MsgBox = System.Windows.Forms.MessageBox > > if self._txt_Login.Text == "test" and self._txt_pwd.Text == "test": > #MsgBox.Show("Welcome to the Wonderful World of Visual Basic") > MF = mf() > MF.Show() > MF.Activate() > MF.Select() > self.Hide() > #MF.SetTopLevel = "True" > else: > MsgBox.Show("UserName Or Password Incorrect") > > #pass > > def Txt_LoginTextChanged(self, sender, e): > pass > > def Bt_cancelClick(self, sender, e): > self.Close() > > class mf(MainForm.MainForm): > pass > #conn = sqlite3.connect(r"c:\tester.sqlite") > #c = conn.cursor() > #c.execute("""insert into test values (Null,'Bozz11','Crazyman11')""") > #conn.commit() > #c.close() > > > > class encrypt_a(object): > > def EncryptString(self, strEncrypted): > b = System.Text.ASCIIEncoding.ASCII.GetBytes(strEncrypted) > encryptedConnectionString = System.Convert.ToBase64String(b) > return encryptedConnectionString > > def __init__(self): > pass > > class decrypt_a(object): > > def DecryptString(self, encrString): > b = System.Convert.FromBase64String(encrString) > decryptedConnectionString = > System.Text.ASCIIEncoding.ASCII.GetString(b) > return decryptedConnectionString > > #ac = "Anthony" > #cc = encrypt_a().EncryptString(ac) > #cca = Log_In()._txt_Login.Text = "tett > > > > > ******************************************************************************* > > MainForm.py > > > import System.Drawing > import System.Windows.Forms > > from System.Drawing import * > from System.Windows.Forms import * > import Log_In > > > > > class MainForm(Form): > def __init__(self): > #pass > > self.InitializeComponent() > > > def InitializeComponent(self): > #xx.Close() > self._textBox1 = System.Windows.Forms.TextBox() > self.SuspendLayout() > # > # textBox1 > # > self._textBox1.Location = System.Drawing.Point(129, 101) > self._textBox1.Name = "textBox1" > self._textBox1.Size = System.Drawing.Size(231, 20) > self._textBox1.TabIndex = 0 > # > # MainForm > # > self.ClientSize = System.Drawing.Size(503, 356) > self.Controls.Add(self._textBox1) > self.Name = "MainForm" > self.Text = "HS&E" > self.Load += self.MainFormLoad > self.ResumeLayout(False) > #self.PerformLayout() > #self.OnFormClosing(Application.Exit()) > > > > > > > def MainFormLoad(self, sender, e): > pass > > > > > Hope you can help out with this! > > > > > > > > > > On Sun, Jun 13, 2010 at 1:52 AM, Michael Foord wrote: > >> On 12/06/2010 16:22, Anthony wrote: >> >> Hi All >> >> Just to state - I'm a real newbie to programming & ironpython >> I have an application that has 2 forms. The application gets started in >> the progam.py module(btw i'm using #develop). This calls another module - >> login.py. This is a login form which validates user names/passwords. Once >> this is validated I *hide* the form and call the second module - >> MainForm.py. The program runs fine - except that when I close the MainForm >> form - the application is still running. I know it's because a login.py >> object is hidden. What I'm asking is how construct the programming in such a >> way that this does not happen - that when the second form is closed - the >> application closes; or is there a better way to do this? >> >> >> How about closing the login form instead of hiding it? Another way is to >> handle the Closing event on your main form and close the login form then. >> You can also call Application.Exit() (I believe - this is off the top of my >> head so you should check) to exit the GUI event loop. >> >> All the best, >> >> Michael >> >> >> Regards >> >> Anthony >> >> >> _______________________________________________ >> Users mailing listUsers at lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> >> >> -- http://www.ironpythoninaction.com/http://www.voidspace.org.uk/blog >> >> READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (?BOGUS AGREEMENTS?) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. >> >> >> >> > > > -- http://www.ironpythoninaction.com/http://www.voidspace.org.uk/blog > > READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (?BOGUS AGREEMENTS?) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cenovsky at bakalari.cz Mon Jun 14 13:00:43 2010 From: cenovsky at bakalari.cz (Lukas Cenovsky) Date: Mon, 14 Jun 2010 13:00:43 +0200 Subject: [IronPython] Problem Closing Application In-Reply-To: References: <4C141DA3.7060308@voidspace.org.uk> Message-ID: <4C160BDB.3030308@bakalari.cz> Anthony wrote: > Hi Michael > > Sorry for the late reply - only got back to my email this morning :-) > I tried to close the form - but when doing that - the whole > application closed - I think this was mainly due to the fact that that > form was seen as the "main form"?? Sorry about this real noob question > - but I'm just starting out - and this is very frustrating for me, I > know it's probably something stupid that I'm doing! Let me post my > code here - and see what you can see! > Here is my code > > #form = MainForm.Log_In() > form = Log_In.Log_In() > Application.Run(form) If you run the above code, the main form of the application is Log_In form. You have to run application with hidden main form, display log in form and after successful log in, display the main form. By default, the application is closed when the main form of the application is closed. If you want different bahavior, see ApplicationContext class: http://msdn.microsoft.com/en-us/library/07d698ye(v=VS.100).aspx -- -- Luk?? From curt at hagenlocher.org Mon Jun 14 16:05:07 2010 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 14 Jun 2010 07:05:07 -0700 Subject: [IronPython] Convert between python array and .NET Array In-Reply-To: <0fed1f28-0aee-4107-bc80-f0d74673b32e@40g2000pry.googlegroups.com> References: <8a6c92fd-2586-4c9d-8beb-eebccf6411ad@40g2000pry.googlegroups.com> <01ba1ba5-ca1a-4893-b54d-ba791aad54fb@n20g2000prh.googlegroups.com> <0fed1f28-0aee-4107-bc80-f0d74673b32e@40g2000pry.googlegroups.com> Message-ID: Ah, I'm clearly not familiar with how the array type was implemented. The first member of the buffer_info() tuple is an IntPtr, so you probably want the [IntPtr, int, IntPtr, int] overload of Marshal.Copy. In fact, if you use the buffer_info() approach, you may be able to avoid manually specifying the overload. (Though there's something to be said for the types as a form of documentation -- particularly given the opacity of the call to buffer_info()). Personally, my rule of thumb is to use the Python standard library for portable and "mostly Pythonic" code, but to use .NET types when doing "mostly .NET". In this case, I think I would have created an Array[Byte] instead of an array('B') as it's a bit more self-documenting. On Sun, Jun 13, 2010 at 3:51 PM, Marcel wrote: > Hi Curt, > > Your suggestion gives me: > TypeError: expected Array[Byte], got array > > bytes is a Python array. I tried: > Marshal.Copy.Overloads[Array[Byte], int, IntPtr, int] > (bytes.buffer_info()[0], 0, bmData.Scan0, total_bytes) > > but that gave the error: > TypeError: expected Array[Byte], got int > > This small sample application demonstrates the issue: > > import array > import struct > import StringIO > > import clr > clr.AddReference("System.Windows.Forms") > clr.AddReference("System.Drawing") > > from System import Array, Byte, Char, IntPtr > from System.Windows.Forms import Application, Form, PictureBox > from System.Drawing import Size, Point, Bitmap, Color, Rectangle > from System.Drawing.Imaging import PixelFormat, ImageLockMode > from System.Runtime.InteropServices import Marshal > > class IForm(Form): > > def __init__(self): > bytes = array.array('B') > > width = 25 > height = 20 > > for i in range(width * height): > bytes.append(i % 256) # R > bytes.append(i % 256) # G > bytes.append(i % 256) # B > > bitmap = Bitmap(width, height, PixelFormat.Format24bppRgb) > > bmData = bitmap.LockBits(Rectangle(0, 0, bitmap.Width, > bitmap.Height), > ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb) > > total_bytes = (bmData.Stride) * bmData.Height > > Marshal.Copy.Overloads[Array[Byte], int, IntPtr, int]( > bytes.buffer_info()[0], 0, bmData.Scan0, total_bytes) > bitmap.UnlockBits(bmData) > > ## for x in range(width): > ## for y in range(height): > ## i = y * width + x > ## bitmap.SetPixel(x, y, Color.FromArgb(bytes[i], > bytes[i+1], bytes[i+2])) > > pb = PictureBox() > pb.Size = Size(bitmap.Width, bitmap.Height) > pb.Location = Point(2, 2) > pb.Image = bitmap > pb.Parent = self > > self.Size = Size(bitmap.Width + 20, bitmap.Height + 45) > self.CenterToScreen() > > Application.Run(IForm()) > > Using bitmap.SetPixel works, but I cannot find how to make it work > using the LockBits and Marshal.Copy. > > Thanks, > -- Marcel > > On Jun 12, 10:27 pm, Curt Hagenlocher wrote: > > It looks like the automatic overload resolution may be failing -- at > least, > > it's worth trying to resolve the overload manually. This would be > something > > like > > > > from System import Array, Byte, IntPtr > > Marshal.Copy.Overloads[Array[Byte], int, IntPtr, int](bytes, 0, > > bmData.Scan0, total_bytes) > > > > On Sat, Jun 12, 2010 at 10:07 PM, Marcel >wrote: > > > > > I think I simplified my example a little too far. I'm trying to > > > display a Bitmap from bytes generated in Python code. > > > > > bytes = array.array('c') # tried 'B' also > > > # generate bitmap bytes ... > > > > > bitmap = Bitmap(width, height, PixelFormat.Format24bppRgb) > > > > > bmData = bitmap.LockBits(Rectangle(0, 0, bitmap.Width, > > > bitmap.Height), > > > ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb) > > > > > total_bytes = (bmData.Stride) * bmData.Height > > > > > Marshal.Copy(bytes, 0, bmData.Scan0, total_bytes); > > > > > bitmap.UnlockBits(bmData) > > > > > The IronPython exception I'm getting is: > > > TypeError: expected IntPtr, got array > > > > > Casting the bytes array to IntPtr changed the error into: > > > TypeError: expected int, got array > > > > > I'm using IronPython 2.6 (2.6.10920.0) on .NET 2.0.50727.4927 > > > > > Any idea? > > > > > Thanks, > > > -- Marcel > > > > > On Jun 11, 11:27 pm, David Escobar wrote: > > > > This worked for me (based on the code you provided): > > > > > > import clr > > > > from System import Array > > > > > > dest = Array[str](bytes) > > > > > > On Fri, Jun 11, 2010 at 9:51 PM, Marcel < > marcel.vandendun... at gmail.com > > > >wrote: > > > > > > > I have a python method that returns a Python byte array.array('c'). > > > > > > > Now, I want to copy this array using > > > > > System.Runtime.InteropServices.Marshal.Copy. This method however > > > > > expects a .NET Array. > > > > > > > import array > > > > > from System.Runtime.InteropServices import Marshal > > > > > > > bytes = array.array('c') > > > > > bytes.append('a') > > > > > bytes.append('b') > > > > > bytes.append('c') > > > > > Marshal.Copy(bytes, dest, 0, 3) > > > > > > > Is there a way to make this work without copying the data? If not, > how > > > > > do I convert the data in the Python array to the .NET array? > > > > > > > Thanks, > > > > > -- Marcel > > > > > _______________________________________________ > > > > > Users mailing list > > > > > Us... at lists.ironpython.com > > > > >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > _______________________________________________ > > > > Users mailing list > > > > Us... at lists.ironpython.comhttp:// > > > lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > _______________________________________________ > > > Users mailing list > > > Us... at lists.ironpython.com > > >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > > > _______________________________________________ > > Users mailing list > > Us... at lists.ironpython.comhttp:// > lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > 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 merllab at microsoft.com Mon Jun 14 17:07:49 2010 From: merllab at microsoft.com (merllab at microsoft.com) Date: Mon, 14 Jun 2010 08:07:49 -0700 Subject: [IronPython] IronPython 2.6 CodePlex Source Update Message-ID: <725ea19a-3ec6-4982-a904-8fb72354ab77@tk5-exsmh-c101.redmond.corp.microsoft.com> This is an automated email letting you know that sources have recently been pushed out. You can download these newer sources directly from http://ironpython.codeplex.com/SourceControl/changeset/view/68511. MODIFIED SOURCES $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/ClrStubs.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MemoryBlock.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MemoryMapping.V2.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MemoryReader.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MetadataImport.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MetadataName.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MetadataTableImplementations.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/PEFileStructures.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Properties/AssemblyInfo.cs From jdhardy at gmail.com Mon Jun 14 18:07:17 2010 From: jdhardy at gmail.com (Jeff Hardy) Date: Mon, 14 Jun 2010 10:07:17 -0600 Subject: [IronPython] Expression and lambda functions In-Reply-To: References: Message-ID: On Mon, Jun 14, 2010 at 3:12 AM, Severin Obertuefer wrote: > how can I convert the lambda function to the expeced expression type? It's not currently possible, as far as I know. You should vote for issue #26044 http://ironpython.codeplex.com/workitem/26044 . - Jeff From Jimmy.Schementi at microsoft.com Mon Jun 14 19:09:54 2010 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Mon, 14 Jun 2010 17:09:54 +0000 Subject: [IronPython] IronPython ASP.net MVC In-Reply-To: References: Message-ID: <1B42307CD4AADD438CDDA2FE1121CC92173E4A6A@TK5EX14MBXC141.redmond.corp.microsoft.com> To just use the IronPython engine in a ASP.NET application, place the DLLs in the same place you would put other 3rd party DLLs; a "bin" directory at the root of the app (same dir as your web.config). See http://aspnet.codeplex.com/wikipage?title=Dynamic%20Language%20Support for direct application framework integration with ASP.NET (code-behind PY files). There is no support currently for IronPython in ASP.NET MVC, but there is a project that works for IronRuby today, and with minimal work could work for IronPython too: http://github.com/jschementi/ironrubymvc. ~js From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Andrew Evans Sent: Saturday, June 12, 2010 8:20 PM To: Discussion of IronPython Subject: [IronPython] IronPython ASP.net MVC Hello I am running IronPython 2.6 and have installed IIS. I am curious where to put the dlls and Web.config in my set up for using IronPython with asp.net Would appreciate any help Cheers Andrew -------------- next part -------------- An HTML attachment was scrubbed... URL: From yngipy at gmail.com Tue Jun 15 02:12:26 2010 From: yngipy at gmail.com (yngipy hernan) Date: Tue, 15 Jun 2010 08:12:26 +0800 Subject: [IronPython] Debugging IronPython script using "IronPython tools for Visual Studio(CP2) In-Reply-To: References: <1A472770E042064698CB5ADC83A12ACD489EED38@TK5EX14MBXC111.redmond.corp.microsoft.com> Message-ID: Ok, I need help. Can't find in internet how to "enable breaking on import exception". Anyone knows how to do this? Regards, Yngipy On Mon, Jun 14, 2010 at 11:53 AM, yngipy hernan wrote: > *RE: Can you enable breaking on the import exception (or all exceptions > and continue after these) and see what the last exception is?* > Sorry, I am not familiar how to do this. I search for some tutorial, but if > you have some wiki out there I can use, I can probably give it a try. > > Regards, > Yngipy > > On Mon, Jun 14, 2010 at 3:33 AM, Dino Viehland wrote: > >> I?m assuming the problem here is that this is exiting w/ a non-zero exit >> code indicating something went wrong. But what went wrong really depends on >> what the last exception is ? there appears to be some failure to import >> something. The other exceptions are expected as the standard library throws >> exceptions on startup. Can you enable breaking on the import exception (or >> all exceptions and continue after these) and see what the last exception is? >> >> >> >> *From:* users-bounces at lists.ironpython.com [mailto: >> users-bounces at lists.ironpython.com] *On Behalf Of *yngipy hernan >> *Sent:* Saturday, June 12, 2010 11:41 PM >> *To:* users at lists.ironpython.com >> *Subject:* [IronPython] Debugging IronPython script using "IronPython >> tools for Visual Studio(CP2) >> >> >> >> Hi all, >> >> >> >> I am trying to debug my scripts using VS2010 Pro, for non-class based code >> it is working as expected. But got hiccups inside a class, this is what I am >> getting: >> >> >> >> 'ipy.exe' (Managed (v4.0.30319)): Loaded >> 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll' >> >> 'ipy.exe' (Managed (v4.0.30319)): Loaded >> 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython >> Tools for Visual Studio\0.2\ipy.exe' >> >> 'ipy.exe' (Managed (v4.0.30319)): Loaded >> 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython >> Tools for Visual Studio\0.2\Microsoft.Dynamic.dll' >> >> 'ipy.exe' (Managed (v4.0.30319)): Loaded >> 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython >> Tools for Visual Studio\0.2\Microsoft.Scripting.dll' >> >> 'ipy.exe' (Managed (v4.0.30319)): Loaded >> 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll' >> >> 'ipy.exe' (Managed (v4.0.30319)): Loaded >> 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll' >> >> 'ipy.exe' (Managed (v4.0.30319)): Loaded >> 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll' >> >> 'ipy.exe' (Managed (v4.0.30319)): Loaded >> 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython >> Tools for Visual Studio\0.2\IronPython.dll' >> >> 'ipy.exe' (Managed (v4.0.30319)): Loaded >> 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll' >> >> 'ipy.exe' (Managed (v4.0.30319)): Loaded >> 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll' >> >> 'ipy.exe' (Managed (v4.0.30319)): Loaded >> 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython >> Tools for Visual Studio\0.2\IronPython.Modules.dll' >> >> 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.debug.scripting' >> >> 'ipy.exe' (Managed (v4.0.30319)): Loaded >> 'C:\Windows\Microsoft.Net\assembly\GAC_32\ISymWrapper\v4.0_4.0.0.0__b03f5f7f11d50a3a\ISymWrapper.dll' >> >> 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Anonymously Hosted >> DynamicMethods Assembly' >> >> A first chance exception of type >> 'Microsoft.Scripting.ArgumentTypeException' occurred in >> Snippets.debug.scripting >> >> 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.scripting' >> >> A first chance exception of type 'System.MissingMemberException' occurred >> in IronPython.dll >> >> A first chance exception of type 'IronPython.Runtime.UnboundNameException' >> occurred in IronPython.dll >> >> A first chance exception of type 'IronPython.Runtime.UnboundNameException' >> occurred in Microsoft.Dynamic.dll >> >> A first chance exception of type >> 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll >> >> A first chance exception of type 'IronPython.Runtime.UnboundNameException' >> occurred in Microsoft.Dynamic.dll >> >> A first chance exception of type 'IronPython.Runtime.UnboundNameException' >> occurred in IronPython.dll >> >> A first chance exception of type 'IronPython.Runtime.UnboundNameException' >> occurred in Microsoft.Dynamic.dll >> >> A first chance exception of type >> 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll >> >> A first chance exception of type 'IronPython.Runtime.UnboundNameException' >> occurred in Microsoft.Dynamic.dll >> >> A first chance exception of type 'IronPython.Runtime.UnboundNameException' >> occurred in IronPython.dll >> >> A first chance exception of type 'IronPython.Runtime.UnboundNameException' >> occurred in Microsoft.Dynamic.dll >> >> A first chance exception of type >> 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll >> >> A first chance exception of type 'IronPython.Runtime.UnboundNameException' >> occurred in Microsoft.Dynamic.dll >> >> A first chance exception of type 'IronPython.Runtime.UnboundNameException' >> occurred in IronPython.dll >> >> A first chance exception of type 'System.MissingMemberException' occurred >> in IronPython.dll >> >> A first chance exception of type 'System.MissingMemberException' occurred >> in IronPython.dll >> >> A first chance exception of type 'System.MissingMemberException' occurred >> in IronPython.dll >> >> A first chance exception of type 'System.MissingMemberException' occurred >> in IronPython.dll >> >> A first chance exception of type 'System.MissingMemberException' occurred >> in IronPython.dll >> >> A first chance exception of type 'System.MissingMemberException' occurred >> in IronPython.dll >> >> A first chance exception of type 'System.ComponentModel.Win32Exception' >> occurred in IronPython.Modules.dll >> >> A first chance exception of type 'System.ComponentModel.Win32Exception' >> occurred in IronPython.Modules.dll >> >> A first chance exception of type >> 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll >> >> A first chance exception of type 'System.ComponentModel.Win32Exception' >> occurred in Microsoft.Dynamic.dll >> >> A first chance exception of type 'System.ComponentModel.Win32Exception' >> occurred in IronPython.Modules.dll >> >> A first chance exception of type 'System.ComponentModel.Win32Exception' >> occurred in IronPython.Modules.dll >> >> A first chance exception of type >> 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll >> >> A first chance exception of type 'System.ComponentModel.Win32Exception' >> occurred in Microsoft.Dynamic.dll >> >> A first chance exception of type >> 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll >> >> A first chance exception of type >> 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll >> >> The program '[3216] ipy.exe: Managed (v4.0.30319)' has exited with code 1 >> (0x1). >> >> >> >> Regards, >> >> Yngipy >> >> _______________________________________________ >> 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 yngipy at gmail.com Tue Jun 15 02:50:04 2010 From: yngipy at gmail.com (yngipy hernan) Date: Tue, 15 Jun 2010 08:50:04 +0800 Subject: [IronPython] Debugging IronPython script using "IronPython tools for Visual Studio(CP2) In-Reply-To: References: <1A472770E042064698CB5ADC83A12ACD489EED38@TK5EX14MBXC111.redmond.corp.microsoft.com> Message-ID: Ok, I am sure if what I did was correct. I did Debug | Exceptions..., since I don't know why exceptions, I just checked all. Then this is what I got: 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\ipy.exe' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\Microsoft.Dynamic.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\Microsoft.Scripting.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\IronPython.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\IronPython.Modules.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.debug.scripting' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\ISymWrapper\v4.0_4.0.0.0__b03f5f7f11d50a3a\ISymWrapper.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Anonymously Hosted DynamicMethods Assembly' A first chance exception of type 'Microsoft.Scripting.ArgumentTypeException' occurred in Snippets.debug.scripting Additional information: Python Exception: TypeError 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.scripting' A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll Additional information: 'module' object has no attribute '__all__' A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll Additional information: name 'fork' is not defined A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll Additional information: name 'fork' is not defined The thread '' (0x930) has exited with code 0 (0x0). A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll Additional information: Exception has been thrown by the target of an invocation. A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll Additional information: name 'fork' is not defined A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll Additional information: name 'spawnvp' is not defined A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll Additional information: name 'spawnvp' is not defined A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll Additional information: Exception has been thrown by the target of an invocation. A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll Additional information: name 'spawnvp' is not defined A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll Additional information: name 'fork' is not defined A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll Additional information: name 'fork' is not defined A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll Additional information: Exception has been thrown by the target of an invocation. A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll Additional information: name 'fork' is not defined A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll Additional information: global name 'statvfs_result' is not defined A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll Additional information: 'module' object has no attribute '__file__' A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll Additional information: 'module' object has no attribute '__file__' A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll Additional information: 'module' object has no attribute '__file__' A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll Additional information: 'module' object has no attribute '__file__' A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll Additional information: 'module' object has no attribute '__file__' A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll Additional information: 'module' object has no attribute '__file__' A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll Additional information: Python Exception: WindowsError A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll Additional information: Python Exception: WindowsError A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll Additional information: Exception has been thrown by the target of an invocation. A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in Microsoft.Dynamic.dll Additional information: Python Exception: WindowsError A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll Additional information: Python Exception: WindowsError A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll Additional information: Python Exception: WindowsError A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll Additional information: Exception has been thrown by the target of an invocation. A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in Microsoft.Dynamic.dll Additional information: Python Exception: WindowsError A first chance exception of type 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll Additional information: No module named sitecustomize A first chance exception of type 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll Additional information: No module named usercustomize The program '[3708] ipy.exe: Managed (v4.0.30319)' has exited with code 1 (0x1). On Tue, Jun 15, 2010 at 8:12 AM, yngipy hernan wrote: > Ok, I need help. Can't find in internet how to "enable breaking on import > exception". Anyone knows how to do this? > > Regards, > Yngipy > > > On Mon, Jun 14, 2010 at 11:53 AM, yngipy hernan wrote: > >> *RE: Can you enable breaking on the import exception (or all exceptions >> and continue after these) and see what the last exception is?* >> Sorry, I am not familiar how to do this. I search for some tutorial, but >> if you have some wiki out there I can use, I can probably give it a try. >> >> Regards, >> Yngipy >> >> On Mon, Jun 14, 2010 at 3:33 AM, Dino Viehland wrote: >> >>> I?m assuming the problem here is that this is exiting w/ a non-zero >>> exit code indicating something went wrong. But what went wrong really >>> depends on what the last exception is ? there appears to be some failure to >>> import something. The other exceptions are expected as the standard library >>> throws exceptions on startup. Can you enable breaking on the import >>> exception (or all exceptions and continue after these) and see what the last >>> exception is? >>> >>> >>> >>> *From:* users-bounces at lists.ironpython.com [mailto: >>> users-bounces at lists.ironpython.com] *On Behalf Of *yngipy hernan >>> *Sent:* Saturday, June 12, 2010 11:41 PM >>> *To:* users at lists.ironpython.com >>> *Subject:* [IronPython] Debugging IronPython script using "IronPython >>> tools for Visual Studio(CP2) >>> >>> >>> >>> Hi all, >>> >>> >>> >>> I am trying to debug my scripts using VS2010 Pro, for non-class based >>> code it is working as expected. But got hiccups inside a class, this is what >>> I am getting: >>> >>> >>> >>> 'ipy.exe' (Managed (v4.0.30319)): Loaded >>> 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll' >>> >>> 'ipy.exe' (Managed (v4.0.30319)): Loaded >>> 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython >>> Tools for Visual Studio\0.2\ipy.exe' >>> >>> 'ipy.exe' (Managed (v4.0.30319)): Loaded >>> 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython >>> Tools for Visual Studio\0.2\Microsoft.Dynamic.dll' >>> >>> 'ipy.exe' (Managed (v4.0.30319)): Loaded >>> 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython >>> Tools for Visual Studio\0.2\Microsoft.Scripting.dll' >>> >>> 'ipy.exe' (Managed (v4.0.30319)): Loaded >>> 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll' >>> >>> 'ipy.exe' (Managed (v4.0.30319)): Loaded >>> 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll' >>> >>> 'ipy.exe' (Managed (v4.0.30319)): Loaded >>> 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll' >>> >>> 'ipy.exe' (Managed (v4.0.30319)): Loaded >>> 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython >>> Tools for Visual Studio\0.2\IronPython.dll' >>> >>> 'ipy.exe' (Managed (v4.0.30319)): Loaded >>> 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll' >>> >>> 'ipy.exe' (Managed (v4.0.30319)): Loaded >>> 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll' >>> >>> 'ipy.exe' (Managed (v4.0.30319)): Loaded >>> 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython >>> Tools for Visual Studio\0.2\IronPython.Modules.dll' >>> >>> 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.debug.scripting' >>> >>> 'ipy.exe' (Managed (v4.0.30319)): Loaded >>> 'C:\Windows\Microsoft.Net\assembly\GAC_32\ISymWrapper\v4.0_4.0.0.0__b03f5f7f11d50a3a\ISymWrapper.dll' >>> >>> 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Anonymously Hosted >>> DynamicMethods Assembly' >>> >>> A first chance exception of type >>> 'Microsoft.Scripting.ArgumentTypeException' occurred in >>> Snippets.debug.scripting >>> >>> 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.scripting' >>> >>> A first chance exception of type 'System.MissingMemberException' occurred >>> in IronPython.dll >>> >>> A first chance exception of type >>> 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll >>> >>> A first chance exception of type >>> 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll >>> >>> A first chance exception of type >>> 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll >>> >>> A first chance exception of type >>> 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll >>> >>> A first chance exception of type >>> 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll >>> >>> A first chance exception of type >>> 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll >>> >>> A first chance exception of type >>> 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll >>> >>> A first chance exception of type >>> 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll >>> >>> A first chance exception of type >>> 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll >>> >>> A first chance exception of type >>> 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll >>> >>> A first chance exception of type >>> 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll >>> >>> A first chance exception of type >>> 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll >>> >>> A first chance exception of type >>> 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll >>> >>> A first chance exception of type 'System.MissingMemberException' occurred >>> in IronPython.dll >>> >>> A first chance exception of type 'System.MissingMemberException' occurred >>> in IronPython.dll >>> >>> A first chance exception of type 'System.MissingMemberException' occurred >>> in IronPython.dll >>> >>> A first chance exception of type 'System.MissingMemberException' occurred >>> in IronPython.dll >>> >>> A first chance exception of type 'System.MissingMemberException' occurred >>> in IronPython.dll >>> >>> A first chance exception of type 'System.MissingMemberException' occurred >>> in IronPython.dll >>> >>> A first chance exception of type 'System.ComponentModel.Win32Exception' >>> occurred in IronPython.Modules.dll >>> >>> A first chance exception of type 'System.ComponentModel.Win32Exception' >>> occurred in IronPython.Modules.dll >>> >>> A first chance exception of type >>> 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll >>> >>> A first chance exception of type 'System.ComponentModel.Win32Exception' >>> occurred in Microsoft.Dynamic.dll >>> >>> A first chance exception of type 'System.ComponentModel.Win32Exception' >>> occurred in IronPython.Modules.dll >>> >>> A first chance exception of type 'System.ComponentModel.Win32Exception' >>> occurred in IronPython.Modules.dll >>> >>> A first chance exception of type >>> 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll >>> >>> A first chance exception of type 'System.ComponentModel.Win32Exception' >>> occurred in Microsoft.Dynamic.dll >>> >>> A first chance exception of type >>> 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll >>> >>> A first chance exception of type >>> 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll >>> >>> The program '[3216] ipy.exe: Managed (v4.0.30319)' has exited with code 1 >>> (0x1). >>> >>> >>> >>> Regards, >>> >>> Yngipy >>> >>> _______________________________________________ >>> 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 marcel.vandendungen at gmail.com Tue Jun 15 03:20:38 2010 From: marcel.vandendungen at gmail.com (Marcel) Date: Mon, 14 Jun 2010 18:20:38 -0700 (PDT) Subject: [IronPython] Convert between python array and .NET Array In-Reply-To: References: <8a6c92fd-2586-4c9d-8beb-eebccf6411ad@40g2000pry.googlegroups.com> <01ba1ba5-ca1a-4893-b54d-ba791aad54fb@n20g2000prh.googlegroups.com> <0fed1f28-0aee-4107-bc80-f0d74673b32e@40g2000pry.googlegroups.com> Message-ID: Hi Curt, I did try that overload but I get this quite amusing error message: TypeError: Copy() takes at least 2147483647 arguments (4 given) Without the explicit overload selection, I get: TypeError: expected IntPtr, got int Did the example work for you with the overload you suggested? The reason I chose array('B') was twofold. The pixel generation is done in a pure Python library and I sometimes need to swap the byes (depending on the endianness of the system), which the Python array conveniently provides. Thanks, -- Marcel On Jun 14, 7:05?am, Curt Hagenlocher wrote: > Ah, I'm clearly not familiar with how the array type was implemented. The > first member of the buffer_info() tuple is an IntPtr, so you probably want > the [IntPtr, int, IntPtr, int] overload of Marshal.Copy. In fact, if you use > the buffer_info() approach, you may be able to avoid manually specifying the > overload. (Though there's something to be said for the types as a form of > documentation -- particularly given the opacity of the call to > buffer_info()). > > Personally, my rule of thumb is to use the Python standard library for > portable and "mostly Pythonic" code, but to use .NET types when doing > "mostly .NET". In this case, I think I would have created an Array[Byte] > instead of an array('B') as it's a bit more self-documenting. > > On Sun, Jun 13, 2010 at 3:51 PM, Marcel wrote: > > > Hi Curt, > > > Your suggestion gives me: > > TypeError: expected Array[Byte], got array > > > bytes is a Python array. I tried: > > Marshal.Copy.Overloads[Array[Byte], int, IntPtr, int] > > (bytes.buffer_info()[0], 0, bmData.Scan0, total_bytes) > > > but that gave the error: > > TypeError: expected Array[Byte], got int > > > This small sample application demonstrates the issue: > > > import array > > import struct > > import StringIO > > > import clr > > clr.AddReference("System.Windows.Forms") > > clr.AddReference("System.Drawing") > > > from System import Array, Byte, Char, IntPtr > > from System.Windows.Forms import Application, Form, PictureBox > > from System.Drawing import Size, Point, Bitmap, Color, Rectangle > > from System.Drawing.Imaging import PixelFormat, ImageLockMode > > from System.Runtime.InteropServices import Marshal > > > class IForm(Form): > > > ? ?def __init__(self): > > ? ? ? ?bytes = array.array('B') > > > ? ? ? ?width ?= 25 > > ? ? ? ?height = 20 > > > ? ? ? ?for i in range(width * height): > > ? ? ? ? ? ?bytes.append(i % 256) # R > > ? ? ? ? ? ?bytes.append(i % 256) # G > > ? ? ? ? ? ?bytes.append(i % 256) # B > > > ? ? ? ?bitmap = Bitmap(width, height, PixelFormat.Format24bppRgb) > > > ? ? ? ?bmData = bitmap.LockBits(Rectangle(0, 0, bitmap.Width, > > bitmap.Height), > > ? ? ? ? ?ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb) > > > ? ? ? ?total_bytes = (bmData.Stride) * bmData.Height > > > ? ? ? ?Marshal.Copy.Overloads[Array[Byte], int, IntPtr, int]( > > ? ? ? ? ?bytes.buffer_info()[0], 0, bmData.Scan0, total_bytes) > > ? ? ? ?bitmap.UnlockBits(bmData) > > > ## ? ? ? ?for x in range(width): > > ## ? ? ? ? ? ?for y in range(height): > > ## ? ? ? ? ? ? ? ?i = y * width + x > > ## ? ? ? ? ? ? ? ?bitmap.SetPixel(x, y, Color.FromArgb(bytes[i], > > bytes[i+1], bytes[i+2])) > > > ? ? ? ?pb = PictureBox() > > ? ? ? ?pb.Size = Size(bitmap.Width, bitmap.Height) > > ? ? ? ?pb.Location = Point(2, 2) > > ? ? ? ?pb.Image = bitmap > > ? ? ? ?pb.Parent = self > > > ? ? ? ?self.Size = Size(bitmap.Width + 20, bitmap.Height + 45) > > ? ? ? ?self.CenterToScreen() > > > Application.Run(IForm()) > > > Using bitmap.SetPixel works, but I cannot find how to make it work > > using the LockBits and Marshal.Copy. > > > Thanks, > > -- Marcel > > > On Jun 12, 10:27 pm, Curt Hagenlocher wrote: > > > It looks like the automatic overload resolution may be failing -- at > > least, > > > it's worth trying to resolve the overload manually. This would be > > something > > > like > > > > from System import Array, Byte, IntPtr > > > Marshal.Copy.Overloads[Array[Byte], int, IntPtr, int](bytes, 0, > > > bmData.Scan0, total_bytes) > > > > On Sat, Jun 12, 2010 at 10:07 PM, Marcel > >wrote: > > > > > I think I simplified my example a little too far. I'm trying to > > > > display a Bitmap from bytes generated in Python code. > > > > > ? ? ? ?bytes = array.array('c') # tried 'B' also > > > > ? ? ? ?# generate bitmap bytes ... > > > > > ? ? ? ?bitmap = Bitmap(width, height, PixelFormat.Format24bppRgb) > > > > > ? ? ? ?bmData = bitmap.LockBits(Rectangle(0, 0, bitmap.Width, > > > > bitmap.Height), > > > > ? ? ? ? ?ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb) > > > > > ? ? ? ?total_bytes = (bmData.Stride) * bmData.Height > > > > > ? ? ? ?Marshal.Copy(bytes, 0, bmData.Scan0, total_bytes); > > > > > ? ? ? ?bitmap.UnlockBits(bmData) > > > > > The IronPython exception I'm getting is: > > > > TypeError: expected IntPtr, got array > > > > > Casting the bytes array to IntPtr changed the error into: > > > > TypeError: expected int, got array > > > > > I'm using IronPython 2.6 (2.6.10920.0) on .NET 2.0.50727.4927 > > > > > Any idea? > > > > > Thanks, > > > > -- Marcel > > > > > On Jun 11, 11:27 pm, David Escobar wrote: > > > > > This worked for me (based on the code you provided): > > > > > > import clr > > > > > from System import Array > > > > > > dest = Array[str](bytes) > > > > > > On Fri, Jun 11, 2010 at 9:51 PM, Marcel < > > marcel.vandendun... at gmail.com > > > > >wrote: > > > > > > > I have a python method that returns a Python byte array.array('c'). > > > > > > > Now, I want to copy this array using > > > > > > System.Runtime.InteropServices.Marshal.Copy. This method however > > > > > > expects a .NET Array. > > > > > > > import array > > > > > > from System.Runtime.InteropServices import Marshal > > > > > > > bytes = array.array('c') > > > > > > bytes.append('a') > > > > > > bytes.append('b') > > > > > > bytes.append('c') > > > > > > Marshal.Copy(bytes, dest, 0, 3) > > > > > > > Is there a way to make this work without copying the data? If not, > > how > > > > > > do I convert the data in the Python array to the .NET array? > > > > > > > Thanks, > > > > > > -- Marcel > > > > > > _______________________________________________ > > > > > > Users mailing list > > > > > > Us... at lists.ironpython.com > > > > > >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > _______________________________________________ > > > > > Users mailing list > > > > > Us... at lists.ironpython.comhttp:// > > > > lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > > > > Users mailing list > > > > Us... at lists.ironpython.com > > > >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > > > Users mailing list > > > Us... at lists.ironpython.comhttp:// > > lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > > Users mailing list > > Us... at lists.ironpython.com > >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > Users mailing list > Us... at lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at microsoft.com Tue Jun 15 20:34:03 2010 From: dinov at microsoft.com (Dino Viehland) Date: Tue, 15 Jun 2010 18:34:03 +0000 Subject: [IronPython] Debugging IronPython script using "IronPython tools for Visual Studio(CP2) In-Reply-To: References: <1A472770E042064698CB5ADC83A12ACD489EED38@TK5EX14MBXC111.redmond.corp.microsoft.com> Message-ID: <1A472770E042064698CB5ADC83A12ACD489F8333@TK5EX14MBXC111.redmond.corp.microsoft.com> Ok it looks like the last exception is a normal exception from startup. So the interesting question I guess is what happens between startup and when your script starts? Can you set a break point on the 1st line of your script and see what happens (you can just hit F9 while on the 1st line of code)? Does your script successfully run from the command line? From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of yngipy hernan Sent: Monday, June 14, 2010 5:50 PM To: Discussion of IronPython Subject: Re: [IronPython] Debugging IronPython script using "IronPython tools for Visual Studio(CP2) Ok, I am sure if what I did was correct. I did Debug | Exceptions..., since I don't know why exceptions, I just checked all. Then this is what I got: 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\ipy.exe' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\Microsoft.Dynamic.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\Microsoft.Scripting.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\IronPython.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\IronPython.Modules.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.debug.scripting' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\ISymWrapper\v4.0_4.0.0.0__b03f5f7f11d50a3a\ISymWrapper.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Anonymously Hosted DynamicMethods Assembly' A first chance exception of type 'Microsoft.Scripting.ArgumentTypeException' occurred in Snippets.debug.scripting Additional information: Python Exception: TypeError 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.scripting' A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll Additional information: 'module' object has no attribute '__all__' A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll Additional information: name 'fork' is not defined A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll Additional information: name 'fork' is not defined The thread '' (0x930) has exited with code 0 (0x0). A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll Additional information: Exception has been thrown by the target of an invocation. A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll Additional information: name 'fork' is not defined A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll Additional information: name 'spawnvp' is not defined A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll Additional information: name 'spawnvp' is not defined A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll Additional information: Exception has been thrown by the target of an invocation. A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll Additional information: name 'spawnvp' is not defined A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll Additional information: name 'fork' is not defined A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll Additional information: name 'fork' is not defined A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll Additional information: Exception has been thrown by the target of an invocation. A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll Additional information: name 'fork' is not defined A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll Additional information: global name 'statvfs_result' is not defined A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll Additional information: 'module' object has no attribute '__file__' A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll Additional information: 'module' object has no attribute '__file__' A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll Additional information: 'module' object has no attribute '__file__' A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll Additional information: 'module' object has no attribute '__file__' A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll Additional information: 'module' object has no attribute '__file__' A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll Additional information: 'module' object has no attribute '__file__' A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll Additional information: Python Exception: WindowsError A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll Additional information: Python Exception: WindowsError A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll Additional information: Exception has been thrown by the target of an invocation. A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in Microsoft.Dynamic.dll Additional information: Python Exception: WindowsError A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll Additional information: Python Exception: WindowsError A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll Additional information: Python Exception: WindowsError A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll Additional information: Exception has been thrown by the target of an invocation. A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in Microsoft.Dynamic.dll Additional information: Python Exception: WindowsError A first chance exception of type 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll Additional information: No module named sitecustomize A first chance exception of type 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll Additional information: No module named usercustomize The program '[3708] ipy.exe: Managed (v4.0.30319)' has exited with code 1 (0x1). On Tue, Jun 15, 2010 at 8:12 AM, yngipy hernan > wrote: Ok, I need help. Can't find in internet how to "enable breaking on import exception". Anyone knows how to do this? Regards, Yngipy On Mon, Jun 14, 2010 at 11:53 AM, yngipy hernan > wrote: RE: Can you enable breaking on the import exception (or all exceptions and continue after these) and see what the last exception is? Sorry, I am not familiar how to do this. I search for some tutorial, but if you have some wiki out there I can use, I can probably give it a try. Regards, Yngipy On Mon, Jun 14, 2010 at 3:33 AM, Dino Viehland > wrote: I'm assuming the problem here is that this is exiting w/ a non-zero exit code indicating something went wrong. But what went wrong really depends on what the last exception is - there appears to be some failure to import something. The other exceptions are expected as the standard library throws exceptions on startup. Can you enable breaking on the import exception (or all exceptions and continue after these) and see what the last exception is? From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of yngipy hernan Sent: Saturday, June 12, 2010 11:41 PM To: users at lists.ironpython.com Subject: [IronPython] Debugging IronPython script using "IronPython tools for Visual Studio(CP2) Hi all, I am trying to debug my scripts using VS2010 Pro, for non-class based code it is working as expected. But got hiccups inside a class, this is what I am getting: 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\ipy.exe' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\Microsoft.Dynamic.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\Microsoft.Scripting.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\IronPython.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\IronPython.Modules.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.debug.scripting' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\ISymWrapper\v4.0_4.0.0.0__b03f5f7f11d50a3a\ISymWrapper.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Anonymously Hosted DynamicMethods Assembly' A first chance exception of type 'Microsoft.Scripting.ArgumentTypeException' occurred in Snippets.debug.scripting 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.scripting' A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in Microsoft.Dynamic.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in Microsoft.Dynamic.dll A first chance exception of type 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll A first chance exception of type 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll The program '[3216] ipy.exe: Managed (v4.0.30319)' has exited with code 1 (0x1). Regards, Yngipy _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at microsoft.com Tue Jun 15 20:42:34 2010 From: dinov at microsoft.com (Dino Viehland) Date: Tue, 15 Jun 2010 18:42:34 +0000 Subject: [IronPython] Convert between python array and .NET Array In-Reply-To: References: <8a6c92fd-2586-4c9d-8beb-eebccf6411ad@40g2000pry.googlegroups.com> <01ba1ba5-ca1a-4893-b54d-ba791aad54fb@n20g2000prh.googlegroups.com> <0fed1f28-0aee-4107-bc80-f0d74673b32e@40g2000pry.googlegroups.com> Message-ID: <1A472770E042064698CB5ADC83A12ACD489F8520@TK5EX14MBXC111.redmond.corp.microsoft.com> Can I make a different recommendation? Rather than doing a Marshal.Copy you could use ctypes.memmove. That would look like: import ctypes ctypes.memmove(bmData.Scan0, bytes.buffer_info()[0], total_bytes) If Scan0 is actually an IntPtr youa may need to do a .ToInt32() or .ToInt64() on it (I don't remember if we support IntPtr's when marshalling to ctypes - we probably should). Even better still would be to use a ctypes array: bytes_type = (ctypes.c_int8* total_bytes) bytes = bytes_type() ctypes.memmove(0, bytes, total_bytes) > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Marcel > Sent: Monday, June 14, 2010 6:21 PM > To: users at lists.ironpython.com > Subject: Re: [IronPython] Convert between python array and .NET Array > > Hi Curt, > > I did try that overload but I get this quite amusing error message: > TypeError: Copy() takes at least 2147483647 arguments (4 given) > > Without the explicit overload selection, I get: > TypeError: expected IntPtr, got int > > Did the example work for you with the overload you suggested? > > The reason I chose array('B') was twofold. The pixel generation is > done in a pure Python library and I sometimes need to swap the byes > (depending on the endianness of the system), which the Python array > conveniently provides. > > Thanks, > -- Marcel > > On Jun 14, 7:05?am, Curt Hagenlocher wrote: > > Ah, I'm clearly not familiar with how the array type was implemented. The > > first member of the buffer_info() tuple is an IntPtr, so you probably want > > the [IntPtr, int, IntPtr, int] overload of Marshal.Copy. In fact, if you use > > the buffer_info() approach, you may be able to avoid manually specifying the > > overload. (Though there's something to be said for the types as a form of > > documentation -- particularly given the opacity of the call to > > buffer_info()). > > > > Personally, my rule of thumb is to use the Python standard library for > > portable and "mostly Pythonic" code, but to use .NET types when doing > > "mostly .NET". In this case, I think I would have created an Array[Byte] > > instead of an array('B') as it's a bit more self-documenting. > > > > On Sun, Jun 13, 2010 at 3:51 PM, Marcel > wrote: > > > > > Hi Curt, > > > > > Your suggestion gives me: > > > TypeError: expected Array[Byte], got array > > > > > bytes is a Python array. I tried: > > > Marshal.Copy.Overloads[Array[Byte], int, IntPtr, int] > > > (bytes.buffer_info()[0], 0, bmData.Scan0, total_bytes) > > > > > but that gave the error: > > > TypeError: expected Array[Byte], got int > > > > > This small sample application demonstrates the issue: > > > > > import array > > > import struct > > > import StringIO > > > > > import clr > > > clr.AddReference("System.Windows.Forms") > > > clr.AddReference("System.Drawing") > > > > > from System import Array, Byte, Char, IntPtr > > > from System.Windows.Forms import Application, Form, PictureBox > > > from System.Drawing import Size, Point, Bitmap, Color, Rectangle > > > from System.Drawing.Imaging import PixelFormat, ImageLockMode > > > from System.Runtime.InteropServices import Marshal > > > > > class IForm(Form): > > > > > ? ?def __init__(self): > > > ? ? ? ?bytes = array.array('B') > > > > > ? ? ? ?width ?= 25 > > > ? ? ? ?height = 20 > > > > > ? ? ? ?for i in range(width * height): > > > ? ? ? ? ? ?bytes.append(i % 256) # R > > > ? ? ? ? ? ?bytes.append(i % 256) # G > > > ? ? ? ? ? ?bytes.append(i % 256) # B > > > > > ? ? ? ?bitmap = Bitmap(width, height, PixelFormat.Format24bppRgb) > > > > > ? ? ? ?bmData = bitmap.LockBits(Rectangle(0, 0, bitmap.Width, > > > bitmap.Height), > > > ? ? ? ? ?ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb) > > > > > ? ? ? ?total_bytes = (bmData.Stride) * bmData.Height > > > > > ? ? ? ?Marshal.Copy.Overloads[Array[Byte], int, IntPtr, int]( > > > ? ? ? ? ?bytes.buffer_info()[0], 0, bmData.Scan0, total_bytes) > > > ? ? ? ?bitmap.UnlockBits(bmData) > > > > > ## ? ? ? ?for x in range(width): > > > ## ? ? ? ? ? ?for y in range(height): > > > ## ? ? ? ? ? ? ? ?i = y * width + x > > > ## ? ? ? ? ? ? ? ?bitmap.SetPixel(x, y, Color.FromArgb(bytes[i], > > > bytes[i+1], bytes[i+2])) > > > > > ? ? ? ?pb = PictureBox() > > > ? ? ? ?pb.Size = Size(bitmap.Width, bitmap.Height) > > > ? ? ? ?pb.Location = Point(2, 2) > > > ? ? ? ?pb.Image = bitmap > > > ? ? ? ?pb.Parent = self > > > > > ? ? ? ?self.Size = Size(bitmap.Width + 20, bitmap.Height + 45) > > > ? ? ? ?self.CenterToScreen() > > > > > Application.Run(IForm()) > > > > > Using bitmap.SetPixel works, but I cannot find how to make it work > > > using the LockBits and Marshal.Copy. > > > > > Thanks, > > > -- Marcel > > > > > On Jun 12, 10:27 pm, Curt Hagenlocher wrote: > > > > It looks like the automatic overload resolution may be failing -- at > > > least, > > > > it's worth trying to resolve the overload manually. This would be > > > something > > > > like > > > > > > from System import Array, Byte, IntPtr > > > > Marshal.Copy.Overloads[Array[Byte], int, IntPtr, int](bytes, 0, > > > > bmData.Scan0, total_bytes) > > > > > > On Sat, Jun 12, 2010 at 10:07 PM, Marcel > > >wrote: > > > > > > > I think I simplified my example a little too far. I'm trying to > > > > > display a Bitmap from bytes generated in Python code. > > > > > > > ? ? ? ?bytes = array.array('c') # tried 'B' also > > > > > ? ? ? ?# generate bitmap bytes ... > > > > > > > ? ? ? ?bitmap = Bitmap(width, height, PixelFormat.Format24bppRgb) > > > > > > > ? ? ? ?bmData = bitmap.LockBits(Rectangle(0, 0, bitmap.Width, > > > > > bitmap.Height), > > > > > ? ? ? ? ?ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb) > > > > > > > ? ? ? ?total_bytes = (bmData.Stride) * bmData.Height > > > > > > > ? ? ? ?Marshal.Copy(bytes, 0, bmData.Scan0, total_bytes); > > > > > > > ? ? ? ?bitmap.UnlockBits(bmData) > > > > > > > The IronPython exception I'm getting is: > > > > > TypeError: expected IntPtr, got array > > > > > > > Casting the bytes array to IntPtr changed the error into: > > > > > TypeError: expected int, got array > > > > > > > I'm using IronPython 2.6 (2.6.10920.0) on .NET 2.0.50727.4927 > > > > > > > Any idea? > > > > > > > Thanks, > > > > > -- Marcel > > > > > > > On Jun 11, 11:27 pm, David Escobar wrote: > > > > > > This worked for me (based on the code you provided): > > > > > > > > import clr > > > > > > from System import Array > > > > > > > > dest = Array[str](bytes) > > > > > > > > On Fri, Jun 11, 2010 at 9:51 PM, Marcel < > > > marcel.vandendun... at gmail.com > > > > > >wrote: > > > > > > > > > I have a python method that returns a Python byte > array.array('c'). > > > > > > > > > Now, I want to copy this array using > > > > > > > System.Runtime.InteropServices.Marshal.Copy. This method however > > > > > > > expects a .NET Array. > > > > > > > > > import array > > > > > > > from System.Runtime.InteropServices import Marshal > > > > > > > > > bytes = array.array('c') > > > > > > > bytes.append('a') > > > > > > > bytes.append('b') > > > > > > > bytes.append('c') > > > > > > > Marshal.Copy(bytes, dest, 0, 3) > > > > > > > > > Is there a way to make this work without copying the data? If not, > > > how > > > > > > > do I convert the data in the Python array to the .NET array? > > > > > > > > > Thanks, > > > > > > > -- Marcel > > > > > > > _______________________________________________ > > > > > > > Users mailing list > > > > > > > Us... at lists.ironpython.com > > > > > > >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > > > _______________________________________________ > > > > > > Users mailing list > > > > > > Us... at lists.ironpython.comhttp:// > > > > > lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > _______________________________________________ > > > > > Users mailing list > > > > > Us... at lists.ironpython.com > > > > >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > _______________________________________________ > > > > Users mailing list > > > > Us... at lists.ironpython.comhttp:// > > > lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > _______________________________________________ > > > Users mailing list > > > Us... at lists.ironpython.com > > >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > > > _______________________________________________ > > Users mailing list > > Us... at lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users- > ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From marcel.vandendungen at gmail.com Wed Jun 16 02:43:12 2010 From: marcel.vandendungen at gmail.com (Marcel) Date: Tue, 15 Jun 2010 17:43:12 -0700 (PDT) Subject: [IronPython] Convert between python array and .NET Array In-Reply-To: <1A472770E042064698CB5ADC83A12ACD489F8520@TK5EX14MBXC111.redmond.corp.microsoft.com> References: <8a6c92fd-2586-4c9d-8beb-eebccf6411ad@40g2000pry.googlegroups.com> <01ba1ba5-ca1a-4893-b54d-ba791aad54fb@n20g2000prh.googlegroups.com> <0fed1f28-0aee-4107-bc80-f0d74673b32e@40g2000pry.googlegroups.com> <1A472770E042064698CB5ADC83A12ACD489F8520@TK5EX14MBXC111.redmond.corp.microsoft.com> Message-ID: <13b4a7dc-ea25-420a-97df-cf9df9f4029c@g39g2000pri.googlegroups.com> Thanks Dino, the ctypes.memmove does work! I wasn't aware that ctypes could be used in IronPython. Do they marshal to unmanaged code under the hood? Let me know if you want me to file a bug against the Marshal.Copy overload behavior. Thanks, -- Marcel On Jun 15, 11:42?am, Dino Viehland wrote: > Can I make a different recommendation? ?Rather than doing a Marshal.Copy > you could use ctypes.memmove. ?That would look like: > > import ctypes > ctypes.memmove(bmData.Scan0, bytes.buffer_info()[0], total_bytes) > > If Scan0 is actually an IntPtr youa may need to do a .ToInt32() or .ToInt64() > on it (I don't remember if we support IntPtr's when marshalling to ctypes - > we probably should). > > Even better still would be to use a ctypes array: > > bytes_type = (ctypes.c_int8* total_bytes) > bytes = bytes_type() > ctypes.memmove(0, bytes, total_bytes) > > > > > -----Original Message----- > > From: users-boun... at lists.ironpython.com [mailto:users- > > boun... at lists.ironpython.com] On Behalf Of Marcel > > Sent: Monday, June 14, 2010 6:21 PM > > To: us... at lists.ironpython.com > > Subject: Re: [IronPython] Convert between python array and .NET Array > > > Hi Curt, > > > I did try that overload but I get this quite amusing error message: > > TypeError: Copy() takes at least 2147483647 arguments (4 given) > > > Without the explicit overload selection, I get: > > TypeError: expected IntPtr, got int > > > Did the example work for you with the overload you suggested? > > > The reason I chose array('B') was twofold. The pixel generation is > > done in a pure Python library and I sometimes need to swap the byes > > (depending on the endianness of the system), which the Python array > > conveniently provides. > > > Thanks, > > -- Marcel > > > On Jun 14, 7:05?am, Curt Hagenlocher wrote: > > > Ah, I'm clearly not familiar with how the array type was implemented. The > > > first member of the buffer_info() tuple is an IntPtr, so you probably want > > > the [IntPtr, int, IntPtr, int] overload of Marshal.Copy. In fact, if you use > > > the buffer_info() approach, you may be able to avoid manually specifying the > > > overload. (Though there's something to be said for the types as a form of > > > documentation -- particularly given the opacity of the call to > > > buffer_info()). > > > > Personally, my rule of thumb is to use the Python standard library for > > > portable and "mostly Pythonic" code, but to use .NET types when doing > > > "mostly .NET". In this case, I think I would have created an Array[Byte] > > > instead of an array('B') as it's a bit more self-documenting. > > > > On Sun, Jun 13, 2010 at 3:51 PM, Marcel > > wrote: > > > > > Hi Curt, > > > > > Your suggestion gives me: > > > > TypeError: expected Array[Byte], got array > > > > > bytes is a Python array. I tried: > > > > Marshal.Copy.Overloads[Array[Byte], int, IntPtr, int] > > > > (bytes.buffer_info()[0], 0, bmData.Scan0, total_bytes) > > > > > but that gave the error: > > > > TypeError: expected Array[Byte], got int > > > > > This small sample application demonstrates the issue: > > > > > import array > > > > import struct > > > > import StringIO > > > > > import clr > > > > clr.AddReference("System.Windows.Forms") > > > > clr.AddReference("System.Drawing") > > > > > from System import Array, Byte, Char, IntPtr > > > > from System.Windows.Forms import Application, Form, PictureBox > > > > from System.Drawing import Size, Point, Bitmap, Color, Rectangle > > > > from System.Drawing.Imaging import PixelFormat, ImageLockMode > > > > from System.Runtime.InteropServices import Marshal > > > > > class IForm(Form): > > > > > ? ?def __init__(self): > > > > ? ? ? ?bytes = array.array('B') > > > > > ? ? ? ?width ?= 25 > > > > ? ? ? ?height = 20 > > > > > ? ? ? ?for i in range(width * height): > > > > ? ? ? ? ? ?bytes.append(i % 256) # R > > > > ? ? ? ? ? ?bytes.append(i % 256) # G > > > > ? ? ? ? ? ?bytes.append(i % 256) # B > > > > > ? ? ? ?bitmap = Bitmap(width, height, PixelFormat.Format24bppRgb) > > > > > ? ? ? ?bmData = bitmap.LockBits(Rectangle(0, 0, bitmap.Width, > > > > bitmap.Height), > > > > ? ? ? ? ?ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb) > > > > > ? ? ? ?total_bytes = (bmData.Stride) * bmData.Height > > > > > ? ? ? ?Marshal.Copy.Overloads[Array[Byte], int, IntPtr, int]( > > > > ? ? ? ? ?bytes.buffer_info()[0], 0, bmData.Scan0, total_bytes) > > > > ? ? ? ?bitmap.UnlockBits(bmData) > > > > > ## ? ? ? ?for x in range(width): > > > > ## ? ? ? ? ? ?for y in range(height): > > > > ## ? ? ? ? ? ? ? ?i = y * width + x > > > > ## ? ? ? ? ? ? ? ?bitmap.SetPixel(x, y, Color.FromArgb(bytes[i], > > > > bytes[i+1], bytes[i+2])) > > > > > ? ? ? ?pb = PictureBox() > > > > ? ? ? ?pb.Size = Size(bitmap.Width, bitmap.Height) > > > > ? ? ? ?pb.Location = Point(2, 2) > > > > ? ? ? ?pb.Image = bitmap > > > > ? ? ? ?pb.Parent = self > > > > > ? ? ? ?self.Size = Size(bitmap.Width + 20, bitmap.Height + 45) > > > > ? ? ? ?self.CenterToScreen() > > > > > Application.Run(IForm()) > > > > > Using bitmap.SetPixel works, but I cannot find how to make it work > > > > using the LockBits and Marshal.Copy. > > > > > Thanks, > > > > -- Marcel > > > > > On Jun 12, 10:27 pm, Curt Hagenlocher wrote: > > > > > It looks like the automatic overload resolution may be failing -- at > > > > least, > > > > > it's worth trying to resolve the overload manually. This would be > > > > something > > > > > like > > > > > > from System import Array, Byte, IntPtr > > > > > Marshal.Copy.Overloads[Array[Byte], int, IntPtr, int](bytes, 0, > > > > > bmData.Scan0, total_bytes) > > > > > > On Sat, Jun 12, 2010 at 10:07 PM, Marcel > > > >wrote: > > > > > > > I think I simplified my example a little too far. I'm trying to > > > > > > display a Bitmap from bytes generated in Python code. > > > > > > > ? ? ? ?bytes = array.array('c') # tried 'B' also > > > > > > ? ? ? ?# generate bitmap bytes ... > > > > > > > ? ? ? ?bitmap = Bitmap(width, height, PixelFormat.Format24bppRgb) > > > > > > > ? ? ? ?bmData = bitmap.LockBits(Rectangle(0, 0, bitmap.Width, > > > > > > bitmap.Height), > > > > > > ? ? ? ? ?ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb) > > > > > > > ? ? ? ?total_bytes = (bmData.Stride) * bmData.Height > > > > > > > ? ? ? ?Marshal.Copy(bytes, 0, bmData.Scan0, total_bytes); > > > > > > > ? ? ? ?bitmap.UnlockBits(bmData) > > > > > > > The IronPython exception I'm getting is: > > > > > > TypeError: expected IntPtr, got array > > > > > > > Casting the bytes array to IntPtr changed the error into: > > > > > > TypeError: expected int, got array > > > > > > > I'm using IronPython 2.6 (2.6.10920.0) on .NET 2.0.50727.4927 > > > > > > > Any idea? > > > > > > > Thanks, > > > > > > -- Marcel > > > > > > > On Jun 11, 11:27 pm, David Escobar wrote: > > > > > > > This worked for me (based on the code you provided): > > > > > > > > import clr > > > > > > > from System import Array > > > > > > > > dest = Array[str](bytes) > > > > > > > > On Fri, Jun 11, 2010 at 9:51 PM, Marcel < > > > > marcel.vandendun... at gmail.com > > > > > > >wrote: > > > > > > > > > I have a python method that returns a Python byte > > array.array('c'). > > > > > > > > > Now, I want to copy this array using > > > > > > > > System.Runtime.InteropServices.Marshal.Copy. This method however > > > > > > > > expects a .NET Array. > > > > > > > > > import array > > > > > > > > from System.Runtime.InteropServices import Marshal > > > > > > > > > bytes = array.array('c') > > > > > > > > bytes.append('a') > > > > > > > > bytes.append('b') > > > > > > > > bytes.append('c') > > > > > > > > Marshal.Copy(bytes, dest, 0, 3) > > > > > > > > > Is there a way to make this work without copying the data? If not, > > > > how > > > > > > > > do I convert the data in the Python array to the .NET array? > > > > > > > > > Thanks, > > > > > > > > -- Marcel > > > > > > > > _______________________________________________ > > > > > > > > Users mailing list > > > > > > > > Us... at lists.ironpython.com > > > > > > > >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > > > _______________________________________________ > > > > > > > Users mailing list > > > > > > > Us... at lists.ironpython.comhttp:// > > > > > > lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > _______________________________________________ > > > > > > Users mailing list > > > > > > Us... at lists.ironpython.com > > > > > >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > _______________________________________________ > > > > > Users mailing list > > > > > Us... at lists.ironpython.comhttp:// > > > > lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > > > > Users mailing list > > > > Us... at lists.ironpython.com > > > >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > > > Users mailing list > > > Us... at lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users- > > ironpython.com > > _______________________________________________ > > Users mailing list > > Us... at lists.ironpython.com > >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > Users mailing list > Us... at lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at microsoft.com Wed Jun 16 06:21:19 2010 From: dinov at microsoft.com (Dino Viehland) Date: Wed, 16 Jun 2010 04:21:19 +0000 Subject: [IronPython] Convert between python array and .NET Array In-Reply-To: <13b4a7dc-ea25-420a-97df-cf9df9f4029c@g39g2000pri.googlegroups.com> References: <8a6c92fd-2586-4c9d-8beb-eebccf6411ad@40g2000pry.googlegroups.com> <01ba1ba5-ca1a-4893-b54d-ba791aad54fb@n20g2000prh.googlegroups.com> <0fed1f28-0aee-4107-bc80-f0d74673b32e@40g2000pry.googlegroups.com> <1A472770E042064698CB5ADC83A12ACD489F8520@TK5EX14MBXC111.redmond.corp.microsoft.com> <13b4a7dc-ea25-420a-97df-cf9df9f4029c@g39g2000pri.googlegroups.com> Message-ID: <1A472770E042064698CB5ADC83A12ACD489FB74B@TK5EX14MBXC111.redmond.corp.microsoft.com> Marcel wrote: > Thanks Dino, the ctypes.memmove does work! > > I wasn't aware that ctypes could be used in IronPython. Do they > marshal to unmanaged code under the hood? There's not really any unmanaged code on *our* side involved at all. It all turns into .NET's support for interop. So we'll generate calli calls w/ the correct signature. And then all the memory access we do is through the Marshal APIs. I actually didn't even need to flip the /unsafe compiler flag in order to implement it all :) > > Let me know if you want me to file a bug against the Marshal.Copy > overload behavior. I actually don't think this is a bug. The problem here is that you either have a pointer (as an int but it could trivially be turned into an IntPtr) or an IronPython array object and then an IntPtr. For the 2 IntPtr cases there's no overloads on Marshal and I don't believe anywhere in .NET. For ctypes to implement memmove we had to P/Invoke. And for the array case you don't have a .NET array. If we exposed the underlying .NET array then you could use Marshal.Copy. But I'm reluctant to do that because we might want to switch to allocating unmanaged memory for the array in the future. That'll work better w/ ctypes and calls to buffer_info() - currently need to pin the array for an unknown amount of time. That's another reason to allocate the memory via ctypes. From curt at hagenlocher.org Wed Jun 16 06:26:07 2010 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Tue, 15 Jun 2010 21:26:07 -0700 Subject: [IronPython] Convert between python array and .NET Array In-Reply-To: <1A472770E042064698CB5ADC83A12ACD489FB74B@TK5EX14MBXC111.redmond.corp.microsoft.com> References: <8a6c92fd-2586-4c9d-8beb-eebccf6411ad@40g2000pry.googlegroups.com> <01ba1ba5-ca1a-4893-b54d-ba791aad54fb@n20g2000prh.googlegroups.com> <0fed1f28-0aee-4107-bc80-f0d74673b32e@40g2000pry.googlegroups.com> <1A472770E042064698CB5ADC83A12ACD489F8520@TK5EX14MBXC111.redmond.corp.microsoft.com> <13b4a7dc-ea25-420a-97df-cf9df9f4029c@g39g2000pri.googlegroups.com> <1A472770E042064698CB5ADC83A12ACD489FB74B@TK5EX14MBXC111.redmond.corp.microsoft.com> Message-ID: On Tue, Jun 15, 2010 at 9:21 PM, Dino Viehland wrote: > > For the 2 IntPtr cases there's no overloads on Marshal and I don't believe > anywhere in .NET. Yes, this is my mistake. I think I saw the [IntPtr[], int, IntPtr, int] overload and mentally elided the first array specifier. -Curt From yngipy at gmail.com Wed Jun 16 06:48:15 2010 From: yngipy at gmail.com (yngipy hernan) Date: Tue, 15 Jun 2010 23:48:15 -0500 Subject: [IronPython] Debugging IronPython script using "IronPython tools for Visual Studio(CP2) In-Reply-To: <1A472770E042064698CB5ADC83A12ACD489F8333@TK5EX14MBXC111.redmond.corp.microsoft.com> References: <1A472770E042064698CB5ADC83A12ACD489EED38@TK5EX14MBXC111.redmond.corp.microsoft.com> <1A472770E042064698CB5ADC83A12ACD489F8333@TK5EX14MBXC111.redmond.corp.microsoft.com> Message-ID: Hi Dino, Thanks for being patient. I think you are right. It is actually working, I am just not used to seeing "expected" exceptions. By the way, where can I find ipy.pdb (I am assuming that it is the file that "Cannot find or open the PDB file" points to as shown in debug session)? Regards, Yngipy On Tue, Jun 15, 2010 at 1:34 PM, Dino Viehland wrote: > Ok it looks like the last exception is a normal exception from startup. > So the interesting question I guess is what happens between startup and when > your script starts? Can you set a break point on the 1st line of your > script and see what happens (you can just hit F9 while on the 1st line of > code)? Does your script successfully run from the command line? > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *yngipy hernan > *Sent:* Monday, June 14, 2010 5:50 PM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] Debugging IronPython script using "IronPython > tools for Visual Studio(CP2) > > > > Ok, I am sure if what I did was correct. > > > > > > I did Debug | Exceptions..., since I don't know why exceptions, I just > checked all. Then this is what I got: > > > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\ipy.exe' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\Microsoft.Dynamic.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\Microsoft.Scripting.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\IronPython.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\IronPython.Modules.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.debug.scripting' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_32\ISymWrapper\v4.0_4.0.0.0__b03f5f7f11d50a3a\ISymWrapper.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Anonymously Hosted DynamicMethods > Assembly' > > A first chance exception of type > 'Microsoft.Scripting.ArgumentTypeException' occurred in > Snippets.debug.scripting > > > > Additional information: Python Exception: TypeError > > > > 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.scripting' > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > > > Additional information: 'module' object has no attribute '__all__' > > > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in IronPython.dll > > > > Additional information: name 'fork' is not defined > > > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > > > Additional information: name 'fork' is not defined > > > > The thread '' (0x930) has exited with code 0 (0x0). > > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > > > > Additional information: Exception has been thrown by the target of an > invocation. > > > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > > > Additional information: name 'fork' is not defined > > > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in IronPython.dll > > > > Additional information: name 'spawnvp' is not defined > > > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > > > Additional information: name 'spawnvp' is not defined > > > > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > > > > Additional information: Exception has been thrown by the target of an > invocation. > > > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > > > Additional information: name 'spawnvp' is not defined > > > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in IronPython.dll > > > > Additional information: name 'fork' is not defined > > > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > > > Additional information: name 'fork' is not defined > > > > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > > > > Additional information: Exception has been thrown by the target of an > invocation. > > > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > > > Additional information: name 'fork' is not defined > > > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in IronPython.dll > > > > Additional information: global name 'statvfs_result' is not defined > > > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > > > Additional information: 'module' object has no attribute '__file__' > > > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > > > Additional information: 'module' object has no attribute '__file__' > > > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > > > Additional information: 'module' object has no attribute '__file__' > > > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > > > Additional information: 'module' object has no attribute '__file__' > > > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > > > Additional information: 'module' object has no attribute '__file__' > > > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > > > Additional information: 'module' object has no attribute '__file__' > > > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in IronPython.Modules.dll > > > > Additional information: Python Exception: WindowsError > > > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in IronPython.Modules.dll > > > > Additional information: Python Exception: WindowsError > > > > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > > > > Additional information: Exception has been thrown by the target of an > invocation. > > > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in Microsoft.Dynamic.dll > > > > Additional information: Python Exception: WindowsError > > > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in IronPython.Modules.dll > > > > Additional information: Python Exception: WindowsError > > > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in IronPython.Modules.dll > > > > Additional information: Python Exception: WindowsError > > > > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > > > > Additional information: Exception has been thrown by the target of an > invocation. > > > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in Microsoft.Dynamic.dll > > > > Additional information: Python Exception: WindowsError > > > > A first chance exception of type > 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll > > > > Additional information: No module named sitecustomize > > > > A first chance exception of type > 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll > > > > Additional information: No module named usercustomize > > > > The program '[3708] ipy.exe: Managed (v4.0.30319)' has exited with code 1 > (0x1). > > > > > > On Tue, Jun 15, 2010 at 8:12 AM, yngipy hernan wrote: > > Ok, I need help. Can't find in internet how to "enable breaking on import > exception". Anyone knows how to do this? > > > > Regards, > > Yngipy > > > > On Mon, Jun 14, 2010 at 11:53 AM, yngipy hernan wrote: > > *RE: Can you enable breaking on the import exception (or all exceptions > and continue after these) and see what the last exception is?* > > Sorry, I am not familiar how to do this. I search for some tutorial, but if > you have some wiki out there I can use, I can probably give it a try. > > > > Regards, > > Yngipy > > > > On Mon, Jun 14, 2010 at 3:33 AM, Dino Viehland > wrote: > > I?m assuming the problem here is that this is exiting w/ a non-zero exit > code indicating something went wrong. But what went wrong really depends on > what the last exception is ? there appears to be some failure to import > something. The other exceptions are expected as the standard library throws > exceptions on startup. Can you enable breaking on the import exception (or > all exceptions and continue after these) and see what the last exception is? > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *yngipy hernan > *Sent:* Saturday, June 12, 2010 11:41 PM > *To:* users at lists.ironpython.com > *Subject:* [IronPython] Debugging IronPython script using "IronPython > tools for Visual Studio(CP2) > > > > Hi all, > > > > I am trying to debug my scripts using VS2010 Pro, for non-class based code > it is working as expected. But got hiccups inside a class, this is what I am > getting: > > > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\ipy.exe' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\Microsoft.Dynamic.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\Microsoft.Scripting.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\IronPython.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\IronPython.Modules.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.debug.scripting' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_32\ISymWrapper\v4.0_4.0.0.0__b03f5f7f11d50a3a\ISymWrapper.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Anonymously Hosted DynamicMethods > Assembly' > > A first chance exception of type > 'Microsoft.Scripting.ArgumentTypeException' occurred in > Snippets.debug.scripting > > 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.scripting' > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in IronPython.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in IronPython.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in IronPython.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in IronPython.dll > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in IronPython.Modules.dll > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in IronPython.Modules.dll > > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in Microsoft.Dynamic.dll > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in IronPython.Modules.dll > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in IronPython.Modules.dll > > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in Microsoft.Dynamic.dll > > A first chance exception of type > 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll > > A first chance exception of type > 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll > > The program '[3216] ipy.exe: Managed (v4.0.30319)' has exited with code 1 > (0x1). > > > > Regards, > > Yngipy > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.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 marcel.vandendungen at gmail.com Wed Jun 16 06:51:36 2010 From: marcel.vandendungen at gmail.com (Marcel) Date: Tue, 15 Jun 2010 21:51:36 -0700 (PDT) Subject: [IronPython] Convert between python array and .NET Array In-Reply-To: <1A472770E042064698CB5ADC83A12ACD489FB74B@TK5EX14MBXC111.redmond.corp.microsoft.com> References: <8a6c92fd-2586-4c9d-8beb-eebccf6411ad@40g2000pry.googlegroups.com> <01ba1ba5-ca1a-4893-b54d-ba791aad54fb@n20g2000prh.googlegroups.com> <0fed1f28-0aee-4107-bc80-f0d74673b32e@40g2000pry.googlegroups.com> <1A472770E042064698CB5ADC83A12ACD489F8520@TK5EX14MBXC111.redmond.corp.microsoft.com> <13b4a7dc-ea25-420a-97df-cf9df9f4029c@g39g2000pri.googlegroups.com> <1A472770E042064698CB5ADC83A12ACD489FB74B@TK5EX14MBXC111.redmond.corp.microsoft.com> Message-ID: Ok, it's clear now. Thanks for the great support! -- Marcel On Jun 15, 9:21?pm, Dino Viehland wrote: > Marcel wrote: > > Thanks Dino, the ctypes.memmove does work! > > > I wasn't aware that ctypes could be used in IronPython. Do they > > marshal to unmanaged code under the hood? > > There's not really any unmanaged code on *our* side involved at all. ?It > all turns into .NET's support for interop. ?So we'll generate calli calls > w/ the correct signature. ?And then all the memory access we do is through > the Marshal APIs. ?I actually didn't even need to flip the /unsafe compiler > flag in order to implement it all :) ? > > > > > Let me know if you want me to file a bug against the Marshal.Copy > > overload behavior. > > I actually don't think this is a bug. ?The problem here is that you either > have a pointer (as an int but it could trivially be turned into an IntPtr) or > an IronPython array object and then an IntPtr. ?For the 2 IntPtr cases there's > no overloads on Marshal and I don't believe anywhere in .NET. ?For ctypes to > implement memmove we had to P/Invoke. ?And for the array case you don't have > a .NET array. > > If we exposed the underlying .NET array then you could use Marshal.Copy. ?But > I'm reluctant to do that because we might want to switch to allocating > unmanaged memory for the array in the future. ?That'll work better w/ ctypes > and calls to buffer_info() - currently need to pin the array for > an unknown amount of time. ?That's another reason to allocate the memory via > ctypes. > > _______________________________________________ > Users mailing list > Us... at lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users-ironpython.com From yngipy at gmail.com Wed Jun 16 07:09:08 2010 From: yngipy at gmail.com (yngipy hernan) Date: Wed, 16 Jun 2010 00:09:08 -0500 Subject: [IronPython] IronPython and C# not giving the same result Message-ID: Hi All, I have tried to transliterate the following C# code to IronPython: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Automation; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { AutomationElement eNode; eNode = TreeWalker.ControlViewWalker.GetFirstChild(AutomationElement.RootElement); while(eNode != null) { if (eNode.Current.Name == "Untitled - Notepad") { AutomationElement ae; ae = TreeWalker.ControlViewWalker.GetFirstChild(eNode); System.Console.WriteLine("-------------------"); while (ae != null) { System.Console.WriteLine("Name: {0}", ae.Current.Name); ae = TreeWalker.ControlViewWalker.GetNextSibling( ae); } System.Console.WriteLine("-------------------"); } eNode = TreeWalker.ControlViewWalker.GetNextSibling(eNode); } } } } The output of this program looks like: ------------------- Name: test1 Name: Untitled - Notepad Name: Application ------------------- This is my IronPython code: import clr clr.AddReference('UIAutomationTypes') clr.AddReference('UIAutomationProvider') clr.AddReference('UIAutomationClient') import System.Windows.Automation as swu rae = swu.TreeWalker.ControlViewWalker.GetFirstChild( swu.AutomationElement.RootElement ) while rae: if rae.Current.Name == 'Untitled - Notepad': print '-'*24 ae = swu.TreeWalker.ControlViewWalker.GetFirstChild( rae ) while ae: print ae.Current.Name ae = swu.TreeWalker.ControlViewWalker.GetNextSibling( ae ) print '-'*24 rae = swu.TreeWalker.ControlViewWalker.GetNextSibling( rae ) The output of this shows: ------------------------ test1 ------------------------ I read somewhere that IronPython used to have issues with UI Automation. Is still the case? Regards, Yngipy -------------- next part -------------- An HTML attachment was scrubbed... URL: From Wolfram.Stanger at kratzer-automation.com Wed Jun 16 10:32:01 2010 From: Wolfram.Stanger at kratzer-automation.com (Stanger, Wolfram) Date: Wed, 16 Jun 2010 10:32:01 +0200 Subject: [IronPython] UI Automation: Wrong values for ControlType, AutomationElementID and more. IronPython 2.6.1 Message-ID: <279FB2C5A55A4A4DBAD10C001903701C07BAB807@server-b.kratzer.lan> Hello to all, over many years I have forced to implement a test automation scenerie in our company. Now they will do it and - who hat thougth that - I've got the job! And I had to bring the job to success! My Environment: ------------------------ I've succesfully presented a test automation solution only build from Internet-Software. It includes: Keyword-Driven Tables in HTML (done with Winword) ! Python 2.6 ! Robot-Framework ! ! ApplTestlib.py SeleniumLibrary ! ! pyWinAuto WEB-AppToTest ! WIN32-AppToTest Later we will embed the solution in a QAtrac process. Now it's time to test automate GUIs build from Windows-Forms and WPF too. First I switched Python 2.6 to IronPython 2.6[and 2.6.1 RC1] and got only one, but 'very magic', bug in Robot-Framework when creating the HTML-Report-File. Second I'm switched the pyWinAuto-Layer to Miscrosoft UI Automation (.NET >= 3.0) to support all GUI-Frameworks (WIN32, WINFORMS and WPF) I. In IronPython all UI Automation values ControlTypePropertys (w/o the window itself) where Type 'panel'. Other values are also not the same as you can see with UISpy or UIA Verify (Tool from Codeplex 'white'-Project). The AutomationIDs has the values from NativeWindowHandles (unique - but never the same from run to run!). Only the NamePropertys are OK but often empty (when control has no text content yet). II. All Controls in the window title (titlebar, menubar, menuitems, and min-, max- and close-Button) where completely hidden in Automation-Tree (I've tested with Raw-, Control- and ContentViews)! These eight controls are from IronPython-UI Automation not reachable. This may be a consequence from point I. above. In this situation it's unpossible for me to identify Controls in the application to automate! I have found, I run in exactly the same problems witch where reported from Jozef in November 2009: http://lists.ironpython.com/pipermail/users-ironpython.com/2009-November /011583.html and heself stated a own solution in http://lists.ironpython.com/pipermail/users-ironpython.com/2009-November /011630.html The solution reads: 'Thanks for your response. Solution to my problem is to first instantiate AutomationElement from dll, not from IronPython. Then all subsequent AutomationElement retrieved from IronPython looks ok.' About 30 years I have programmed in ANSI-C (Same SW on Windows,VMS, Linux, etc.) but now being a newbie to C#, .NET and Python. Therefore I should have an (syntax-)example for the expression: 'to first instantiate AutomationElement from dll' Witch DLL (Own written, .NET-DLL. ??) How to instantiate in C#? How to transport the AutomationElement to IronPython? The best will be if jozef.a... will give me some example lines of code from his solution in nov 2009 in C# and/or Python. Thanks. Greetings Wolfram -------------- next part -------------- An HTML attachment was scrubbed... URL: From merllab at microsoft.com Wed Jun 16 17:07:51 2010 From: merllab at microsoft.com (merllab at microsoft.com) Date: Wed, 16 Jun 2010 08:07:51 -0700 Subject: [IronPython] IronPython 2.6 CodePlex Source Update Message-ID: <78f446ac-115d-4070-b6b0-69c18996cab4@tk5-exsmh-c101.redmond.corp.microsoft.com> This is an automated email letting you know that sources have recently been pushed out. You can download these newer sources directly from http://ironpython.codeplex.com/SourceControl/changeset/view/69156. ADDED SOURCES $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Exceptions/ValueErrorException.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Method.Generated.cs MODIFIED SOURCES $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Parser.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython.Modules/_winreg.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Exceptions/ValueErrorException.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython.Modules/_codecs.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Ast/FromImportStatement.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Exceptions/PythonExceptions.Generated.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Binding/ConversionBinder.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Binding/PythonGetMemberBinder.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/FunctionCode.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/IronPython.csproj $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Ast/ForStatement.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Tokenizer.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Enumerate.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython.Modules/_collections.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython.Modules/binascii.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Binding/MetaOldClass.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Binding/MetaUserObject.Members.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Generator.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython.Modules/cPickle.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Binding/PythonInvokeBinder.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/PythonDynamicExpression.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/DictionaryStorage.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Ast/BinaryExpression.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Binding/MetaOldInstance.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Binding/MetaMethod.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/CompilationMode.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Ast/YieldExpression.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/ClrModule.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython.Modules/cStringIO.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Modules/Builtin.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Ast/AstMethods.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/UncollectableCompilationMode.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Ast/SequenceExpression.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/CommonDictionaryStorage.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Method.Generated.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Operations/UserTypeOps.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/PythonContext.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Operations/PythonTypeOps.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/PythonOptions.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/ModuleGlobalCache.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Operations/PythonOps.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Operations/TypeGroupOps.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Operations/IntOps.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/PythonDictionary.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/List.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Operations/StringOps.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Method.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/LiteralParser.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Operations/LongOps.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Operations/ObjectOps.cs $/IronPython/IronPython_Main/Languages/IronPython/Tests/test_builtinfunc.py $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Types/OldInstance.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/PythonTuple.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Slice.cs $/IronPython/IronPython_Main/Languages/IronPython/Scripts/generate_exceptions.py $/IronPython/IronPython_Main/Languages/IronPython/Scripts/generate_calls.py $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Types/PythonType.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Types/BuiltinFunction.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/ClrStubs.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MemoryBlock.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs $/IronPython/IronPython_Main/Languages/IronPython/Tests/test_help.py $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MemoryMapping.V2.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Metadata/MetadataName.cs From stephen.p.lepisto at intel.com Wed Jun 16 17:08:39 2010 From: stephen.p.lepisto at intel.com (Lepisto, Stephen P) Date: Wed, 16 Jun 2010 08:08:39 -0700 Subject: [IronPython] IronPython and C# not giving the same result In-Reply-To: References: Message-ID: <6AF28EB9F93A354894F2F3916DF6F96E0CE8CDE916@orsmsx510.amr.corp.intel.com> I was able to successfully run that python code under both IronPython 2.0.3 and IronPython 2.6.1 and it produced a list of all top-level applications. I modified the one line if rae.Current.Name == 'Untitled - Notepad': to be if not rae.Current.Name == '': just to see what was actually being found. Note: I'm running Windows XP SP3. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of yngipy hernan Sent: Tuesday, June 15, 2010 10:09 PM To: Discussion of IronPython Subject: [IronPython] IronPython and C# not giving the same result Hi All, I have tried to transliterate the following C# code to IronPython: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Automation; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { AutomationElement eNode; eNode = TreeWalker.ControlViewWalker.GetFirstChild(AutomationElement.RootElement); while(eNode != null) { if (eNode.Current.Name == "Untitled - Notepad") { AutomationElement ae; ae = TreeWalker.ControlViewWalker.GetFirstChild(eNode); System.Console.WriteLine("-------------------"); while (ae != null) { System.Console.WriteLine("Name: {0}", ae.Current.Name); ae = TreeWalker.ControlViewWalker.GetNextSibling( ae); } System.Console.WriteLine("-------------------"); } eNode = TreeWalker.ControlViewWalker.GetNextSibling(eNode); } } } } The output of this program looks like: ------------------- Name: test1 Name: Untitled - Notepad Name: Application ------------------- This is my IronPython code: import clr clr.AddReference('UIAutomationTypes') clr.AddReference('UIAutomationProvider') clr.AddReference('UIAutomationClient') import System.Windows.Automation as swu rae = swu.TreeWalker.ControlViewWalker.GetFirstChild( swu.AutomationElement.RootElement ) while rae: if rae.Current.Name == 'Untitled - Notepad': print '-'*24 ae = swu.TreeWalker.ControlViewWalker.GetFirstChild( rae ) while ae: print ae.Current.Name ae = swu.TreeWalker.ControlViewWalker.GetNextSibling( ae ) print '-'*24 rae = swu.TreeWalker.ControlViewWalker.GetNextSibling( rae ) The output of this shows: ------------------------ test1 ------------------------ I read somewhere that IronPython used to have issues with UI Automation. Is still the case? Regards, Yngipy -------------- next part -------------- An HTML attachment was scrubbed... URL: From robinsiebler at 321.net Wed Jun 16 22:58:31 2010 From: robinsiebler at 321.net (robinsiebler) Date: Wed, 16 Jun 2010 13:58:31 -0700 (PDT) Subject: [IronPython] Passing Parameters to a background worker thread Message-ID: <28907636.post@talk.nabble.com> I'm trying to use BackgroundWorker to make my app multithreaded. I can't figure out how to pass a parameter to it when I call it. How do I do this? -- View this message in context: http://old.nabble.com/Passing-Parameters-to-a-background-worker-thread-tp28907636p28907636.html Sent from the IronPython mailing list archive at Nabble.com. From dinov at microsoft.com Wed Jun 16 23:54:33 2010 From: dinov at microsoft.com (Dino Viehland) Date: Wed, 16 Jun 2010 21:54:33 +0000 Subject: [IronPython] Debugging IronPython script using "IronPython tools for Visual Studio(CP2) In-Reply-To: References: <1A472770E042064698CB5ADC83A12ACD489EED38@TK5EX14MBXC111.redmond.corp.microsoft.com> <1A472770E042064698CB5ADC83A12ACD489F8333@TK5EX14MBXC111.redmond.corp.microsoft.com> Message-ID: <1A472770E042064698CB5ADC83A12ACD48A00107@TK5EX14MBXC111.redmond.corp.microsoft.com> We haven't been posting our PDBs but ipy.pdb isn't very useful - ipy.exe is just a stub which kicks off the process. I think we should probably start posting them for future releases (although they may be available via the public MS symbol servers - I'm not sure if they automatically get deployed when we save them). From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of yngipy hernan Sent: Tuesday, June 15, 2010 9:48 PM To: Discussion of IronPython Subject: Re: [IronPython] Debugging IronPython script using "IronPython tools for Visual Studio(CP2) Hi Dino, Thanks for being patient. I think you are right. It is actually working, I am just not used to seeing "expected" exceptions. By the way, where can I find ipy.pdb (I am assuming that it is the file that "Cannot find or open the PDB file" points to as shown in debug session)? Regards, Yngipy On Tue, Jun 15, 2010 at 1:34 PM, Dino Viehland > wrote: Ok it looks like the last exception is a normal exception from startup. So the interesting question I guess is what happens between startup and when your script starts? Can you set a break point on the 1st line of your script and see what happens (you can just hit F9 while on the 1st line of code)? Does your script successfully run from the command line? From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of yngipy hernan Sent: Monday, June 14, 2010 5:50 PM To: Discussion of IronPython Subject: Re: [IronPython] Debugging IronPython script using "IronPython tools for Visual Studio(CP2) Ok, I am sure if what I did was correct. I did Debug | Exceptions..., since I don't know why exceptions, I just checked all. Then this is what I got: 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\ipy.exe' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\Microsoft.Dynamic.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\Microsoft.Scripting.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\IronPython.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\IronPython.Modules.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.debug.scripting' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\ISymWrapper\v4.0_4.0.0.0__b03f5f7f11d50a3a\ISymWrapper.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Anonymously Hosted DynamicMethods Assembly' A first chance exception of type 'Microsoft.Scripting.ArgumentTypeException' occurred in Snippets.debug.scripting Additional information: Python Exception: TypeError 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.scripting' A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll Additional information: 'module' object has no attribute '__all__' A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll Additional information: name 'fork' is not defined A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll Additional information: name 'fork' is not defined The thread '' (0x930) has exited with code 0 (0x0). A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll Additional information: Exception has been thrown by the target of an invocation. A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll Additional information: name 'fork' is not defined A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll Additional information: name 'spawnvp' is not defined A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll Additional information: name 'spawnvp' is not defined A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll Additional information: Exception has been thrown by the target of an invocation. A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll Additional information: name 'spawnvp' is not defined A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll Additional information: name 'fork' is not defined A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll Additional information: name 'fork' is not defined A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll Additional information: Exception has been thrown by the target of an invocation. A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll Additional information: name 'fork' is not defined A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll Additional information: global name 'statvfs_result' is not defined A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll Additional information: 'module' object has no attribute '__file__' A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll Additional information: 'module' object has no attribute '__file__' A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll Additional information: 'module' object has no attribute '__file__' A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll Additional information: 'module' object has no attribute '__file__' A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll Additional information: 'module' object has no attribute '__file__' A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll Additional information: 'module' object has no attribute '__file__' A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll Additional information: Python Exception: WindowsError A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll Additional information: Python Exception: WindowsError A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll Additional information: Exception has been thrown by the target of an invocation. A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in Microsoft.Dynamic.dll Additional information: Python Exception: WindowsError A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll Additional information: Python Exception: WindowsError A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll Additional information: Python Exception: WindowsError A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll Additional information: Exception has been thrown by the target of an invocation. A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in Microsoft.Dynamic.dll Additional information: Python Exception: WindowsError A first chance exception of type 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll Additional information: No module named sitecustomize A first chance exception of type 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll Additional information: No module named usercustomize The program '[3708] ipy.exe: Managed (v4.0.30319)' has exited with code 1 (0x1). On Tue, Jun 15, 2010 at 8:12 AM, yngipy hernan > wrote: Ok, I need help. Can't find in internet how to "enable breaking on import exception". Anyone knows how to do this? Regards, Yngipy On Mon, Jun 14, 2010 at 11:53 AM, yngipy hernan > wrote: RE: Can you enable breaking on the import exception (or all exceptions and continue after these) and see what the last exception is? Sorry, I am not familiar how to do this. I search for some tutorial, but if you have some wiki out there I can use, I can probably give it a try. Regards, Yngipy On Mon, Jun 14, 2010 at 3:33 AM, Dino Viehland > wrote: I'm assuming the problem here is that this is exiting w/ a non-zero exit code indicating something went wrong. But what went wrong really depends on what the last exception is - there appears to be some failure to import something. The other exceptions are expected as the standard library throws exceptions on startup. Can you enable breaking on the import exception (or all exceptions and continue after these) and see what the last exception is? From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of yngipy hernan Sent: Saturday, June 12, 2010 11:41 PM To: users at lists.ironpython.com Subject: [IronPython] Debugging IronPython script using "IronPython tools for Visual Studio(CP2) Hi all, I am trying to debug my scripts using VS2010 Pro, for non-class based code it is working as expected. But got hiccups inside a class, this is what I am getting: 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\ipy.exe' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\Microsoft.Dynamic.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\Microsoft.Scripting.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\IronPython.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools for Visual Studio\0.2\IronPython.Modules.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.debug.scripting' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\ISymWrapper\v4.0_4.0.0.0__b03f5f7f11d50a3a\ISymWrapper.dll' 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Anonymously Hosted DynamicMethods Assembly' A first chance exception of type 'Microsoft.Scripting.ArgumentTypeException' occurred in Snippets.debug.scripting 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.scripting' A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'System.MissingMemberException' occurred in IronPython.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in Microsoft.Dynamic.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in IronPython.Modules.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in Microsoft.Dynamic.dll A first chance exception of type 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll A first chance exception of type 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll The program '[3216] ipy.exe: Managed (v4.0.30319)' has exited with code 1 (0x1). Regards, Yngipy _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.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 yngipy at gmail.com Thu Jun 17 03:16:14 2010 From: yngipy at gmail.com (yngipy hernan) Date: Wed, 16 Jun 2010 20:16:14 -0500 Subject: [IronPython] IronPython and C# not giving the same result In-Reply-To: <6AF28EB9F93A354894F2F3916DF6F96E0CE8CDE916@orsmsx510.amr.corp.intel.com> References: <6AF28EB9F93A354894F2F3916DF6F96E0CE8CDE916@orsmsx510.amr.corp.intel.com> Message-ID: Hi, All root elements are ok. Thus say, i can see all (?) of the root elements. But not when trying to iterate child elements of the Notepad automation element. My Info: W7 32 bit (UAC disabled) .Net 4.0 On Wed, Jun 16, 2010 at 10:08 AM, Lepisto, Stephen P < stephen.p.lepisto at intel.com> wrote: > I was able to successfully run that python code under both IronPython > 2.0.3 and IronPython 2.6.1 and it produced a list of all top-level > applications. I modified the one line > > > > if rae.Current.Name == 'Untitled - Notepad': > > > > to be > > > > if not rae.Current.Name == '': > > > > just to see what was actually being found. > > > > Note: I'm running Windows XP SP3. > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *yngipy hernan > *Sent:* Tuesday, June 15, 2010 10:09 PM > *To:* Discussion of IronPython > *Subject:* [IronPython] IronPython and C# not giving the same result > > > > Hi All, > > > > I have tried to transliterate the following C# code to IronPython: > > > > using System; > > using System.Collections.Generic; > > using System.Linq; > > using System.Text; > > using System.Windows.Automation; > > > > namespace ConsoleApplication1 > > { > > class Program > > { > > static void Main(string[] args) > > { > > AutomationElement eNode; > > eNode = > TreeWalker.ControlViewWalker.GetFirstChild(AutomationElement.RootElement); > > while(eNode != null) { > > if (eNode.Current.Name == "Untitled - Notepad") > > { > > AutomationElement ae; > > ae = TreeWalker.ControlViewWalker.GetFirstChild(eNode); > > System.Console.WriteLine("-------------------"); > > while (ae != null) > > { > > System.Console.WriteLine("Name: {0}", > ae.Current.Name); > > ae = TreeWalker.ControlViewWalker.GetNextSibling( > ae); > > } > > System.Console.WriteLine("-------------------"); > > } > > eNode = TreeWalker.ControlViewWalker.GetNextSibling(eNode); > > } > > } > > } > > } > > > > The output of this program looks like: > > > > ------------------- > > Name: test1 > > Name: Untitled - Notepad > > Name: Application > > ------------------- > > > > This is my IronPython code: > > > > import clr > > > > clr.AddReference('UIAutomationTypes') > > clr.AddReference('UIAutomationProvider') > > clr.AddReference('UIAutomationClient') > > > > import System.Windows.Automation as swu > > > > rae = swu.TreeWalker.ControlViewWalker.GetFirstChild( > swu.AutomationElement.RootElement ) > > while rae: > > if rae.Current.Name == 'Untitled - Notepad': > > print '-'*24 > > ae = swu.TreeWalker.ControlViewWalker.GetFirstChild( rae ) > > while ae: > > print ae.Current.Name > > ae = swu.TreeWalker.ControlViewWalker.GetNextSibling( ae ) > > print '-'*24 > > rae = swu.TreeWalker.ControlViewWalker.GetNextSibling( rae ) > > > > The output of this shows: > > ------------------------ > > test1 > > ------------------------ > > > > I read somewhere that IronPython used to have issues with UI Automation. Is > still the case? > > > > Regards, > > Yngipy > > _______________________________________________ > 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 yngipy at gmail.com Thu Jun 17 03:17:59 2010 From: yngipy at gmail.com (yngipy hernan) Date: Wed, 16 Jun 2010 20:17:59 -0500 Subject: [IronPython] Debugging IronPython script using "IronPython tools for Visual Studio(CP2) In-Reply-To: <1A472770E042064698CB5ADC83A12ACD48A00107@TK5EX14MBXC111.redmond.corp.microsoft.com> References: <1A472770E042064698CB5ADC83A12ACD489EED38@TK5EX14MBXC111.redmond.corp.microsoft.com> <1A472770E042064698CB5ADC83A12ACD489F8333@TK5EX14MBXC111.redmond.corp.microsoft.com> <1A472770E042064698CB5ADC83A12ACD48A00107@TK5EX14MBXC111.redmond.corp.microsoft.com> Message-ID: I tried to use MS Symbol server but ipy.exe was not found, so probably not there. On Wed, Jun 16, 2010 at 4:54 PM, Dino Viehland wrote: > We haven?t been posting our PDBs but ipy.pdb isn?t very useful ? ipy.exe > is just a stub which kicks off the process. I think we should probably > start posting them for future releases (although they may be available via > the public MS symbol servers ? I?m not sure if they automatically get > deployed when we save them). > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *yngipy hernan > *Sent:* Tuesday, June 15, 2010 9:48 PM > > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] Debugging IronPython script using "IronPython > tools for Visual Studio(CP2) > > > > Hi Dino, > > > > Thanks for being patient. I think you are right. It is actually working, I > am just not used to seeing "expected" exceptions. > > > > By the way, where can I find ipy.pdb (I am assuming that it is the file > that "Cannot find or open the PDB file" points to as shown in debug > session)? > > > > Regards, > > Yngipy > > > > On Tue, Jun 15, 2010 at 1:34 PM, Dino Viehland > wrote: > > Ok it looks like the last exception is a normal exception from startup. So > the interesting question I guess is what happens between startup and when > your script starts? Can you set a break point on the 1st line of your > script and see what happens (you can just hit F9 while on the 1st line of > code)? Does your script successfully run from the command line? > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *yngipy hernan > *Sent:* Monday, June 14, 2010 5:50 PM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] Debugging IronPython script using "IronPython > tools for Visual Studio(CP2) > > > > Ok, I am sure if what I did was correct. > > > > > > I did Debug | Exceptions..., since I don't know why exceptions, I just > checked all. Then this is what I got: > > > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\ipy.exe' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\Microsoft.Dynamic.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\Microsoft.Scripting.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\IronPython.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\IronPython.Modules.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.debug.scripting' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_32\ISymWrapper\v4.0_4.0.0.0__b03f5f7f11d50a3a\ISymWrapper.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Anonymously Hosted DynamicMethods > Assembly' > > A first chance exception of type > 'Microsoft.Scripting.ArgumentTypeException' occurred in > Snippets.debug.scripting > > > > Additional information: Python Exception: TypeError > > > > 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.scripting' > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > > > Additional information: 'module' object has no attribute '__all__' > > > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in IronPython.dll > > > > Additional information: name 'fork' is not defined > > > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > > > Additional information: name 'fork' is not defined > > > > The thread '' (0x930) has exited with code 0 (0x0). > > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > > > > Additional information: Exception has been thrown by the target of an > invocation. > > > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > > > Additional information: name 'fork' is not defined > > > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in IronPython.dll > > > > Additional information: name 'spawnvp' is not defined > > > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > > > Additional information: name 'spawnvp' is not defined > > > > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > > > > Additional information: Exception has been thrown by the target of an > invocation. > > > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > > > Additional information: name 'spawnvp' is not defined > > > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in IronPython.dll > > > > Additional information: name 'fork' is not defined > > > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > > > Additional information: name 'fork' is not defined > > > > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > > > > Additional information: Exception has been thrown by the target of an > invocation. > > > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > > > Additional information: name 'fork' is not defined > > > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in IronPython.dll > > > > Additional information: global name 'statvfs_result' is not defined > > > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > > > Additional information: 'module' object has no attribute '__file__' > > > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > > > Additional information: 'module' object has no attribute '__file__' > > > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > > > Additional information: 'module' object has no attribute '__file__' > > > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > > > Additional information: 'module' object has no attribute '__file__' > > > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > > > Additional information: 'module' object has no attribute '__file__' > > > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > > > Additional information: 'module' object has no attribute '__file__' > > > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in IronPython.Modules.dll > > > > Additional information: Python Exception: WindowsError > > > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in IronPython.Modules.dll > > > > Additional information: Python Exception: WindowsError > > > > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > > > > Additional information: Exception has been thrown by the target of an > invocation. > > > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in Microsoft.Dynamic.dll > > > > Additional information: Python Exception: WindowsError > > > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in IronPython.Modules.dll > > > > Additional information: Python Exception: WindowsError > > > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in IronPython.Modules.dll > > > > Additional information: Python Exception: WindowsError > > > > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > > > > Additional information: Exception has been thrown by the target of an > invocation. > > > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in Microsoft.Dynamic.dll > > > > Additional information: Python Exception: WindowsError > > > > A first chance exception of type > 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll > > > > Additional information: No module named sitecustomize > > > > A first chance exception of type > 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll > > > > Additional information: No module named usercustomize > > > > The program '[3708] ipy.exe: Managed (v4.0.30319)' has exited with code 1 > (0x1). > > > > > > On Tue, Jun 15, 2010 at 8:12 AM, yngipy hernan wrote: > > Ok, I need help. Can't find in internet how to "enable breaking on import > exception". Anyone knows how to do this? > > > > Regards, > > Yngipy > > > > On Mon, Jun 14, 2010 at 11:53 AM, yngipy hernan wrote: > > *RE: Can you enable breaking on the import exception (or all exceptions > and continue after these) and see what the last exception is?* > > Sorry, I am not familiar how to do this. I search for some tutorial, but if > you have some wiki out there I can use, I can probably give it a try. > > > > Regards, > > Yngipy > > > > On Mon, Jun 14, 2010 at 3:33 AM, Dino Viehland > wrote: > > I?m assuming the problem here is that this is exiting w/ a non-zero exit > code indicating something went wrong. But what went wrong really depends on > what the last exception is ? there appears to be some failure to import > something. The other exceptions are expected as the standard library throws > exceptions on startup. Can you enable breaking on the import exception (or > all exceptions and continue after these) and see what the last exception is? > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *yngipy hernan > *Sent:* Saturday, June 12, 2010 11:41 PM > *To:* users at lists.ironpython.com > *Subject:* [IronPython] Debugging IronPython script using "IronPython > tools for Visual Studio(CP2) > > > > Hi all, > > > > I am trying to debug my scripts using VS2010 Pro, for non-class based code > it is working as expected. But got hiccups inside a class, this is what I am > getting: > > > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\ipy.exe' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\Microsoft.Dynamic.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\Microsoft.Scripting.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\IronPython.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Users\yoyong\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython > Tools for Visual Studio\0.2\IronPython.Modules.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.debug.scripting' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded > 'C:\Windows\Microsoft.Net\assembly\GAC_32\ISymWrapper\v4.0_4.0.0.0__b03f5f7f11d50a3a\ISymWrapper.dll' > > 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Anonymously Hosted DynamicMethods > Assembly' > > A first chance exception of type > 'Microsoft.Scripting.ArgumentTypeException' occurred in > Snippets.debug.scripting > > 'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.scripting' > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in IronPython.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in IronPython.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in IronPython.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in Microsoft.Dynamic.dll > > A first chance exception of type 'IronPython.Runtime.UnboundNameException' > occurred in IronPython.dll > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > A first chance exception of type 'System.MissingMemberException' occurred > in IronPython.dll > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in IronPython.Modules.dll > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in IronPython.Modules.dll > > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in Microsoft.Dynamic.dll > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in IronPython.Modules.dll > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in IronPython.Modules.dll > > A first chance exception of type > 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll > > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in Microsoft.Dynamic.dll > > A first chance exception of type > 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll > > A first chance exception of type > 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll > > The program '[3216] ipy.exe: Managed (v4.0.30319)' has exited with code 1 > (0x1). > > > > Regards, > > Yngipy > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.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 yngipy at gmail.com Thu Jun 17 03:25:45 2010 From: yngipy at gmail.com (yngipy hernan) Date: Wed, 16 Jun 2010 20:25:45 -0500 Subject: [IronPython] UI Automation: Wrong values for ControlType, AutomationElementID and more. IronPython 2.6.1 In-Reply-To: <279FB2C5A55A4A4DBAD10C001903701C07BAB807@server-b.kratzer.lan> References: <279FB2C5A55A4A4DBAD10C001903701C07BAB807@server-b.kratzer.lan> Message-ID: I have been playing around UI Automation and IronPython for several days now. My impression is that they don't play each other well. Or maybe I missed something. I am trying to dig deeper to understand why..... Probably this issue is not fixed yet? http://blogs.msdn.com/b/shrib/archive/2008/03/24/ironpython-cannot-call-automationelement-fromhandle.aspx On Wed, Jun 16, 2010 at 3:32 AM, Stanger, Wolfram < Wolfram.Stanger at kratzer-automation.com> wrote: > Hello to all, > > over many years I have forced to implement a test automation scenerie in > our company. > Now they will do it and - who hat thougth that - I've got the job! And I > had to bring the job to success! > > My Environment: > ------------------------ > I've succesfully presented a test automation solution only build from Internet-Software. > It includes: > > Keyword-Driven Tables in HTML (done with Winword) > ! > Python 2.6 > ! > Robot-Framework > ! ! > ApplTestlib.py SeleniumLibrary > ! ! > pyWinAuto WEB-AppToTest > ! > WIN32-AppToTest > > Later we will embed the solution in a QAtrac process. > > Now it's time to test automate GUIs build from Windows-Forms and WPF too. > > First I switched Python 2.6 to IronPython 2.6[and 2.6.1 RC1] and got only > one, but 'very magic', bug in Robot-Framework when creating the > HTML-Report-File. > Second I'm switched the pyWinAuto-Layer to Miscrosoft UI Automation (.NET > >= 3.0) to support all GUI-Frameworks (WIN32, WINFORMS and WPF) > > I. In IronPython all UI Automation values ControlTypePropertys (w/o the > window itself) where Type 'panel'. Other values are also not the same as > you can see > with UISpy or UIA Verify (Tool from Codeplex 'white'-Project). The > AutomationIDs has the values from NativeWindowHandles (unique - but never > the same from run to run!). > Only the NamePropertys are OK but often empty (when control has no text > content yet). > > II. All Controls in the window title (titlebar, menubar, menuitems, and > min-, max- and close-Button) where completely hidden in Automation-Tree > (I've tested with Raw-, Control- and ContentViews)! These eight controls are > from IronPython-UI Automation not reachable. This may be a consequence from > point I. above. > > In this situation it's unpossible for me to identify Controls in the > application to automate! > > I have found, I run in exactly the same problems witch where reported > from Jozef in November 2009: > > http://lists.ironpython.com/pipermail/users-ironpython.com/2009-November/011583.html > > and heself stated a own solution in > > http://lists.ironpython.com/pipermail/users-ironpython.com/2009-November/011630.html > > The solution reads: > > 'Thanks for your response. > Solution to my problem is to first instantiate AutomationElement from dll, > not from IronPython. > Then all subsequent AutomationElement retrieved from IronPython looks ok.' > > About 30 years I have programmed in ANSI-C (Same SW on Windows,VMS, Linux, > etc.) but now being a newbie to C#, .NET and Python. > > Therefore I should have an (syntax-)example for the expression: > 'to first instantiate AutomationElement from dll' > > Witch DLL (Own written, .NET-DLL. ??) > How to instantiate in C#? > How to transport the AutomationElement to IronPython? > > The best will be if jozef.a... will give me some example lines of code from > his solution in nov 2009 in C# and/or Python. Thanks. > > Greetings > Wolfram > > _______________________________________________ > 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 cenovsky at bakalari.cz Thu Jun 17 10:52:13 2010 From: cenovsky at bakalari.cz (Lukas Cenovsky) Date: Thu, 17 Jun 2010 10:52:13 +0200 Subject: [IronPython] IronPython and C# not giving the same result In-Reply-To: References: <6AF28EB9F93A354894F2F3916DF6F96E0CE8CDE916@orsmsx510.amr.corp.intel.com> Message-ID: <4C19E23D.9060309@bakalari.cz> I tried your IronPython script and it found one child element which name is ''. Change the print line to: print 'Name:', ae.Current.Name -- -- Luk?s( yngipy hernan wrote: > Hi, > > All root elements are ok. Thus say, i can see all (?) of the root > elements. > > But not when trying to iterate child elements of the Notepad > automation element. > > My Info: > W7 32 bit (UAC disabled) > .Net 4.0 > > On Wed, Jun 16, 2010 at 10:08 AM, Lepisto, Stephen P > > wrote: > > I was able to successfully run that python code under both > IronPython 2.0.3 and IronPython 2.6.1 and it produced a list of > all top-level applications. I modified the one line > > > > if rae.Current.Name == 'Untitled - Notepad': > > > > to be > > > > if not rae.Current.Name == '': > > > > just to see what was actually being found. > > > > Note: I'm running Windows XP SP3. > > > > *From:* users-bounces at lists.ironpython.com > > [mailto:users-bounces at lists.ironpython.com > ] *On Behalf Of *yngipy > hernan > *Sent:* Tuesday, June 15, 2010 10:09 PM > *To:* Discussion of IronPython > *Subject:* [IronPython] IronPython and C# not giving the same result > > > > Hi All, > > > > I have tried to transliterate the following C# code to IronPython: > > > > using System; > > using System.Collections.Generic; > > using System.Linq; > > using System.Text; > > using System.Windows.Automation; > > > > namespace ConsoleApplication1 > > { > > class Program > > { > > static void Main(string[] args) > > { > > AutomationElement eNode; > > eNode = > TreeWalker.ControlViewWalker.GetFirstChild(AutomationElement.RootElement); > > while(eNode != null) { > > if (eNode.Current.Name > == "Untitled - Notepad") > > { > > AutomationElement ae; > > ae = > TreeWalker.ControlViewWalker.GetFirstChild(eNode); > > System.Console.WriteLine("-------------------"); > > while (ae != null) > > { > > System.Console.WriteLine("Name: {0}", > ae.Current.Name ); > > ae = > TreeWalker.ControlViewWalker.GetNextSibling( ae); > > } > > System.Console.WriteLine("-------------------"); > > } > > eNode = > TreeWalker.ControlViewWalker.GetNextSibling(eNode); > > } > > } > > } > > } > > > > The output of this program looks like: > > > > ------------------- > > Name: test1 > > Name: Untitled - Notepad > > Name: Application > > ------------------- > > > > This is my IronPython code: > > > > import clr > > > > clr.AddReference('UIAutomationTypes') > > clr.AddReference('UIAutomationProvider') > > clr.AddReference('UIAutomationClient') > > > > import System.Windows.Automation as swu > > > > rae = swu.TreeWalker.ControlViewWalker.GetFirstChild( > swu.AutomationElement.RootElement ) > > while rae: > > if rae.Current.Name == 'Untitled - > Notepad': > > print '-'*24 > > ae = swu.TreeWalker.ControlViewWalker.GetFirstChild( rae ) > > while ae: > > print ae.Current.Name > > ae = swu.TreeWalker.ControlViewWalker.GetNextSibling( ae ) > > print '-'*24 > > rae = swu.TreeWalker.ControlViewWalker.GetNextSibling( rae ) > > > > The output of this shows: > > ------------------------ > > test1 > > ------------------------ > > > > I read somewhere that IronPython used to have issues with UI > Automation. Is still the case? > > > > Regards, > > Yngipy > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.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 Wolfram.Stanger at kratzer-automation.com Thu Jun 17 11:37:29 2010 From: Wolfram.Stanger at kratzer-automation.com (Stanger, Wolfram) Date: Thu, 17 Jun 2010 11:37:29 +0200 Subject: [IronPython] IronPython and C# not giving the same result In-Reply-To: <4C19E23D.9060309@bakalari.cz> References: <6AF28EB9F93A354894F2F3916DF6F96E0CE8CDE916@orsmsx510.amr.corp.intel.com> <4C19E23D.9060309@bakalari.cz> Message-ID: <279FB2C5A55A4A4DBAD10C001903701C07BABC8E@server-b.kratzer.lan> Hello all, unless we get following child elements for example in a empty notepad application all playing be be useless: Raw View: --------------- "Window" "Unbenannt - Editor" "Document" "" "Scrollbar" "Vertikale Bildlaufleiste" "Button" "Zur?ck um kleine Menge" "Button" "Vorw?rts um kleine Menge" "Titelbar" "Unbenannt - Editor" "Menubar" "Systemmen?leiste" "Menuitem" "System" "Button" "Minimieren" "Button" "Maximieren" "Button" "Schlie?en" "Menubar" "Anwendung" "Menuitem" "Datei" "Menuitem" "Bearbeiten" "Menuitem" "Format" "Menuitem" "Ansicht" "Menuitem" "?" It a german window a I have translated the ControlType (1st word; 2nd = name) to english. The output ist created from the tool UISpy, witch shows all AutomationElements from all application curently running as child beneath the 'desktop' window. UISpy come from MS and can be downloaded free. Greetings Wolfram ________________________________ Von: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] Im Auftrag von Lukas Cenovsky Gesendet: Donnerstag, 17. Juni 2010 10:52 An: Discussion of IronPython Betreff: Re: [IronPython] IronPython and C# not giving the same result I tried your IronPython script and it found one child element which name is ''. Change the print line to: print 'Name:', ae.Current.Name -- -- Luk?? yngipy hernan wrote: Hi, All root elements are ok. Thus say, i can see all (?) of the root elements. But not when trying to iterate child elements of the Notepad automation element. My Info: W7 32 bit (UAC disabled) .Net 4.0 On Wed, Jun 16, 2010 at 10:08 AM, Lepisto, Stephen P wrote: I was able to successfully run that python code under both IronPython 2.0.3 and IronPython 2.6.1 and it produced a list of all top-level applications. I modified the one line if rae.Current.Name == 'Untitled - Notepad': to be if not rae.Current.Name == '': just to see what was actually being found. Note: I'm running Windows XP SP3. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of yngipy hernan Sent: Tuesday, June 15, 2010 10:09 PM To: Discussion of IronPython Subject: [IronPython] IronPython and C# not giving the same result Hi All, I have tried to transliterate the following C# code to IronPython: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Automation; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { AutomationElement eNode; eNode = TreeWalker.ControlViewWalker.GetFirstChild(AutomationElement.RootElement); while(eNode != null) { if (eNode.Current.Name == "Untitled - Notepad") { AutomationElement ae; ae = TreeWalker.ControlViewWalker.GetFirstChild(eNode); System.Console.WriteLine("-------------------"); while (ae != null) { System.Console.WriteLine("Name: {0}", ae.Current.Name); ae = TreeWalker.ControlViewWalker.GetNextSibling( ae); } System.Console.WriteLine("-------------------"); } eNode = TreeWalker.ControlViewWalker.GetNextSibling(eNode); } } } } The output of this program looks like: ------------------- Name: test1 Name: Untitled - Notepad Name: Application ------------------- This is my IronPython code: import clr clr.AddReference('UIAutomationTypes') clr.AddReference('UIAutomationProvider') clr.AddReference('UIAutomationClient') import System.Windows.Automation as swu rae = swu.TreeWalker.ControlViewWalker.GetFirstChild( swu.AutomationElement.RootElement ) while rae: if rae.Current.Name == 'Untitled - Notepad': print '-'*24 ae = swu.TreeWalker.ControlViewWalker.GetFirstChild( rae ) while ae: print ae.Current.Name ae = swu.TreeWalker.ControlViewWalker.GetNextSibling( ae ) print '-'*24 rae = swu.TreeWalker.ControlViewWalker.GetNextSibling( rae ) The output of this shows: ------------------------ test1 ------------------------ I read somewhere that IronPython used to have issues with UI Automation. Is still the case? Regards, Yngipy _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.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 yngipy at gmail.com Fri Jun 18 06:59:47 2010 From: yngipy at gmail.com (yngipy hernan) Date: Thu, 17 Jun 2010 23:59:47 -0500 Subject: [IronPython] IronPython and C# not giving the same result In-Reply-To: <279FB2C5A55A4A4DBAD10C001903701C07BABC8E@server-b.kratzer.lan> References: <6AF28EB9F93A354894F2F3916DF6F96E0CE8CDE916@orsmsx510.amr.corp.intel.com> <4C19E23D.9060309@bakalari.cz> <279FB2C5A55A4A4DBAD10C001903701C07BABC8E@server-b.kratzer.lan> Message-ID: First off, Notepad was running with the word "test1". Sorry for not being clear. As with Wolfram, I also used UI Spy. UI Spy would see tree element from the "Notepad" window. Namely: Edit control (this contains "test1" text) TitlebarControrl (this is where the min, max, close, system menu is contained. And it has the text "Untitled - Notepad") Application Menu bar (This is the main menus). So yes, IronPython does not seem to like UI Automation much. C# can do it just fine by the way. This might be related to this issue. I am hoping that people with deep enough knowledge about IronPython can confirm this. Or if I can get enough direction, I can spend some time digging into it.... but I need hint how to go from here. Regards, Yngipy 2010/6/17 Stanger, Wolfram > Hello all, > > unless we get following child elements for example in a empty notepad > application all playing be be useless: > > Raw View: > --------------- > "Window" "Unbenannt - Editor" > "Document" "" > "Scrollbar" "Vertikale Bildlaufleiste" > "Button" "Zur?ck um kleine Menge" > "Button" "Vorw?rts um kleine Menge" > "Titelbar" "Unbenannt - Editor" > "Menubar" "Systemmen?leiste" > "Menuitem" "System" > "Button" "Minimieren" > "Button" "Maximieren" > "Button" "Schlie?en" > "Menubar" "Anwendung" > "Menuitem" "Datei" > "Menuitem" "Bearbeiten" > "Menuitem" "Format" > "Menuitem" "Ansicht" > "Menuitem" "?" > It a german window a I have translated the ControlType (1st word; 2nd = > name) to english. > > The output ist created from the tool UISpy, witch shows all > AutomationElements from all application curently running as child beneath > the 'desktop' window. > > UISpy come from MS and can be downloaded free. > > Greetings > Wolfram > > ------------------------------ > *Von:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *Im Auftrag von *Lukas Cenovsky > *Gesendet:* Donnerstag, 17. Juni 2010 10:52 > *An:* Discussion of IronPython > *Betreff:* Re: [IronPython] IronPython and C# not giving the same result > > I tried your IronPython script and it found one child element which name is > ''. > > Change the print line to: > print 'Name:', ae.Current.Name > > -- > -- Luk?? > > > yngipy hernan wrote: > > Hi, > > All root elements are ok. Thus say, i can see all (?) of the root elements. > > But not when trying to iterate child elements of the Notepad automation > element. > > My Info: > W7 32 bit (UAC disabled) > .Net 4.0 > > On Wed, Jun 16, 2010 at 10:08 AM, Lepisto, Stephen P < > stephen.p.lepisto at intel.com> wrote: > >> I was able to successfully run that python code under both IronPython >> 2.0.3 and IronPython 2.6.1 and it produced a list of all top-level >> applications. I modified the one line >> >> >> >> if rae.Current.Name == 'Untitled - Notepad': >> >> >> >> to be >> >> >> >> if not rae.Current.Name == '': >> >> >> >> just to see what was actually being found. >> >> >> >> Note: I'm running Windows XP SP3. >> >> >> >> *From:* users-bounces at lists.ironpython.com [mailto: >> users-bounces at lists.ironpython.com] *On Behalf Of *yngipy hernan >> *Sent:* Tuesday, June 15, 2010 10:09 PM >> *To:* Discussion of IronPython >> *Subject:* [IronPython] IronPython and C# not giving the same result >> >> >> >> Hi All, >> >> >> >> I have tried to transliterate the following C# code to IronPython: >> >> >> >> using System; >> >> using System.Collections.Generic; >> >> using System.Linq; >> >> using System.Text; >> >> using System.Windows.Automation; >> >> >> >> namespace ConsoleApplication1 >> >> { >> >> class Program >> >> { >> >> static void Main(string[] args) >> >> { >> >> AutomationElement eNode; >> >> eNode = >> TreeWalker.ControlViewWalker.GetFirstChild(AutomationElement.RootElement); >> >> while(eNode != null) { >> >> if (eNode.Current.Name == "Untitled - Notepad") >> >> { >> >> AutomationElement ae; >> >> ae = >> TreeWalker.ControlViewWalker.GetFirstChild(eNode); >> >> System.Console.WriteLine("-------------------"); >> >> while (ae != null) >> >> { >> >> System.Console.WriteLine("Name: {0}", >> ae.Current.Name); >> >> ae = TreeWalker.ControlViewWalker.GetNextSibling( >> ae); >> >> } >> >> System.Console.WriteLine("-------------------"); >> >> } >> >> eNode = >> TreeWalker.ControlViewWalker.GetNextSibling(eNode); >> >> } >> >> } >> >> } >> >> } >> >> >> >> The output of this program looks like: >> >> >> >> ------------------- >> >> Name: test1 >> >> Name: Untitled - Notepad >> >> Name: Application >> >> ------------------- >> >> >> >> This is my IronPython code: >> >> >> >> import clr >> >> >> >> clr.AddReference('UIAutomationTypes') >> >> clr.AddReference('UIAutomationProvider') >> >> clr.AddReference('UIAutomationClient') >> >> >> >> import System.Windows.Automation as swu >> >> >> >> rae = swu.TreeWalker.ControlViewWalker.GetFirstChild( >> swu.AutomationElement.RootElement ) >> >> while rae: >> >> if rae.Current.Name == 'Untitled - Notepad': >> >> print '-'*24 >> >> ae = swu.TreeWalker.ControlViewWalker.GetFirstChild( rae ) >> >> while ae: >> >> print ae.Current.Name >> >> ae = swu.TreeWalker.ControlViewWalker.GetNextSibling( ae ) >> >> print '-'*24 >> >> rae = swu.TreeWalker.ControlViewWalker.GetNextSibling( rae ) >> >> >> >> The output of this shows: >> >> ------------------------ >> >> test1 >> >> ------------------------ >> >> >> >> I read somewhere that IronPython used to have issues with UI Automation. >> Is still the case? >> >> >> >> Regards, >> >> Yngipy >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://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 cenovsky at bakalari.cz Fri Jun 18 11:08:07 2010 From: cenovsky at bakalari.cz (Lukas Cenovsky) Date: Fri, 18 Jun 2010 11:08:07 +0200 Subject: [IronPython] UI Automation: Wrong values for ControlType, AutomationElementID and more. IronPython 2.6.1 In-Reply-To: References: <279FB2C5A55A4A4DBAD10C001903701C07BAB807@server-b.kratzer.lan> Message-ID: <4C1B3777.9060101@bakalari.cz> Just an idea - create a proxy in C# that calls TreeWalker.ControlViewWalker.GetFirstChild and other methods for you and return you the results. Maybe it will work. The similar way I created the C# proxy to access Win32API functions (http://gui-at.blogspot.com/2008/07/simulate-users-input.html) -- -- Luk?s( yngipy hernan wrote: > I have been playing around UI Automation and IronPython for several > days now. My impression is that they don't play each other well. Or > maybe I missed something. > > I am trying to dig deeper to understand why..... > > Probably this issue is not fixed > yet? http://blogs.msdn.com/b/shrib/archive/2008/03/24/ironpython-cannot-call-automationelement-fromhandle.aspx > > > On Wed, Jun 16, 2010 at 3:32 AM, Stanger, Wolfram > > wrote: > > Hello to all, > > over many years I have forced to implement a test automation > scenerie in our company. > Now they will do it and - who hat thougth that - I've got the job! > And I had to bring the job to success! > > My Environment: > ------------------------ > I've succesfully presented a test automation solution only build > from Internet-Software. It includes: > > Keyword-Driven Tables in HTML (done with Winword) > ! > Python 2.6 > ! > Robot-Framework > ! ! > ApplTestlib.py SeleniumLibrary > ! ! > pyWinAuto WEB-AppToTest > ! > WIN32-AppToTest > > Later we will embed the solution in a QAtrac process. > > Now it's time to test automate GUIs build from Windows-Forms and > WPF too. > > First I switched Python 2.6 to IronPython 2.6[and 2.6.1 RC1] and > got only one, but 'very magic', bug in Robot-Framework when > creating the HTML-Report-File. > Second I'm switched the pyWinAuto-Layer to Miscrosoft UI > Automation (.NET >= 3.0) to support all GUI-Frameworks (WIN32, > WINFORMS and WPF) > > I. In IronPython all UI Automation values ControlTypePropertys > (w/o the window itself) where Type 'panel'. Other values are also > not the same as you can see > with UISpy or UIA Verify (Tool from Codeplex 'white'-Project). The > AutomationIDs has the values from NativeWindowHandles (unique > - but never the same from run to run!). > Only the NamePropertys are OK but often empty (when control has no > text content yet). > > II. All Controls in the window title (titlebar, menubar, > menuitems, and min-, max- and close-Button) where completely > hidden in Automation-Tree (I've tested with Raw-, Control- and > ContentViews)! These eight controls are from IronPython-UI > Automation not reachable. This may be a consequence from point I. > above. > > In this situation it's unpossible for me to identify Controls in > the application to automate! > > I have found, I run in exactly the same problems witch where > reported from Jozef in November 2009: > http://lists.ironpython.com/pipermail/users-ironpython.com/2009-November/011583.html > > and heself stated a own solution in > http://lists.ironpython.com/pipermail/users-ironpython.com/2009-November/011630.html > > The solution reads: > > 'Thanks for your response. > Solution to my problem is to first instantiate AutomationElement > from dll, not from IronPython. > Then all subsequent AutomationElement retrieved from IronPython > looks ok.' > > About 30 years I have programmed in ANSI-C (Same SW on > Windows,VMS, Linux, etc.) but now being a newbie to C#, .NET and > Python. > > Therefore I should have an (syntax-)example for the expression: > 'to first instantiate AutomationElement from dll' > > Witch DLL (Own written, .NET-DLL. ??) > How to instantiate in C#? > How to transport the AutomationElement to IronPython? > > The best will be if jozef.a... will give me some example lines of > code from his solution in nov 2009 in C# and/or Python. Thanks. > > Greetings > Wolfram > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.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 cenovsky at bakalari.cz Fri Jun 18 11:13:00 2010 From: cenovsky at bakalari.cz (Lukas Cenovsky) Date: Fri, 18 Jun 2010 11:13:00 +0200 Subject: [IronPython] Passing Parameters to a background worker thread In-Reply-To: <28907636.post@talk.nabble.com> References: <28907636.post@talk.nabble.com> Message-ID: <4C1B389C.40207@bakalari.cz> robinsiebler wrote: > I'm trying to use BackgroundWorker to make my app multithreaded. I can't > figure out how to pass a parameter to it when I call it. How do I do this? Check http://devhawk.net/2008/11/19/IronPython+And+WPF+Part+4+Background+Processing.aspx -- -- Luk?? From merllab at microsoft.com Fri Jun 18 18:20:43 2010 From: merllab at microsoft.com (merllab at microsoft.com) Date: Fri, 18 Jun 2010 09:20:43 -0700 Subject: [IronPython] IronPython 2.6 CodePlex Source Update Message-ID: <57a61162-c732-4bc7-95b2-8aa3b6552e4d@tk5-exsmh-c101.redmond.corp.microsoft.com> This is an automated email letting you know that sources have recently been pushed out. You can download these newer sources directly from http://ironpython.codeplex.com/SourceControl/changeset/view/69747. ADDED SOURCES $/IronPython/IronPython_Main/Languages/IronPython/Tests/Tools/baselines/mmap.log $/IronPython/IronPython_Main/Solutions/IronPython4.sln $/IronPython/IronPython_Main/Test/DlrComLibrary/DlrComLibrary.vcxproj.filters $/IronPython/IronPython_Main/Test/DlrComLibrary/DlrComLibrary.vcxproj $/IronPython/IronPython_Main/Test/DlrComLibrary/DlrComLibraryPS.vcxproj.filters $/IronPython/IronPython_Main/Test/DlrComLibrary/DlrComLibraryPS.vcxproj DELETED SOURCES $/IronPython/IronPython_Main/Solutions/IronPython.sln $/IronPython/IronPython_Main/Test/DlrComLibrary/DlrComLibrary.vcproj $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting.Core $/IronPython/IronPython_Main/Test/DlrComLibrary/DlrComLibraryPS.vcproj MODIFIED SOURCES $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Parser.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/PythonContext.cs $/IronPython/IronPython_Main/Hosts/Silverlight/Microsoft.Scripting.SilverLight/Microsoft.Scripting.Silverlight.csproj $/IronPython/IronPython_Main/Languages/IronPython/IronPython/IronPython.csproj $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Types/TypeInfo.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython.Modules/IronPython.Modules.csproj $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Operations/PythonOps.cs $/IronPython/IronPython_Main/Hosts/Silverlight/Chiron/Chiron.csproj $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Types/CustomAttributeTracker.cs $/IronPython/IronPython_Main/Config/Signed/App.config $/IronPython/IronPython_Main/Languages/IronPython/Tests/Tools/baselines/mmap.log $/IronPython/IronPython_Main/Languages/IronPython/Tests/Tools/logmodule.py $/IronPython/IronPython_Main/Languages/IronPython/IronPythonConsoleAny/IronPythonConsoleAny.csproj $/IronPython/IronPython_Main/Languages/IronPython/Tests/test_class.py $/IronPython/IronPython_Main/Languages/IronPython/IronPythonWindow/IronPythonWindow.csproj $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Actions/MemberTracker.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPythonConsole/IronPythonConsole.csproj $/IronPython/IronPython_Main/Languages/IronPython/Tests/test_imp.py $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Microsoft.Dynamic.csproj $/IronPython/IronPython_Main/Languages/IronPython/IronPythonTest/EngineTest.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPythonTest/IronPythonTest.csproj $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Actions/BoundMemberTracker.cs $/IronPython/IronPython_Main/Languages/IronPython/Scripts/generate_tree.py $/IronPython/IronPython_Main/Languages/IronPython/IronPythonWindowAny/IronPythonWindowAny.csproj $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Actions/DefaultBinder.SetMember.cs $/IronPython/IronPython_Main/Languages/IronPython/Tests/test_ipye.py $/IronPython/IronPython_Main/Solutions/IronPython4.sln $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting/Microsoft.Scripting.csproj $/IronPython/IronPython_Main/Test/ClrAssembly/ClrAssembly.csproj $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting.Debugging/Microsoft.Scripting.Debugging.csproj $/IronPython/IronPython_Main/Test/DlrComLibrary/DlrComLibrary.sln $/IronPython/IronPython_Main/Test/DlrComLibrary/DlrComLibrary.vcxproj.filters $/IronPython/IronPython_Main/Test/DlrComLibrary/DlrComLibrary.vcxproj $/IronPython/IronPython_Main/Test/DlrComLibrary/DlrComLibraryPS.vcxproj.filters $/IronPython/IronPython_Main/Test/DlrComLibrary/DlrComLibraryPS.vcxproj $/IronPython/IronPython_Main/Tutorial/Tutorial.htm CHECKIN COMMENTS -------------------------------------------------------------------------------- Changeset Id: 1873787 Date: 6/17/2010 2:43:47 PM 27247 __delattr__ doesn't work on instance attributes of user defined instance Our implementation is totally wrong ? we?re doing the descriptor protocol instead of doing object.__delattr__ 26940 Wrong line numbers in traceback when encoding is specified We should always seek back to the beginning of the file so line numbers remain correct 27547 Problem with ScriptSource.GetCodeProperties() We need to pass empty parameters if we fail to parse them Flow through error suggestion on SetMember actions and respect it This fixes IronPython so it works w/ DynamicObject subclasses for module scopes (Shelveset: AFewSmallBugsFinal2;REDMOND\dinov | SNAP CheckinId: 10944) From davidescobar1976 at gmail.com Fri Jun 18 20:51:22 2010 From: davidescobar1976 at gmail.com (David Escobar) Date: Fri, 18 Jun 2010 11:51:22 -0700 Subject: [IronPython] ElementTree bug? Message-ID: Hi everyone, There seems to be an inconsistency in the ElementTree class between CPython and IronPython. In CPython 2.6.4: *Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import xml.etree.ElementTree as etree >>> xml_str = "David123-4567" >>> xml = etree.XML(xml_str) >>> print xml.find("Phone").text 123-4567 >>> * In IronPython 2.6.1: *IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.3603 Type "help", "copyright", "credits" or "license" for more information. >>> import xml.etree.ElementTree as etree >>> xml_str = "David123-4567" >>> xml = etree.XML(xml_str) Traceback (most recent call last): File "", line 1, in File "C:\Program Files\IronPython 2.6\Lib\xml\etree\ElementTree.py", line 962, in XML File "C:\Program Files\IronPython 2.6\Lib\xml\etree\ElementTree.py", line 1117 , in __init__ ImportError: No module named expat; use SimpleXMLTreeBuilder instead >>> xml = etree.fromstring(xml_str) Traceback (most recent call last): File "", line 1, in File "C:\Program Files\IronPython 2.6\Lib\xml\etree\ElementTree.py", line 962, in XML File "C:\Program Files\IronPython 2.6\Lib\xml\etree\ElementTree.py", line 1117 , in __init__ ImportError: No module named expat; use SimpleXMLTreeBuilder instead >>> * So both XML and fromstring fail to parse the xml string. Is this a bug? -------------- next part -------------- An HTML attachment was scrubbed... URL: From matt at tplus1.com Fri Jun 18 20:56:10 2010 From: matt at tplus1.com (W. Matthew Wilson) Date: Fri, 18 Jun 2010 14:56:10 -0400 Subject: [IronPython] ElementTree bug? In-Reply-To: References: Message-ID: On Fri, Jun 18, 2010 at 2:51 PM, David Escobar wrote: > Hi everyone, > There seems to be an inconsistency in the ElementTree class between CPython > and IronPython. Haha -- yeah, the cpython one works. The problem seems to be that there's no expat module available to IronPython. The traceback message says to try SimpleXMLTreeBuilder, but I couldn't import that one successfully either. Matt -- W. Matthew Wilson matt at tplus1.com http://tplus1.com From yngipy at gmail.com Sat Jun 19 06:50:40 2010 From: yngipy at gmail.com (yngipy hernan) Date: Fri, 18 Jun 2010 23:50:40 -0500 Subject: [IronPython] UI Automation: Wrong values for ControlType, AutomationElementID and more. IronPython 2.6.1 In-Reply-To: <4C1B3777.9060101@bakalari.cz> References: <279FB2C5A55A4A4DBAD10C001903701C07BAB807@server-b.kratzer.lan> <4C1B3777.9060101@bakalari.cz> Message-ID: This is what I am doing currently. But I wished I can do all the fun in IronPython without using C#. On Fri, Jun 18, 2010 at 4:08 AM, Lukas Cenovsky wrote: > Just an idea - create a proxy in C# that calls > TreeWalker.ControlViewWalker.GetFirstChild and other methods for you and > return you the results. Maybe it will work. The similar way I created the C# > proxy to access Win32API functions ( > http://gui-at.blogspot.com/2008/07/simulate-users-input.html) > > -- > -- Luk?? > > > yngipy hernan wrote: > > I have been playing around UI Automation and IronPython for several days > now. My impression is that they don't play each other well. Or maybe I > missed something. > > I am trying to dig deeper to understand why..... > > Probably this issue is not fixed yet? > http://blogs.msdn.com/b/shrib/archive/2008/03/24/ironpython-cannot-call-automationelement-fromhandle.aspx > > > On Wed, Jun 16, 2010 at 3:32 AM, Stanger, Wolfram < > Wolfram.Stanger at kratzer-automation.com> wrote: > >> Hello to all, >> >> over many years I have forced to implement a test automation scenerie in >> our company. >> Now they will do it and - who hat thougth that - I've got the job! And I >> had to bring the job to success! >> >> My Environment: >> ------------------------ >> I've succesfully presented a test automation solution only build from Internet-Software. >> It includes: >> >> Keyword-Driven Tables in HTML (done with Winword) >> ! >> Python 2.6 >> ! >> Robot-Framework >> ! ! >> ApplTestlib.py SeleniumLibrary >> ! ! >> pyWinAuto WEB-AppToTest >> ! >> WIN32-AppToTest >> >> Later we will embed the solution in a QAtrac process. >> >> Now it's time to test automate GUIs build from Windows-Forms and WPF too. >> >> First I switched Python 2.6 to IronPython 2.6[and 2.6.1 RC1] and got only >> one, but 'very magic', bug in Robot-Framework when creating the >> HTML-Report-File. >> Second I'm switched the pyWinAuto-Layer to Miscrosoft UI Automation (.NET >> >= 3.0) to support all GUI-Frameworks (WIN32, WINFORMS and WPF) >> >> I. In IronPython all UI Automation values ControlTypePropertys (w/o the >> window itself) where Type 'panel'. Other values are also not the same as >> you can see >> with UISpy or UIA Verify (Tool from Codeplex 'white'-Project). The >> AutomationIDs has the values from NativeWindowHandles (unique - but never >> the same from run to run!). >> Only the NamePropertys are OK but often empty (when control has no text >> content yet). >> >> II. All Controls in the window title (titlebar, menubar, menuitems, and >> min-, max- and close-Button) where completely hidden in Automation-Tree >> (I've tested with Raw-, Control- and ContentViews)! These eight controls are >> from IronPython-UI Automation not reachable. This may be a consequence from >> point I. above. >> >> In this situation it's unpossible for me to identify Controls in the >> application to automate! >> >> I have found, I run in exactly the same problems witch where reported >> from Jozef in November 2009: >> >> http://lists.ironpython.com/pipermail/users-ironpython.com/2009-November/011583.html >> >> and heself stated a own solution in >> >> http://lists.ironpython.com/pipermail/users-ironpython.com/2009-November/011630.html >> >> The solution reads: >> >> 'Thanks for your response. >> Solution to my problem is to first instantiate AutomationElement from dll, >> not from IronPython. >> Then all subsequent AutomationElement retrieved from IronPython looks ok.' >> >> About 30 years I have programmed in ANSI-C (Same SW on Windows,VMS, Linux, >> etc.) but now being a newbie to C#, .NET and Python. >> >> Therefore I should have an (syntax-)example for the expression: >> 'to first instantiate AutomationElement from dll' >> >> Witch DLL (Own written, .NET-DLL. ??) >> How to instantiate in C#? >> How to transport the AutomationElement to IronPython? >> >> The best will be if jozef.a... will give me some example lines of code >> from his solution in nov 2009 in C# and/or Python. Thanks. >> >> Greetings >> Wolfram >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://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 davidescobar at ieee.org Sat Jun 19 08:58:14 2010 From: davidescobar at ieee.org (David Escobar) Date: Fri, 18 Jun 2010 23:58:14 -0700 Subject: [IronPython] ElementTree bug? In-Reply-To: References: Message-ID: So is this a known bug, or is expat one of the C-based extension modules that IronPython doesn't handle yet? On Fri, Jun 18, 2010 at 11:56 AM, W. Matthew Wilson wrote: > On Fri, Jun 18, 2010 at 2:51 PM, David Escobar > wrote: > > Hi everyone, > > There seems to be an inconsistency in the ElementTree class between > CPython > > and IronPython. > > Haha -- yeah, the cpython one works. The problem seems to be that > there's no expat module available to IronPython. > > The traceback message says to try SimpleXMLTreeBuilder, but I couldn't > import that one successfully either. > > Matt > > > -- > W. Matthew Wilson > matt at tplus1.com > http://tplus1.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 Sat Jun 19 11:01:51 2010 From: sanxiyn at gmail.com (Seo Sanghyeon) Date: Sat, 19 Jun 2010 18:01:51 +0900 Subject: [IronPython] ElementTree bug? In-Reply-To: References: Message-ID: 2010/6/19 David Escobar : > So is this a known bug, or is expat one of the C-based extension modules > that IronPython doesn't handle yet? expat is one of C-based extension modules that IronPython doesn't handle yet. On the other hand, here is my implementation that works with ElementTree: https://fepy.svn.sourceforge.net/svnroot/fepy/trunk/lib/pyexpat.py Put it on any sys.path directory. -- Seo Sanghyeon From yngipy at gmail.com Sun Jun 20 06:23:27 2010 From: yngipy at gmail.com (yngipy hernan) Date: Sat, 19 Jun 2010 23:23:27 -0500 Subject: [IronPython] UI Automation: Wrong values for ControlType, AutomationElementID and more. IronPython 2.6.1 In-Reply-To: References: <279FB2C5A55A4A4DBAD10C001903701C07BAB807@server-b.kratzer.lan> <4C1B3777.9060101@bakalari.cz> Message-ID: Ok, I have a sample project how to use UI Automation with IronPython, see : http://pyas.svn.sourceforge.net/viewvc/pyas/trunk/src/ipr/ Basically, I have to : Create a really simple DLL using C# that reports the root element. That's it. Regards, Yngipy On Fri, Jun 18, 2010 at 11:50 PM, yngipy hernan wrote: > This is what I am doing currently. But I wished I can do all the fun in > IronPython without using C#. > > > On Fri, Jun 18, 2010 at 4:08 AM, Lukas Cenovsky wrote: > >> Just an idea - create a proxy in C# that calls >> TreeWalker.ControlViewWalker.GetFirstChild and other methods for you and >> return you the results. Maybe it will work. The similar way I created the C# >> proxy to access Win32API functions ( >> http://gui-at.blogspot.com/2008/07/simulate-users-input.html) >> >> -- >> -- Luk?? >> >> >> yngipy hernan wrote: >> >> I have been playing around UI Automation and IronPython for several days >> now. My impression is that they don't play each other well. Or maybe I >> missed something. >> >> I am trying to dig deeper to understand why..... >> >> Probably this issue is not fixed yet? >> http://blogs.msdn.com/b/shrib/archive/2008/03/24/ironpython-cannot-call-automationelement-fromhandle.aspx >> >> >> On Wed, Jun 16, 2010 at 3:32 AM, Stanger, Wolfram < >> Wolfram.Stanger at kratzer-automation.com> wrote: >> >>> Hello to all, >>> >>> over many years I have forced to implement a test automation scenerie in >>> our company. >>> Now they will do it and - who hat thougth that - I've got the job! And I >>> had to bring the job to success! >>> >>> My Environment: >>> ------------------------ >>> I've succesfully presented a test automation solution only build from Internet-Software. >>> It includes: >>> >>> Keyword-Driven Tables in HTML (done with Winword) >>> ! >>> Python 2.6 >>> ! >>> Robot-Framework >>> ! ! >>> ApplTestlib.py SeleniumLibrary >>> ! ! >>> pyWinAuto WEB-AppToTest >>> ! >>> WIN32-AppToTest >>> >>> Later we will embed the solution in a QAtrac process. >>> >>> Now it's time to test automate GUIs build from Windows-Forms and WPF too. >>> >>> First I switched Python 2.6 to IronPython 2.6[and 2.6.1 RC1] and got only >>> one, but 'very magic', bug in Robot-Framework when creating the >>> HTML-Report-File. >>> Second I'm switched the pyWinAuto-Layer to Miscrosoft UI Automation (.NET >>> >= 3.0) to support all GUI-Frameworks (WIN32, WINFORMS and WPF) >>> >>> I. In IronPython all UI Automation values ControlTypePropertys (w/o the >>> window itself) where Type 'panel'. Other values are also not the same as >>> you can see >>> with UISpy or UIA Verify (Tool from Codeplex 'white'-Project). The >>> AutomationIDs has the values from NativeWindowHandles (unique - but never >>> the same from run to run!). >>> Only the NamePropertys are OK but often empty (when control has no text >>> content yet). >>> >>> II. All Controls in the window title (titlebar, menubar, menuitems, and >>> min-, max- and close-Button) where completely hidden in Automation-Tree >>> (I've tested with Raw-, Control- and ContentViews)! These eight controls are >>> from IronPython-UI Automation not reachable. This may be a consequence from >>> point I. above. >>> >>> In this situation it's unpossible for me to identify Controls in the >>> application to automate! >>> >>> I have found, I run in exactly the same problems witch where reported >>> from Jozef in November 2009: >>> >>> http://lists.ironpython.com/pipermail/users-ironpython.com/2009-November/011583.html >>> >>> and heself stated a own solution in >>> >>> http://lists.ironpython.com/pipermail/users-ironpython.com/2009-November/011630.html >>> >>> The solution reads: >>> >>> 'Thanks for your response. >>> Solution to my problem is to first instantiate AutomationElement from >>> dll, not from IronPython. >>> Then all subsequent AutomationElement retrieved from IronPython looks >>> ok.' >>> >>> About 30 years I have programmed in ANSI-C (Same SW on Windows,VMS, >>> Linux, etc.) but now being a newbie to C#, .NET and Python. >>> >>> Therefore I should have an (syntax-)example for the expression: >>> 'to first instantiate AutomationElement from dll' >>> >>> Witch DLL (Own written, .NET-DLL. ??) >>> How to instantiate in C#? >>> How to transport the AutomationElement to IronPython? >>> >>> The best will be if jozef.a... will give me some example lines of code >>> from his solution in nov 2009 in C# and/or Python. Thanks. >>> >>> Greetings >>> Wolfram >>> >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://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 glitch17 at gmail.com Sun Jun 20 06:51:26 2010 From: glitch17 at gmail.com (Ross Hammermeister) Date: Sun, 20 Jun 2010 00:51:26 -0400 Subject: [IronPython] Modules in hosted enviroment Message-ID: I have a project where I am hosting IronPython and I was wondering what is the best way to create modules in C# for python to use. I have found two ways to do it so far. One method is what is done in IronPython, where static classes and the PythonModule attribute are used but I don't want to use static classes to access runtime data. The other method I found was to use the module class and add all my functions, sub-modules and other data to the dictionary but this is painful to setup and I don't know how to over load functions I add to the dictionary. Is there another method I can use to create modules or am I over looking something in one of the methods I found? Thanks for the help -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidescobar at ieee.org Sun Jun 20 07:45:47 2010 From: davidescobar at ieee.org (David Escobar) Date: Sat, 19 Jun 2010 22:45:47 -0700 Subject: [IronPython] ElementTree bug? In-Reply-To: References: Message-ID: Good to know. Thank you! On Sat, Jun 19, 2010 at 2:01 AM, Seo Sanghyeon wrote: > 2010/6/19 David Escobar : > > So is this a known bug, or is expat one of the C-based extension modules > > that IronPython doesn't handle yet? > > expat is one of C-based extension modules that IronPython doesn't handle > yet. > > On the other hand, here is my implementation that works with ElementTree: > https://fepy.svn.sourceforge.net/svnroot/fepy/trunk/lib/pyexpat.py > > Put it on any sys.path directory. > > -- > Seo Sanghyeon > -------------- next part -------------- An HTML attachment was scrubbed... URL: From merllab at microsoft.com Mon Jun 21 17:07:50 2010 From: merllab at microsoft.com (merllab at microsoft.com) Date: Mon, 21 Jun 2010 08:07:50 -0700 Subject: [IronPython] IronPython 2.6 CodePlex Source Update Message-ID: This is an automated email letting you know that sources have recently been pushed out. You can download these newer sources directly from http://ironpython.codeplex.com/SourceControl/changeset/view/70538. MODIFIED SOURCES $/IronPython/IronPython_Main/Hosts/Silverlight/Microsoft.Scripting.SilverLight/Microsoft.Scripting.Silverlight.csproj $/IronPython/IronPython_Main/Languages/IronPython/IronPython/IronPython.csproj $/IronPython/IronPython_Main/Languages/IronPython/IronPython.Modules/IronPython.Modules.csproj $/IronPython/IronPython_Main/Languages/IronPython/Tests/test_conditional.py $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Ast/IfStatement.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPythonTest/IronPythonTest.csproj $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Utils/ReflectionUtils.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting.Debugging/Microsoft.Scripting.Debugging.csproj $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Microsoft.Dynamic.csproj $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Interpreter/Instructions/CallInstruction.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting/Microsoft.Scripting.csproj $/IronPython/IronPython_Main/Test/ClrAssembly/ClrAssembly.csproj CHECKIN COMMENTS -------------------------------------------------------------------------------- Changeset Id: 1875191 Date: 6/18/2010 12:12:42 PM Fixes a stack overflow on 64-bit w/ deeply nested conditionals. When we have a large conditional we now generate If cond0: Body Goto end If cond1: Body Goto end else_body end: instead of: if cond0: body else: if cond1: body else: else_body That keeps the conditional flat so we don?t stack overflow. We still generate the old way for small conditionls because it?s simpler to construct. (Shelveset: FixStackOverflowFinal;REDMOND\dinov | SNAP CheckinId: 10949) From jdhardy at gmail.com Mon Jun 21 17:24:48 2010 From: jdhardy at gmail.com (Jeff Hardy) Date: Mon, 21 Jun 2010 09:24:48 -0600 Subject: [IronPython] Modules in hosted enviroment In-Reply-To: References: Message-ID: On Sat, Jun 19, 2010 at 10:51 PM, Ross Hammermeister wrote: > I have a project where I am hosting IronPython and I was wondering what is > the best way to create modules in C# for python to use. I have found two > ways to do it so far. One method?is what is done in IronPython,?where static > classes?and the PythonModule attribute are used?but I don't want to use > static classes to access runtime data. I'm not 100% sure what you mean here, but the static class is just a container - and it can contain non-static classes (and functions, and static variables, etc). If it needs to be a module, it's the way to go, as far as I'm concerned. If things get too big, don't forget that you can use partial classes to split things up. However, depending on what your code does, you probably don't need to make it a module - IronPython will work just fine with any .NET class library. Just do a `clr.AddReference` and then import the classes. - Jeff From glitch17 at gmail.com Tue Jun 22 16:41:30 2010 From: glitch17 at gmail.com (Ross Hammermeister) Date: Tue, 22 Jun 2010 10:41:30 -0400 Subject: [IronPython] Modules in hosted enviroment In-Reply-To: References: Message-ID: My program creates data for a python script to use and I though the best way for it get access to this was with modules. Simply setting a variable in the script would not work because of the complexity of the data. Using the clr module will not get access to the existing data (I also do not want to grant access to all the other libraries). So I am left with creating a module but using a static class and assigning all the instances to the static classes every time before I call the python script is not a great method but I'm thinking this would be the best at this point. The other method I found was using the IronPython.Runtime.PythonModule class and Creating an instance for each of my modules and adding to using PythonEngine.Runtime.Globals.SetVariable The procedure to do this doesn't give the impression that what I'm doing was ever intended and I have hit things that I cannot do using this method. So I'm looking for a good method of creating modules that would have my data attached to them. Thanks Ross -------------------------------------------------- From: "Jeff Hardy" Sent: Monday, June 21, 2010 11:24 AM To: "Discussion of IronPython" Subject: Re: [IronPython] Modules in hosted enviroment > On Sat, Jun 19, 2010 at 10:51 PM, Ross Hammermeister > wrote: >> I have a project where I am hosting IronPython and I was wondering what >> is >> the best way to create modules in C# for python to use. I have found two >> ways to do it so far. One method is what is done in IronPython, where >> static >> classes and the PythonModule attribute are used but I don't want to use >> static classes to access runtime data. > > I'm not 100% sure what you mean here, but the static class is just a > container - and it can contain non-static classes (and functions, and > static variables, etc). If it needs to be a module, it's the way to > go, as far as I'm concerned. If things get too big, don't forget that > you can use partial classes to split things up. > > However, depending on what your code does, you probably don't need to > make it a module - IronPython will work just fine with any .NET class > library. Just do a `clr.AddReference` and then import the classes. > > - Jeff > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From jdhardy at gmail.com Tue Jun 22 17:26:48 2010 From: jdhardy at gmail.com (Jeff Hardy) Date: Tue, 22 Jun 2010 09:26:48 -0600 Subject: [IronPython] Modules in hosted enviroment In-Reply-To: References: Message-ID: Hi Ross, Sorry if I'm being dense, but here's how I understand what you're doing: - you're hosting IronPython in some program X - X will generate data D and somehow feed D to Python script Y - Y will transform or process D in some way What you're looking for is the best way to get D into Y, correct? I think creating a module is the wrong way to go about this; modules are supposed to contain code and constant data, as the IronPython engine will only load them once and share them. Why is setting a variable for the Python script to use not suitable? If it needs to be a complex object, you can create a (non-static) class in C#, fill it out, and pass an instance to the Python script using ScriptScope.SetVariable. - Jeff On Tue, Jun 22, 2010 at 8:41 AM, Ross Hammermeister wrote: > My program creates data for a python script to use and I though the best way > for it get access to this was with modules. Simply setting a variable in the > script would not work because of the complexity of the data. Using the clr > module will not get access to the existing data (I also do not want to grant > access to all the other libraries). So I am left with creating a module but > using a static class and assigning all the instances to the static classes > every time before I call the python script is not a great method but I'm > thinking this would be the best at this point. The other method I found was > using the IronPython.Runtime.PythonModule class and Creating an instance for > each of my modules and adding to using > PythonEngine.Runtime.Globals.SetVariable The procedure to do this doesn't > give the impression that what I'm doing was ever intended and I have hit > things that I cannot do using this method. So I'm looking for a good method > of creating modules that would have my data attached to them. > > Thanks > Ross > > -------------------------------------------------- > From: "Jeff Hardy" > Sent: Monday, June 21, 2010 11:24 AM > To: "Discussion of IronPython" > Subject: Re: [IronPython] Modules in hosted enviroment > >> On Sat, Jun 19, 2010 at 10:51 PM, Ross Hammermeister >> wrote: >>> >>> I have a project where I am hosting IronPython and I was wondering what >>> is >>> the best way to create modules in C# for python to use. I have found two >>> ways to do it so far. One method is what is done in IronPython, where >>> static >>> classes and the PythonModule attribute are used but I don't want to use >>> static classes to access runtime data. >> >> I'm not 100% sure what you mean here, but the static class is just a >> container - and it can contain non-static classes (and functions, and >> static variables, etc). If it needs to be a module, it's the way to >> go, as far as I'm concerned. If things get too big, don't forget that >> you can use partial classes to split things up. >> >> However, depending on what your code does, you probably don't need to >> make it a module - IronPython will work just fine with any .NET class >> library. Just do a `clr.AddReference` and then import the classes. >> >> - 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 dinov at microsoft.com Tue Jun 22 18:58:48 2010 From: dinov at microsoft.com (Dino Viehland) Date: Tue, 22 Jun 2010 16:58:48 +0000 Subject: [IronPython] Modules in hosted enviroment In-Reply-To: References: Message-ID: <1A472770E042064698CB5ADC83A12ACD48A69EB8@TK5EX14MBXC118.redmond.corp.microsoft.com> Alternately you could implement IAttributesCollection and execute the Python code against a scope which is backed by the IAC. This would let you lazily provide the values to the script on-demand. If you have a fixed set of members I like Jeff's suggestion more but this is good if the members are being generated dynamically. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Jeff Hardy > Sent: Tuesday, June 22, 2010 8:27 AM > To: Discussion of IronPython > Subject: Re: [IronPython] Modules in hosted enviroment > > Hi Ross, > Sorry if I'm being dense, but here's how I understand what you're doing: > > - you're hosting IronPython in some program X > - X will generate data D and somehow feed D to Python script Y > - Y will transform or process D in some way > > What you're looking for is the best way to get D into Y, correct? > > I think creating a module is the wrong way to go about this; modules > are supposed to contain code and constant data, as the IronPython > engine will only load them once and share them. > > Why is setting a variable for the Python script to use not suitable? > If it needs to be a complex object, you can create a (non-static) > class in C#, fill it out, and pass an instance to the Python script > using ScriptScope.SetVariable. > > - Jeff > > On Tue, Jun 22, 2010 at 8:41 AM, Ross Hammermeister > wrote: > > My program creates data for a python script to use and I though the best way > > for it get access to this was with modules. Simply setting a variable in the > > script would not work because of the complexity of the data. Using the clr > > module will not get access to the existing data (I also do not want to grant > > access to all the other libraries). So I am left with creating a module but > > using a static class and assigning all the instances to the static classes > > every time before I call the python script is not a great method but I'm > > thinking this would be the best at this point. The other method I found was > > using the IronPython.Runtime.PythonModule class and Creating an instance for > > each of my modules and adding to using > > PythonEngine.Runtime.Globals.SetVariable The procedure to do this doesn't > > give the impression that what I'm doing was ever intended and I have hit > > things that I cannot do using this method. So I'm looking for a good method > > of creating modules that would have my data attached to them. > > > > Thanks > > Ross > > > > -------------------------------------------------- > > From: "Jeff Hardy" > > Sent: Monday, June 21, 2010 11:24 AM > > To: "Discussion of IronPython" > > Subject: Re: [IronPython] Modules in hosted enviroment > > > >> On Sat, Jun 19, 2010 at 10:51 PM, Ross Hammermeister > >> wrote: > >>> > >>> I have a project where I am hosting IronPython and I was wondering what > >>> is > >>> the best way to create modules in C# for python to use. I have found two > >>> ways to do it so far. One method is what is done in IronPython, where > >>> static > >>> classes and the PythonModule attribute are used but I don't want to use > >>> static classes to access runtime data. > >> > >> I'm not 100% sure what you mean here, but the static class is just a > >> container - and it can contain non-static classes (and functions, and > >> static variables, etc). If it needs to be a module, it's the way to > >> go, as far as I'm concerned. If things get too big, don't forget that > >> you can use partial classes to split things up. > >> > >> However, depending on what your code does, you probably don't need to > >> make it a module - IronPython will work just fine with any .NET class > >> library. Just do a `clr.AddReference` and then import the classes. > >> > >> - Jeff > >> _______________________________________________ > >> Users mailing list > >> Users at lists.ironpython.com > >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > >> > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From kuno.meyer at gmx.ch Tue Jun 22 19:07:47 2010 From: kuno.meyer at gmx.ch (Kuno Meyer) Date: Tue, 22 Jun 2010 19:07:47 +0200 Subject: [IronPython] -X:PassExceptions Message-ID: <4C20EDE3.20405@gmx.ch> Hi all In order to see the full stack traces, I'd like to have -X:PassExceptions set for all my scripts. Is there a way to set this from *inside* a running script? Thanks Kuno From glitch17 at gmail.com Tue Jun 22 18:39:33 2010 From: glitch17 at gmail.com (Ross Hammermeister) Date: Tue, 22 Jun 2010 12:39:33 -0400 Subject: [IronPython] Modules in hosted enviroment In-Reply-To: References: Message-ID: <1559C156EE5A42369BC356CCA72586E9@rossha> You are correct about what I'm trying to do, sorry if wrote it in a way that was hard to understand. The project I'm working on this for is a 2-D game engine. I plan on calling python functions from C# with the relevant class (say on a collision with the colliding objects as parameters) but if extra data is needed about other items it can retrieve the list of them and these python function will need to execute quickly. With modules I can make different ways to access the wrapper classes I have made because in have the internal structure and can retrieve smaller sets based off whet the script calls and it won't need to pick through it or if it does the set would not be as big. I also want to maintain backwards compatibility as I add more functionality and if I set variables I worried about a script already using the variable and I use one class it would probably have a very large hierarchy or lots of unrelated functions which I want to avoid passing into python. An unrelated issue I have with ScriptScope is I can't figure out to add overloaded functions with different parameter counts for defaults I'm using 3.5 if it matters. Thanks Ross -------------------------------------------------- From: "Jeff Hardy" Sent: Tuesday, June 22, 2010 11:26 AM To: "Discussion of IronPython" Subject: Re: [IronPython] Modules in hosted enviroment > Hi Ross, > Sorry if I'm being dense, but here's how I understand what you're doing: > > - you're hosting IronPython in some program X > - X will generate data D and somehow feed D to Python script Y > - Y will transform or process D in some way > > What you're looking for is the best way to get D into Y, correct? > > I think creating a module is the wrong way to go about this; modules > are supposed to contain code and constant data, as the IronPython > engine will only load them once and share them. > > Why is setting a variable for the Python script to use not suitable? > If it needs to be a complex object, you can create a (non-static) > class in C#, fill it out, and pass an instance to the Python script > using ScriptScope.SetVariable. > > - Jeff > > On Tue, Jun 22, 2010 at 8:41 AM, Ross Hammermeister > wrote: >> My program creates data for a python script to use and I though the best >> way >> for it get access to this was with modules. Simply setting a variable in >> the >> script would not work because of the complexity of the data. Using the >> clr >> module will not get access to the existing data (I also do not want to >> grant >> access to all the other libraries). So I am left with creating a module >> but >> using a static class and assigning all the instances to the static >> classes >> every time before I call the python script is not a great method but I'm >> thinking this would be the best at this point. The other method I found >> was >> using the IronPython.Runtime.PythonModule class and Creating an instance >> for >> each of my modules and adding to using >> PythonEngine.Runtime.Globals.SetVariable The procedure to do this doesn't >> give the impression that what I'm doing was ever intended and I have hit >> things that I cannot do using this method. So I'm looking for a good >> method >> of creating modules that would have my data attached to them. >> >> Thanks >> Ross >> >> -------------------------------------------------- >> From: "Jeff Hardy" >> Sent: Monday, June 21, 2010 11:24 AM >> To: "Discussion of IronPython" >> Subject: Re: [IronPython] Modules in hosted enviroment >> >>> On Sat, Jun 19, 2010 at 10:51 PM, Ross Hammermeister >>> >>> wrote: >>>> >>>> I have a project where I am hosting IronPython and I was wondering what >>>> is >>>> the best way to create modules in C# for python to use. I have found >>>> two >>>> ways to do it so far. One method is what is done in IronPython, where >>>> static >>>> classes and the PythonModule attribute are used but I don't want to use >>>> static classes to access runtime data. >>> >>> I'm not 100% sure what you mean here, but the static class is just a >>> container - and it can contain non-static classes (and functions, and >>> static variables, etc). If it needs to be a module, it's the way to >>> go, as far as I'm concerned. If things get too big, don't forget that >>> you can use partial classes to split things up. >>> >>> However, depending on what your code does, you probably don't need to >>> make it a module - IronPython will work just fine with any .NET class >>> library. Just do a `clr.AddReference` and then import the classes. >>> >>> - Jeff >>> _______________________________________________ >>> Users mailing list >>> Users at lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From marcusvfcarvalho at gmail.com Tue Jun 22 19:54:44 2010 From: marcusvfcarvalho at gmail.com (Marcus Carvalho) Date: Tue, 22 Jun 2010 14:54:44 -0300 Subject: [IronPython] TryGetMember is called for methods instead of TryInvokeMember Message-ID: I have an application that passes a DynamicObject to an IronPython script. The class works perfectly in C# but when a method is invoked inside a IronPython script the TryGetMember is called instead of TryInvokeMember and if I try to return a value through TryGetMember I get an exception saying that the member is not callable. I found a user with similar problem ( http://social.msdn.microsoft.com/Forums/en/dlr/thread/0556e593-2360-43b8-97e5-201c3c3ce1c5). He said that dowloading the latest release solved the problem. I have downloaded the latest source code release (70538), compiled it to .NET 4.0, but I still having the issue. Here is a slightly modified code I get from the post, that does not work for me: using System; using System.Collections.Generic; using System.Linq; using System.Text; using IronPython.Hosting; using IronPython.Runtime; using Microsoft.Scripting; using Microsoft.Scripting.Hosting; using System.Dynamic; namespace TestDynamicInvokeFromPython { class Program { static void Main(string[] args) { dynamic myDynamicObject = new MyDynamicObject(); //first tey calling this object from C#, it should call Foo() and they try to call MissingMethod(); Console.WriteLine("C# Test..."); try { myDynamicObject.Foo(); System.Console.WriteLine("Method Result: " + myDynamicObject.MissingMethod()); } catch (Exception ex) { Console.WriteLine("Got C# exception: " + ex.Message); } ScriptEngine pythonEngine = Python.CreateEngine(); ScriptScope scriptScope = pythonEngine.CreateScope(); string pythonScript = SetPythonScript(); ScriptSource script = pythonEngine.CreateScriptSourceFromString(pythonScript, SourceCodeKind .Statements); scriptScope.SetVariable("myDynamicObject", myDynamicObject); //Now do the same thing from python, I expect to get the same behaviour as from C# (but I don't) Console.WriteLine("\r\nScript Test..."); try { script.Execute(scriptScope); } catch (Exception ex) { Console.WriteLine("Got script exception: " + ex.Message); } Console.ReadKey(); } static string SetPythonScript() { string s = ""; s += "import clr" + "\r\n"; s += "clr.AddReference('mscorlib')" + "\r\n"; s += "myDynamicObject.Foo();" + "\r\n"; s += "myDynamicObject.MissingMethod();" + "\r\n"; return s; } } public class MyDynamicObject : DynamicObject { public void Foo() { Console.WriteLine("Foo() Called"); } public override DynamicMetaObject GetMetaObject(System.Linq.Expressions. Expression parameter) { Console.WriteLine("GetMetaObject() Called"); return base.GetMetaObject(parameter); } public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result) { if (binder.Name == "MissingMethod") { result = "Method Found"; return true; } else { result = null; return false; } } public override bool TryGetMember(GetMemberBinder binder, out object result) { Console.WriteLine("TryGetMember() Called"); return base.TryGetMember(binder, out result); } //#region AllOtherOverridees // ... //#endregion //AllOtherOverridees } } Marcus Carvalho -------------- next part -------------- An HTML attachment was scrubbed... URL: From ecullen at fibertel.com.ar Tue Jun 22 20:44:37 2010 From: ecullen at fibertel.com.ar (Ernesto Cullen) Date: Tue, 22 Jun 2010 15:44:37 -0300 Subject: [IronPython] changes in COM access from IronPython 1.1 Message-ID: <4C210495.6040702@fibertel.com.ar> hi all, we have a problem with a project after updating it to IPy 2.6.1. We need to use a COM library; we add the reference in VS which creates the interop.XXX file. In IPy v1.1 we could access the imported types directly, like LN_AclEntry = LN_dbACL.GetEntry(entryName) if (LN_AclEntry == None): DebugMessage("%s entry does not exist in database: %s" %(entryName, databaseName)) else: if (LN_AclEntry.Level >= ACLLEVEL.ACLLEVEL_DESIGNER): ... the important line here is the last one: in IPy 1.1, LN_AclEntry is an instance of LN_AclEntry {Domino.NotesACLEntryClass}. In IPy 2.6.1, this same variable is of type LN_AclEntry {System.__ComObject}. This means we can't access Level property and compare with ACLLEVEL enumeration. Is there something we can do to get v1.1 behaviour back? If not, can we cast somehow the object to the correct type? Thanks in advance, Ernesto Cullen -------------- next part -------------- An HTML attachment was scrubbed... URL: From williamj at tenbase2.com Tue Jun 22 21:29:13 2010 From: williamj at tenbase2.com (William Johnston) Date: Tue, 22 Jun 2010 15:29:13 -0400 Subject: [IronPython] NLTK site-module in C# app? Message-ID: <001f01cb1241$32a37b20$97ea7160$@com> Hello, I can now import the NLTK from ipy.exe, but not from a C# application. How do I include site-modules in embedded Python C# apps? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdhardy at gmail.com Tue Jun 22 21:36:52 2010 From: jdhardy at gmail.com (Jeff Hardy) Date: Tue, 22 Jun 2010 13:36:52 -0600 Subject: [IronPython] NLTK site-module in C# app? In-Reply-To: <001f01cb1241$32a37b20$97ea7160$@com> References: <001f01cb1241$32a37b20$97ea7160$@com> Message-ID: On Tue, Jun 22, 2010 at 1:29 PM, William Johnston wrote: > How do I include site-modules in embedded Python C# apps? You probably want to use ScriptEngine.SetSearchPaths. It's equivalent to setting sys.path. - Jeff From williamj at tenbase2.com Tue Jun 22 22:47:53 2010 From: williamj at tenbase2.com (William Johnston) Date: Tue, 22 Jun 2010 16:47:53 -0400 Subject: [IronPython] NLTK site-module in C# app? In-Reply-To: References: <001f01cb1241$32a37b20$97ea7160$@com> Message-ID: <002301cb124c$30a14180$91e3c480$@com> Mr. Hardy: Thanks for your input. However, I am having difficulties finding your zlib dll from the DLLs directory. Could you also assist me on this? Thanks, William Johnston -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jeff Hardy Sent: Tuesday, June 22, 2010 3:37 PM To: Discussion of IronPython Subject: Re: [IronPython] NLTK site-module in C# app? On Tue, Jun 22, 2010 at 1:29 PM, William Johnston wrote: > How do I include site-modules in embedded Python C# apps? You probably want to use ScriptEngine.SetSearchPaths. It's equivalent to setting sys.path. - Jeff _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From jdhardy at gmail.com Wed Jun 23 00:28:04 2010 From: jdhardy at gmail.com (Jeff Hardy) Date: Tue, 22 Jun 2010 16:28:04 -0600 Subject: [IronPython] NLTK site-module in C# app? In-Reply-To: <002301cb124c$30a14180$91e3c480$@com> References: <001f01cb1241$32a37b20$97ea7160$@com> <002301cb124c$30a14180$91e3c480$@com> Message-ID: On Tue, Jun 22, 2010 at 2:47 PM, William Johnston wrote: > However, I am having difficulties finding your zlib dll from the DLLs > directory. I assume this is from a hosting application, correct? All you'll need to do is load the assembly from disk, and then load it into the engine: Assembly zlib = Assembly.LoadFile(@"path\to\IronPython.Zlib.dll"); engine.Runtime.LoadAssembly(zlib); Your hosted IronPython scripts should now be able to import zlib. The IronPython console gets all of the .dll files in the DLLs folder, loads them, and calls .LoadAssembly if the load succeeds. If you have many dlls to load, or you want users to be able to add them, you'll need to duplicate that part for your hosting application. - Jeff From jdhardy at gmail.com Wed Jun 23 00:30:04 2010 From: jdhardy at gmail.com (Jeff Hardy) Date: Tue, 22 Jun 2010 16:30:04 -0600 Subject: [IronPython] Modules in hosted enviroment In-Reply-To: <1559C156EE5A42369BC356CCA72586E9@rossha> References: <1559C156EE5A42369BC356CCA72586E9@rossha> Message-ID: Hi Ross, It sounds like you want Dino's suggestion IAttributesCollection, which will give you much more flexibility. I've never done that, but it looks fairly straightforward. > An unrelated issue I have with ScriptScope is I can't figure out to add > overloaded functions with different parameter counts for defaults I'm using > 3.5 if it matters. Dino? - Jeff From dinov at microsoft.com Wed Jun 23 00:56:39 2010 From: dinov at microsoft.com (Dino Viehland) Date: Tue, 22 Jun 2010 22:56:39 +0000 Subject: [IronPython] Modules in hosted enviroment In-Reply-To: References: <1559C156EE5A42369BC356CCA72586E9@rossha> Message-ID: <1A472770E042064698CB5ADC83A12ACD48A6EA7A@TK5EX14MBXC118.redmond.corp.microsoft.com> Jeff wrote: > Hi Ross, > It sounds like you want Dino's suggestion IAttributesCollection, which > will give you much more flexibility. I've never done that, but it > looks fairly straightforward. > > > An unrelated issue I have with ScriptScope is I can't figure out to add > > overloaded functions with different parameter counts for defaults I'm using > > 3.5 if it matters. > > Dino? I assume what you have here is a bunch of static methods declared somewhere and you want to publish them in the scope? The only way to really go about doing this is getting the BuiltinFunction object for them and then publishing that in the scope. To get the BF you'll need to first get the PythonType and then get the BF. Such as: public class MyObjectModel { public static void Foo() { } public static void Foo(object x) { } } Using C# 4.0 then I think you could do: dynamic foos = ((dynamic)DynamicHelpers.GetPythonTypeFromType(typeof(MyObjectModel))).Foo; or you could do: object foos = engine.Operations.GetMember(DynamicHelpers.GetPythonTypeFromType(typeof(MyObjectModel))), "Foo"); From dinov at microsoft.com Wed Jun 23 01:16:01 2010 From: dinov at microsoft.com (Dino Viehland) Date: Tue, 22 Jun 2010 23:16:01 +0000 Subject: [IronPython] TryGetMember is called for methods instead of TryInvokeMember In-Reply-To: References: Message-ID: <1A472770E042064698CB5ADC83A12ACD48A6EB43@TK5EX14MBXC118.redmond.corp.microsoft.com> Calling TryGetMember is actually the correct thing to do. Different languages have different semantics for when you do ?a.Foo();? Some languages turn this into an InvokeMember while other languages separate this out into a get and invoke. In Python we separate this out into a get and invoke but you could also get this behavior in C# by doing: dynamic x = a.Foo; x(); Which should also work. So you really need to support both GetMember and InvokeMember. The result of the GetMember is usually something which binds the instance to the member and then when it does whatever InvokeMember would have done. I believe the part about updating to the latest assemblies in the thread was about using the assemblies compiled for .NET 4.0 instead of the assemblies compiled for .NET 2.0 SP1+ which don?t work w/ dynamic in .NET 4.0. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Marcus Carvalho Sent: Tuesday, June 22, 2010 10:55 AM To: users at lists.ironpython.com Subject: [IronPython] TryGetMember is called for methods instead of TryInvokeMember I have an application that passes a DynamicObject to an IronPython script. The class works perfectly in C# but when a method is invoked inside a IronPython script the TryGetMember is called instead of TryInvokeMember and if I try to return a value through TryGetMember I get an exception saying that the member is not callable. I found a user with similar problem (http://social.msdn.microsoft.com/Forums/en/dlr/thread/0556e593-2360-43b8-97e5-201c3c3ce1c5). He said that dowloading the latest release solved the problem. I have downloaded the latest source code release (70538), compiled it to .NET 4.0, but I still having the issue. Here is a slightly modified code I get from the post, that does not work for me: using System; using System.Collections.Generic; using System.Linq; using System.Text; using IronPython.Hosting; using IronPython.Runtime; using Microsoft.Scripting; using Microsoft.Scripting.Hosting; using System.Dynamic; ? ? ? namespace TestDynamicInvokeFromPython { class Program { static void Main(string[] args) { dynamic myDynamicObject = new MyDynamicObject(); //first tey calling this object from C#, it should call Foo() and they try to call MissingMethod(); Console.WriteLine("C# Test..."); try { myDynamicObject.Foo(); System. Console.WriteLine("Method Result: " + myDynamicObject.MissingMethod()); } catch (Exception ex) { Console.WriteLine("Got C# exception: " + ex.Message); } ? ScriptEngine pythonEngine = Python.CreateEngine(); ScriptScope scriptScope = pythonEngine.CreateScope(); string pythonScript = SetPythonScript(); ScriptSource script = pythonEngine.CreateScriptSourceFromString(pythonScript, SourceCodeKind.Statements); scriptScope.SetVariable( "myDynamicObject", myDynamicObject); //Now do the same thing from python, I expect to get the same behaviour as from C# (but I don't) Console.WriteLine("\r\nScript Test..."); try { script.Execute(scriptScope); } catch (Exception ex) { Console.WriteLine("Got script exception: " + ex.Message); } ? Console.ReadKey(); } static string SetPythonScript() { string s = ""; s += "import clr" + "\r\n"; s += "clr.AddReference('mscorlib')" + "\r\n"; s += "myDynamicObject.Foo();" + "\r\n"; s += "myDynamicObject.MissingMethod();" + "\r\n"; return s; } } ? public class MyDynamicObject : DynamicObject { public void Foo() { Console.WriteLine("Foo() Called"); } public override DynamicMetaObject GetMetaObject(System.Linq.Expressions.Expression parameter) { Console.WriteLine("GetMetaObject() Called"); return base.GetMetaObject(parameter); } public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result) { if (binder.Name == "MissingMethod") { result = "Method Found"; return true; } else { result = null; return false; } } public override bool TryGetMember(GetMemberBinder binder, out object result) { Console.WriteLine("TryGetMember() Called"); return base.TryGetMember(binder, out result); } //#region AllOtherOverridees // ... //#endregion //AllOtherOverridees } } ? Marcus Carvalho? -------------- next part -------------- An HTML attachment was scrubbed... URL: From yngipy at gmail.com Wed Jun 23 09:03:19 2010 From: yngipy at gmail.com (yngipy hernan) Date: Wed, 23 Jun 2010 02:03:19 -0500 Subject: [IronPython] How to know "-X:FullFrames" Message-ID: Hi All, How would I know if _getframe is supported in sys module? From the blogosphere, you need to type -X:FullFrames to enable _getframe but I would like to detect if this is available or not in ipy script. Regards, Yngipy -------------- next part -------------- An HTML attachment was scrubbed... URL: From yngipy at gmail.com Wed Jun 23 09:06:58 2010 From: yngipy at gmail.com (yngipy hernan) Date: Wed, 23 Jun 2010 02:06:58 -0500 Subject: [IronPython] How to know "-X:FullFrames" In-Reply-To: References: Message-ID: Ok, I think I found it: import sys if hasattr(sys,'_getframe'): print "yes" On Wed, Jun 23, 2010 at 2:03 AM, yngipy hernan wrote: > Hi All, > > How would I know if _getframe is supported in sys module? From the > blogosphere, you need to type -X:FullFrames to enable _getframe but I would > like to detect if this is available or not in ipy script. > > Regards, > Yngipy > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ronnie.maor at gmail.com Wed Jun 23 14:38:19 2010 From: ronnie.maor at gmail.com (Ronnie Maor) Date: Wed, 23 Jun 2010 15:38:19 +0300 Subject: [IronPython] bug when overriding __delattr__ Message-ID: The following code works in CPython 2.6.2, but is broken in both IPy 2.6 and 2.6.1 >>> class A(object): ... def __delattr__(self,name): ... object.__delattr__(self,name) ... >>> a = A() >>> a.x = 3 >>> del a.x Traceback (most recent call last): File "", line 1, in File "", line 3, in __delattr__ AttributeError: 'A' object has no attribute 'x' -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Wed Jun 23 14:39:53 2010 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Wed, 23 Jun 2010 13:39:53 +0100 Subject: [IronPython] bug when overriding __delattr__ In-Reply-To: References: Message-ID: <4C220099.2000306@voidspace.org.uk> On 23/06/2010 13:38, Ronnie Maor wrote: > The following code works in CPython 2.6.2, but is broken in both IPy > 2.6 and 2.6.1 > > >>> class A(object): > ... def __delattr__(self,name): > ... object.__delattr__(self,name) > ... > >>> a = A() > >>> a.x = 3 > >>> del a.x > Traceback (most recent call last): > File "", line 1, in > File "", line 3, in __delattr__ > AttributeError: 'A' object has no attribute 'x' > You are correct, but this has already been reported and is fixed on trunk. The fix will be in 2.6.2 which will hopefully be released soon... :-) All the best, Michael > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ronnie.maor at gmail.com Wed Jun 23 14:43:07 2010 From: ronnie.maor at gmail.com (Ronnie Maor) Date: Wed, 23 Jun 2010 15:43:07 +0300 Subject: [IronPython] bug when overriding __delattr__ In-Reply-To: <4C220099.2000306@voidspace.org.uk> References: <4C220099.2000306@voidspace.org.uk> Message-ID: cool On Wed, Jun 23, 2010 at 3:39 PM, Michael Foord wrote: > On 23/06/2010 13:38, Ronnie Maor wrote: > > The following code works in CPython 2.6.2, but is broken in both IPy 2.6 > and 2.6.1 > > >>> class A(object): > ... def __delattr__(self,name): > ... object.__delattr__(self,name) > ... > >>> a = A() > >>> a.x = 3 > >>> del a.x > Traceback (most recent call last): > File "", line 1, in > File "", line 3, in __delattr__ > AttributeError: 'A' object has no attribute 'x' > > > You are correct, but this has already been reported and is fixed on trunk. > The fix will be in 2.6.2 which will hopefully be released soon... :-) > > All the best, > > Michael > > > _______________________________________________ > Users mailing listUsers at lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > -- http://www.ironpythoninaction.com/http://www.voidspace.org.uk/blog > > READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (?BOGUS AGREEMENTS?) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer. > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From glitch17 at gmail.com Wed Jun 23 18:26:30 2010 From: glitch17 at gmail.com (Ross Hammermeister) Date: Wed, 23 Jun 2010 12:26:30 -0400 Subject: [IronPython] Modules in hosted enviroment In-Reply-To: <1A472770E042064698CB5ADC83A12ACD48A6EA7A@TK5EX14MBXC118.redmond.corp.microsoft.com> References: <1559C156EE5A42369BC356CCA72586E9@rossha> <1A472770E042064698CB5ADC83A12ACD48A6EA7A@TK5EX14MBXC118.redmond.corp.microsoft.com> Message-ID: <21A0DB1BD1C54554AD2B761DF4ACD9A8@rossha> This is almost what I want but I to pass and instance of a class(no static methods) and have python treat it as if it were static method. After re-evaluating what I want I can see why it might not be possible. So if it ends up that I can't do what I described I will use on of the many other methods indicated. Thanks for the help -------------------------------------------------- From: "Dino Viehland" Sent: Tuesday, June 22, 2010 6:56 PM To: "Discussion of IronPython" Subject: Re: [IronPython] Modules in hosted enviroment > Jeff wrote: >> Hi Ross, >> It sounds like you want Dino's suggestion IAttributesCollection, which >> will give you much more flexibility. I've never done that, but it >> looks fairly straightforward. >> >> > An unrelated issue I have with ScriptScope is I can't figure out to add >> > overloaded functions with different parameter counts for defaults I'm >> > using >> > 3.5 if it matters. >> >> Dino? > > I assume what you have here is a bunch of static methods declared > somewhere and > you want to publish them in the scope? The only way to really go about > doing > this is getting the BuiltinFunction object for them and then publishing > that > in the scope. To get the BF you'll need to first get the PythonType and > then > get the BF. Such as: > > public class MyObjectModel { > public static void Foo() { > } > > public static void Foo(object x) { > } > } > > Using C# 4.0 then I think you could do: > > dynamic foos = > ((dynamic)DynamicHelpers.GetPythonTypeFromType(typeof(MyObjectModel))).Foo; > > or you could do: > > object foos = > engine.Operations.GetMember(DynamicHelpers.GetPythonTypeFromType(typeof(MyObjectModel))), > "Foo"); > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From dinov at microsoft.com Wed Jun 23 18:35:40 2010 From: dinov at microsoft.com (Dino Viehland) Date: Wed, 23 Jun 2010 16:35:40 +0000 Subject: [IronPython] Modules in hosted enviroment In-Reply-To: <21A0DB1BD1C54554AD2B761DF4ACD9A8@rossha> References: <1559C156EE5A42369BC356CCA72586E9@rossha> <1A472770E042064698CB5ADC83A12ACD48A6EA7A@TK5EX14MBXC118.redmond.corp.microsoft.com> <21A0DB1BD1C54554AD2B761DF4ACD9A8@rossha> Message-ID: <1A472770E042064698CB5ADC83A12ACD48A74EB5@TK5EX14MBXC118.redmond.corp.microsoft.com> Are you trying to get rid of the "foo.Bar" or do you want the user to be typing something like "MyObjectModel.Bar"? Or are you just wanting the user to type "Bar"? You can just pass the instance of the class in and the user can dot through it and call methods on it - as far as they're concerned there's not much of a difference between static vs. instance - it's either dotting through the class name or the instance name. If you really want the user to just type "Bar" the good news is that you'll be able to do it in a future version. You'll just need to subclass DynamicObject and put a dictionary in it for storing additional attributes. Then you can add your methods to it and pass it as the storage for a scope. You can also override TryGetMember and then do the lazy lookup of attributes as well. Unfortunately it doesn't work right now in 2.6 due to a bug in IronPython (you get an exception saying __doc__ is readonly). It is fixed in the 2.7 branch though and I can look at backporting it to 2.6.x. This is the way we really want things to work going forward though - scopes are just dynamic objects. That will enable you to have thinks like static properties or fields which languages can bind to very tightly and get really high performance global variable lookups. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Ross Hammermeister > Sent: Wednesday, June 23, 2010 9:27 AM > To: Discussion of IronPython > Subject: Re: [IronPython] Modules in hosted enviroment > > This is almost what I want but I to pass and instance of a class(no static > methods) and have python treat it as if it were static method. After > re-evaluating what I want I can see why it might not be possible. So if it > ends up that I can't do what I described I will use on of the many other > methods indicated. > > Thanks for the help > > -------------------------------------------------- > From: "Dino Viehland" > Sent: Tuesday, June 22, 2010 6:56 PM > To: "Discussion of IronPython" > Subject: Re: [IronPython] Modules in hosted enviroment > > > Jeff wrote: > >> Hi Ross, > >> It sounds like you want Dino's suggestion IAttributesCollection, which > >> will give you much more flexibility. I've never done that, but it > >> looks fairly straightforward. > >> > >> > An unrelated issue I have with ScriptScope is I can't figure out to add > >> > overloaded functions with different parameter counts for defaults I'm > >> > using > >> > 3.5 if it matters. > >> > >> Dino? > > > > I assume what you have here is a bunch of static methods declared > > somewhere and > > you want to publish them in the scope? The only way to really go about > > doing > > this is getting the BuiltinFunction object for them and then publishing > > that > > in the scope. To get the BF you'll need to first get the PythonType and > > then > > get the BF. Such as: > > > > public class MyObjectModel { > > public static void Foo() { > > } > > > > public static void Foo(object x) { > > } > > } > > > > Using C# 4.0 then I think you could do: > > > > dynamic foos = > > ((dynamic)DynamicHelpers.GetPythonTypeFromType(typeof(MyObjectModel))).Foo; > > > > or you could do: > > > > object foos = > > > engine.Operations.GetMember(DynamicHelpers.GetPythonTypeFromType(typeof(MyObje > ctModel))), > > "Foo"); > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.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 twyatt at ppi.ca Wed Jun 23 18:37:21 2010 From: twyatt at ppi.ca (Tim P. Wyatt) Date: Wed, 23 Jun 2010 09:37:21 -0700 Subject: [IronPython] Tim Wyatt is out of the office Message-ID: I will be out of the office starting 23-06-2010 and will not return until 24-06-2010. I will be reviewing my email less frequently than usual. For urgent matters please contact the Vancouver Help Desk at 1-800-661-7712 (helpdesk at ppi.ca) From glitch17 at gmail.com Wed Jun 23 21:17:48 2010 From: glitch17 at gmail.com (Ross Hammermeister) Date: Wed, 23 Jun 2010 15:17:48 -0400 Subject: [IronPython] Modules in hosted enviroment In-Reply-To: <1A472770E042064698CB5ADC83A12ACD48A74EB5@TK5EX14MBXC118.redmond.corp.microsoft.com> References: <1559C156EE5A42369BC356CCA72586E9@rossha><1A472770E042064698CB5ADC83A12ACD48A6EA7A@TK5EX14MBXC118.redmond.corp.microsoft.com><21A0DB1BD1C54554AD2B761DF4ACD9A8@rossha> <1A472770E042064698CB5ADC83A12ACD48A74EB5@TK5EX14MBXC118.redmond.corp.microsoft.com> Message-ID: <9294BF886A0742499FC46AB25D947C73@rossha> I'm not following what you are saying there. I figure the easiest way for me to show what I want to do was give an example. The example shows everything I would like to do ignoring exceptions. The function returned from call python would be executed when certain events occurred in the program. The user script is what I would like to have and what I have to do to achieve this in C# doesn't really matter but if it could be as simple as what I have below it would be nice. I have gotten this to work right now by creating and filling out IronPython.Runtime.PythonModule 's dictionary to match the definition of each class then assigning it to the engine's globals. Even though I have it mostly working it is very unpleasant to deal with because I need to fill out everything the dictionary needs and I can't overload functions(thanks previous help from here I may be able to resolve this now). The code below will work right now if instead I set app to a variable in the script instead of a global but I would greatly prefer it to use imports. C# application class Program { // Other stuff here for program Action CallPython() { App app = new App(this); var engine = Python.CreateEngine(); engine.Runtime.Globals.SetVariable("app", app); var scope = engine.CreateScope(); // execute python script.... return scope.GetVariable("event"); } } class Wrapper { public int value { get; set; } public Wrapper(int i) { value = i; } } class Data { internal Data() { } public PythonType Class { get { return DynamicHelpers.GetPythonType(typeof(Wrapper)); } } public readonly int CONST = 5; } class App { private Data _data = new Data(); private Program _mainApp; internal App(object mainApp) { _mainApp = mainApp; } public int func() { return _mainApp.Offset; } public int func(int i) { return i - _mainApp.Offset; } public void action(Wrapper w) { _mainApp.AddItem(w.value); } public Data bar { get { return _data; } } } user script (python) from app import func, action from app.data import CONST, Class i = func(20) c = Class(CONST) c.value = i def event(a = 5): action(c) Thanks Ross -------------------------------------------------- From: "Dino Viehland" Sent: Wednesday, June 23, 2010 12:35 PM To: "Discussion of IronPython" Subject: Re: [IronPython] Modules in hosted enviroment > Are you trying to get rid of the "foo.Bar" or do you want the user to > be typing something like "MyObjectModel.Bar"? Or are you just wanting the > user to type "Bar"? You can just pass the instance of the class in and > the > user can dot through it and call methods on it - as far as they're > concerned > there's not much of a difference between static vs. instance - it's either > dotting through the class name or the instance name. > > If you really want the user to just type "Bar" the good news is that > you'll > be able to do it in a future version. You'll just need to subclass > DynamicObject and put a dictionary in it for storing additional > attributes. > Then you can add your methods to it and pass it as the storage for a > scope. > You can also override TryGetMember and then do the lazy lookup of > attributes > as well. > > Unfortunately it doesn't work right now in 2.6 due to a bug in IronPython > (you > get an exception saying __doc__ is readonly). It is fixed in the 2.7 > branch > though and I can look at backporting it to 2.6.x. This is the way we > really want > things to work going forward though - scopes are just dynamic objects. > That > will enable you to have thinks like static properties or fields which > languages > can bind to very tightly and get really high performance global variable > lookups. > >> -----Original Message----- >> From: users-bounces at lists.ironpython.com [mailto:users- >> bounces at lists.ironpython.com] On Behalf Of Ross Hammermeister >> Sent: Wednesday, June 23, 2010 9:27 AM >> To: Discussion of IronPython >> Subject: Re: [IronPython] Modules in hosted enviroment >> >> This is almost what I want but I to pass and instance of a class(no >> static >> methods) and have python treat it as if it were static method. After >> re-evaluating what I want I can see why it might not be possible. So if >> it >> ends up that I can't do what I described I will use on of the many other >> methods indicated. >> >> Thanks for the help >> >> -------------------------------------------------- >> From: "Dino Viehland" >> Sent: Tuesday, June 22, 2010 6:56 PM >> To: "Discussion of IronPython" >> Subject: Re: [IronPython] Modules in hosted enviroment >> >> > Jeff wrote: >> >> Hi Ross, >> >> It sounds like you want Dino's suggestion IAttributesCollection, which >> >> will give you much more flexibility. I've never done that, but it >> >> looks fairly straightforward. >> >> >> >> > An unrelated issue I have with ScriptScope is I can't figure out to >> >> > add >> >> > overloaded functions with different parameter counts for defaults >> >> > I'm >> >> > using >> >> > 3.5 if it matters. >> >> >> >> Dino? >> > >> > I assume what you have here is a bunch of static methods declared >> > somewhere and >> > you want to publish them in the scope? The only way to really go about >> > doing >> > this is getting the BuiltinFunction object for them and then publishing >> > that >> > in the scope. To get the BF you'll need to first get the PythonType >> > and >> > then >> > get the BF. Such as: >> > >> > public class MyObjectModel { >> > public static void Foo() { >> > } >> > >> > public static void Foo(object x) { >> > } >> > } >> > >> > Using C# 4.0 then I think you could do: >> > >> > dynamic foos = >> > ((dynamic)DynamicHelpers.GetPythonTypeFromType(typeof(MyObjectModel))).Foo; >> > >> > or you could do: >> > >> > object foos = >> > >> engine.Operations.GetMember(DynamicHelpers.GetPythonTypeFromType(typeof(MyObje >> ctModel))), >> > "Foo"); >> > _______________________________________________ >> > Users mailing list >> > Users at lists.ironpython.com >> > http://lists.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 merllab at microsoft.com Thu Jun 24 17:07:52 2010 From: merllab at microsoft.com (merllab at microsoft.com) Date: Thu, 24 Jun 2010 08:07:52 -0700 Subject: [IronPython] IronPython 2.6 CodePlex Source Update Message-ID: <4cc7dd99-a30d-4594-ba91-0b8f371f5984@tk5-exsmh-c101.redmond.corp.microsoft.com> This is an automated email letting you know that sources have recently been pushed out. You can download these newer sources directly from http://ironpython.codeplex.com/SourceControl/changeset/view/71134. ADDED SOURCES $/IronPython/IronPython_Main/Solutions/IronPython.sln DELETED SOURCES $/IronPython/IronPython_Main/Solutions/IronPython4.sln MODIFIED SOURCES $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Ast/PythonAst.cs $/IronPython/IronPython_Main/Config/Unsigned/App.config $/IronPython/IronPython_Main/Config/Signed/App.config $/IronPython/IronPython_Main/Readme.html $/IronPython/IronPython_Main/Solutions/IronPython.sln CHECKIN COMMENTS -------------------------------------------------------------------------------- Changeset Id: 1886481 Date: 6/23/2010 6:29:21 PM IronPython Readme: - we're no longer 2 times faster than CPython at PyStone. Only 37% with 2.6.1, although we did make massive improvements in PyBench and other benchmarks - it's been more than several years since .NET was standardized in ECMA - prefer IronPython.net over codeplex.com/IronPython now as IP's information site - NOTE: http://www.codeplex.com/wikipage?ProjectName=IronPython&title=Differences was never updated for IronPython 2.6 and we need something here for 2.7 in the future - .NET 4.0 is required for 2.7, not .NET 2.0 SP1 - sample ipy.exe interaction session output was incorrect for both 2.6 and 2.7. Updated - updated statement about what IronPython.sln generates in terms of assemblies. Specifically, I've removed dead assemblies and clarified that the list of assemblies is a subset of what's actually generated Removed all traces of IronPython4.sln. On that note, IronPython.sln is now a copy of the last version of IronPython4.sln. Removed CodePlex-DLR-Dev10.sln and CodePlex-DLR-VSExpress.sln. These serve no purpose now that CodePlex-DLR.sln can build both .NET 2.0 SP1 and .NET 4.0 variants of ipy.exe+ir.exe using different build configurations. (Shelveset: REMOVE_SLNS01;REDMOND\dfugate | SNAP CheckinId: 10992) From jdhardy at gmail.com Thu Jun 24 18:01:23 2010 From: jdhardy at gmail.com (Jeff Hardy) Date: Thu, 24 Jun 2010 10:01:23 -0600 Subject: [IronPython] IronPython 2.6 CodePlex Source Update In-Reply-To: <4cc7dd99-a30d-4594-ba91-0b8f371f5984@tk5-exsmh-c101.redmond.corp.microsoft.com> References: <4cc7dd99-a30d-4594-ba91-0b8f371f5984@tk5-exsmh-c101.redmond.corp.microsoft.com> Message-ID: > - .NET 4.0 is required for 2.7, not .NET 2.0 SP1 So does this mean there won't be a version of 2.7 for .NET 2.0? Fine by me - supporting both for 2.6 is a pain. - Jeff From dfugate at microsoft.com Thu Jun 24 19:37:47 2010 From: dfugate at microsoft.com (Dave Fugate) Date: Thu, 24 Jun 2010 17:37:47 +0000 Subject: [IronPython] IronPython 2.6 CodePlex Source Update In-Reply-To: References: <4cc7dd99-a30d-4594-ba91-0b8f371f5984@tk5-exsmh-c101.redmond.corp.microsoft.com> Message-ID: <32707103E022E74FA2BF41530F385A7C0F882927@TK5EX14MBXC127.redmond.corp.microsoft.com> That's our current thinking. Dave -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jeff Hardy Sent: Thursday, June 24, 2010 9:01 AM To: Discussion of IronPython Subject: Re: [IronPython] IronPython 2.6 CodePlex Source Update > - .NET 4.0 is required for 2.7, not .NET 2.0 SP1 So does this mean there won't be a version of 2.7 for .NET 2.0? Fine by me - supporting both for 2.6 is a pain. - Jeff _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at microsoft.com Thu Jun 24 19:56:33 2010 From: dinov at microsoft.com (Dino Viehland) Date: Thu, 24 Jun 2010 17:56:33 +0000 Subject: [IronPython] IronPython 2.6 CodePlex Source Update In-Reply-To: <32707103E022E74FA2BF41530F385A7C0F882927@TK5EX14MBXC127.redmond.corp.microsoft.com> References: <4cc7dd99-a30d-4594-ba91-0b8f371f5984@tk5-exsmh-c101.redmond.corp.microsoft.com> <32707103E022E74FA2BF41530F385A7C0F882927@TK5EX14MBXC127.redmond.corp.microsoft.com> Message-ID: <1A472770E042064698CB5ADC83A12ACD48A7D659@TK5EX14MBXC118.redmond.corp.microsoft.com> But I think we do intend to ensure that we still build on .NET 3.5 and above - we just won't be releasing those binaries ourselves. .NET 2.0 SP1 will be dropped completely and we won't be doing our normal extensive test passes on .NET 3.5. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Dave Fugate > Sent: Thursday, June 24, 2010 10:38 AM > To: Discussion of IronPython > Subject: Re: [IronPython] IronPython 2.6 CodePlex Source Update > > That's our current thinking. > > Dave > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Jeff Hardy > Sent: Thursday, June 24, 2010 9:01 AM > To: Discussion of IronPython > Subject: Re: [IronPython] IronPython 2.6 CodePlex Source Update > > > - .NET 4.0 is required for 2.7, not .NET 2.0 SP1 > > So does this mean there won't be a version of 2.7 for .NET 2.0? Fine by me - > supporting both for 2.6 is a pain. > > - 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 tristanz at gmail.com Fri Jun 25 13:45:07 2010 From: tristanz at gmail.com (Tristan Zajonc) Date: Fri, 25 Jun 2010 07:45:07 -0400 Subject: [IronPython] Implementing Greenlets API in IronPython In-Reply-To: <1A472770E042064698CB5ADC83A12ACD489691A2@TK5EX14MBXC118.redmond.corp.microsoft.com> References: <1A472770E042064698CB5ADC83A12ACD489691A2@TK5EX14MBXC118.redmond.corp.microsoft.com> Message-ID: I have been trying to hire somebody to implement the greenlet extension module, which would enable modules like eventlet and gevent to work on IronPython. The person I currently have looking into it, however, isn't hopeful. A condensed version of his perspective is below. Perhaps the IronPython list (Dino?) has an idea for a solution? == Response to Greenlets on IronPython == I looked at various solutions but none of them seem to arrive at the correct solution. I did try generating the DLR using AST again to make the function stackless but the limitation is with python and .NET. Let me explain the issue. 1) .NET lanugages (C#. VB.NET etc.) are strongly typed. In other words, if I get a variable I know what its type is at compile time. IronPython actually compiles the functions into CLR and runs them on the fly. A function is compiled once and can be executed again and again. One must know that the function needs to be stackless at compile time and a function cannot be made stackless at run time. 2) Python is a typeless language. A variable can assume any type at any point in execution at run-time. Now consider the following code in Python using the greenlet API: a = greenlet(foo) def abc(): print "X" a.switch() print "Y" Although variable a is defined, it does not have a strong type and during execution, a can be assigned a different object which can also implement the switch function and the code will execute fine. As mentioned above, IronPython needs to know at compile time that the function has to be made stackless. In python since a is not typed, a can be greenlet in one execution of abc and any other object in the second call. Also, there is no way to determine at compile that the function abc needs to be made stackless since it needs to switch since the type of a is unknown till it is actually called at runtime. Hence is it next to impossible to implement the switch because of the above implementation. CPython dos not compile the functions and does not use the yield keyword (which is not avilable in C/C++ anyways) to do it. It does this by using context switching which is built into python and so the API is fairly straightforward in CPython. CPython basically has the stack of all previous functions calls and saves the stack so that it can resume later from that point. It needs to store the context and uses the inherent context switching built into Python to do it. == End Response == Ideas? Tristan On Mon, May 31, 2010 at 1:28 PM, Dino Viehland wrote: > You?ll want to first look at GeneratorRewriter.cs - it?s responsible for > taking a DLR AST and re-writing it so that it can re-start at an arbitrary > location and so that it?s stackless. There?s one of these for debugging and > one that?s used for IronPython?s generators, you can probably adapt either > one. You can get the AST to re-write from the function code object but > that?s not public right now (we?ll make it public if anyone has a compelling > scenario to do so ? this could be it but you?ll probably need more public > surface area as well). > > > > From there I think you just need to worry about having to save multiple > frames (which I get the impression is supported from the docs ? eg f() calls > g() and then g switches). For that you?ll probably want to re-write all of > the dynamic expressions in the generator (these show up in several forms > though based upon how we?re generating code- there?s a > ReduciableDynamicExpression and some PythonDynamicExpression?s floating > around now). If greenlets only works across calls then you just need to > intercept the ones which are using invoke binders. If you can have a > descriptor who?s __get__ or __set__ switches then you?d also need to handle > gets/sets/etc? If you can do something like import a module which hasn?t > been loaded yet and then have the top-level module code switch then you?ll > need to start getting really creative J You?ll then presumably need to > change these into using some trampoline to do the actual invocation. > > > > Hopefully that will get you started ? I?m sure there?ll be lots of little > issues so if you have questions feel free to ask. If you get it all working > we can figure out what exactly we need to make public and how we should > expose that so you can do this as an extension ? but I?m sure you?ll > initially be using a bunch of internal APIs. > > > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Tristan Zajonc > *Sent:* Sunday, May 30, 2010 6:59 PM > *To:* Discussion of IronPython > *Subject:* [IronPython] Implementing Greenlets API in IronPython > > > > Hi - > > > > The greenlets C-extension module (http://packages.python.org/greenlet/) > provides a very basic api that is used by eventlet and gevent to > provide asynchronous programming constructs. It would be nice to have a > reasonably performant version of the greenlet API in IronPython. > > > > Before I start playing around with possibilities, is there an obvious > approach to implement the greenlets API in IronPython? > > > > Thanks > > Tristan > > _______________________________________________ > 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 merllab at microsoft.com Fri Jun 25 17:08:46 2010 From: merllab at microsoft.com (merllab at microsoft.com) Date: Fri, 25 Jun 2010 08:08:46 -0700 Subject: [IronPython] IronPython 2.6 CodePlex Source Update Message-ID: <210d3485-d9ed-4297-81f9-4209b81ef4b6@tk5-exsmh-c101.redmond.corp.microsoft.com> This is an automated email letting you know that sources have recently been pushed out. You can download these newer sources directly from http://ironpython.codeplex.com/SourceControl/changeset/view/71289. MODIFIED SOURCES $/IronPython/IronPython_Main/Tutorial/Tutorial.htm CHECKIN COMMENTS -------------------------------------------------------------------------------- Changeset Id: 1889432 Date: 6/25/2010 12:38:31 AM Some updates to the IronPython tutorial making it release-ready for IronPython 2.7 Alpha 1. We still need a comprehensive review of this doc after the final Beta ships. IronPython Tutorial: - .NET 4.0 is now the min bar for running IronPython 2.7 - VS 2010 is required to build IronPython 2.7 - ripped out "Merlin the Wizard" COM interop section. Not available under Win7 and we already have a COM interop section on Word - replaced the "there's no VS support for IronPython" blurb with a link to the IronPython Tools download page - we still had a reference to VS 2005?!? Removed - updated some ipy.exe interactive session?s output - replaced references to CPython 2.6 with CPython 2.7 (Shelveset: IPY_TUTORIAL;REDMOND\dfugate | SNAP CheckinId: 11000) From ecullen at fibertel.com.ar Fri Jun 25 17:26:16 2010 From: ecullen at fibertel.com.ar (Ernesto Cullen) Date: Fri, 25 Jun 2010 12:26:16 -0300 Subject: [IronPython] [resend] changes in COM access from IronPython 1.1 Message-ID: <4C24CA98.4050703@fibertel.com.ar> Sending this again, someone have an idea? Ernesto we have a problem with a project after updating it to IPy 2.6.1. We need to use a COM library; we add the reference in VS which creates the interop.XXX file. In IPy v1.1 we could access the imported types directly, like LN_AclEntry = LN_dbACL.GetEntry(entryName) if (LN_AclEntry == None): DebugMessage("%s entry does not exist in database: %s" %(entryName, databaseName)) else: if (LN_AclEntry.Level >= ACLLEVEL.ACLLEVEL_DESIGNER): ... the important line here is the last one: in IPy 1.1, LN_AclEntry is an instance of LN_AclEntry {Domino.NotesACLEntryClass}. In IPy 2.6.1, this same variable is of type LN_AclEntry {System.__ComObject}. This means we can't access Level property and compare with ACLLEVEL enumeration. Is there something we can do to get v1.1 behaviour back? If not, can we cast somehow the object to the correct type? Thanks in advance, Ernesto Cullen -------------- next part -------------- An HTML attachment was scrubbed... URL: From cenovsky at bakalari.cz Sun Jun 27 16:44:20 2010 From: cenovsky at bakalari.cz (Lukas Cenovsky) Date: Sun, 27 Jun 2010 16:44:20 +0200 Subject: [IronPython] Missing folders in SVN Message-ID: <4C2763C4.7070206@bakalari.cz> Hi, I wanted to build IronPython from sources but some files are missing: Microsoft.Scripting.Core.csproj Microsoft.Scripting.ExtensionAttribute.csproj Actually the whole folder IronPython_Main\Runtime\Microsoft.Scripting.Core is missing. -- -- Luk?? From curt at hagenlocher.org Sun Jun 27 20:53:19 2010 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sun, 27 Jun 2010 11:53:19 -0700 Subject: [IronPython] Missing folders in SVN In-Reply-To: <4C2763C4.7070206@bakalari.cz> References: <4C2763C4.7070206@bakalari.cz> Message-ID: Those projects don't exist for .NET 4.0; did you want to build for 2.0 or 4.0? 2010/6/27 Lukas Cenovsky > Hi, > I wanted to build IronPython from sources but some files are missing: > Microsoft.Scripting.Core.csproj > Microsoft.Scripting.ExtensionAttribute.csproj > > Actually the whole folder IronPython_Main\Runtime\Microsoft.Scripting.Core > is missing. > > -- > -- Luk?? > > _______________________________________________ > 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 cenovsky at bakalari.cz Sun Jun 27 21:46:02 2010 From: cenovsky at bakalari.cz (Lukas Cenovsky) Date: Sun, 27 Jun 2010 21:46:02 +0200 Subject: [IronPython] Missing folders in SVN In-Reply-To: References: <4C2763C4.7070206@bakalari.cz> Message-ID: <4C27AA7A.8020700@bakalari.cz> An HTML attachment was scrubbed... URL: From s.j.dower at gmail.com Sun Jun 27 23:49:27 2010 From: s.j.dower at gmail.com (Steve Dower) Date: Mon, 28 Jun 2010 07:49:27 +1000 Subject: [IronPython] Missing folders in SVN In-Reply-To: <4C27AA7A.8020700@bakalari.cz> References: <4C2763C4.7070206@bakalari.cz> <4C27AA7A.8020700@bakalari.cz> Message-ID: I noticed this as well when one of the recent commits came through, figured it was going to be dealt with in good time. While the plan is to remove support for .NET 2.0 (which required some extra classes) and make .NET 4.0 will be the official target, the project files in IronPython_Main still have all the .NET 2.0 references (with conditionals that MSBuild respects and VS seems to ignore). I assume these will be removed at some point, but until then the IDE is going to report these as issues. 2010/6/28 Lukas Cenovsky : > Well, I just opened IronPython_Main\Solutions\IronPython.sln and the > following errors appear: > > C:\IronPython_Main\Runtime\Microsoft.Scripting.Core\Microsoft.Scripting.Core.csproj > : error? : Unable to read the project file > 'Microsoft.Scripting.Core.csproj'. > C:\IronPython_Main\Runtime\Microsoft.Scripting.Core\Microsoft.Scripting.Core.csproj: > The project file could not be loaded. Could not find a part of the path > 'C:\IronPython_Main\Runtime\Microsoft.Scripting.Core\Microsoft.Scripting.Core.csproj'. > > C:\IronPython_Main\Runtime\Microsoft.Scripting.Core\Microsoft.Scripting.ExtensionAttribute.csproj > : error? : Unable to read the project file > 'Microsoft.Scripting.ExtensionAttribute.csproj'. > C:\IronPython_Main\Runtime\Microsoft.Scripting.Core\Microsoft.Scripting.ExtensionAttribute.csproj: > The project file could not be loaded. Could not find a part of the path > 'C:\IronPython_Main\Runtime\Microsoft.Scripting.Core\Microsoft.Scripting.ExtensionAttribute.csproj'. > > But I tried building now and building Release and Silverlight4Release > succeeded, building Silverlight3Release failed. > > Trying Silverlight4Release however shown the following error: > > C:\IronPython_Main\bin\Silverlight4Release>Chiron.exe /d:python > Chiron - Silverlight Dynamic Language Development Utility. Version 1.0.0.0 > Chiron serving 'C:\IronPython_Main\bin\Silverlight4Release\python' as > http://localhost:2060/ > 21:40:11 200?????? 338 /css/screen.css > 21:40:11 200???? 5?146 /index.html > 21:40:11 200???? 1?249 /js/error.js > 21:40:13 500?????? 637 /app.xap [error generating XAP: Could not find > assembly: System.Numerics.dll] > > Sure I know this is not yet even beta - just reporting my attempts. > > Btw. is a release date for 2.6.2 known already? > > -- > -- Luk?? > > > On 27.6.2010 20:53, Curt Hagenlocher wrote: > > Those projects don't exist for .NET 4.0; did you want to build for 2.0 or > 4.0? > > 2010/6/27 Lukas Cenovsky >> >> ?Hi, >> I wanted to build IronPython from sources but some files are missing: >> Microsoft.Scripting.Core.csproj >> Microsoft.Scripting.ExtensionAttribute.csproj >> >> Actually the whole folder IronPython_Main\Runtime\Microsoft.Scripting.Core >> is missing. >> >> -- >> -- Luk?? >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.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 microsoft.com Mon Jun 28 20:04:43 2010 From: dinov at microsoft.com (Dino Viehland) Date: Mon, 28 Jun 2010 18:04:43 +0000 Subject: [IronPython] Implementing Greenlets API in IronPython In-Reply-To: References: <1A472770E042064698CB5ADC83A12ACD489691A2@TK5EX14MBXC118.redmond.corp.microsoft.com> Message-ID: <1A472770E042064698CB5ADC83A12ACD48A9B479@TK5EX14MBXC118.redmond.corp.microsoft.com> I think that's a fair summary and ties into what I was saying about cross function switching. So basically this means every method needs to be re-written to support this including dispatching calls via returning back to an outer loop and then dispatching to the called object with the new arguments (including the perf hit that would come with that). I think that can certainly be done with a DLR tree AST re-write and replacing normal invocation with this trampoline mechanism. Obviously it'll come with a significant perf hit as we need to allocate memory for local variables, calls with be slower as they need to return and call, etc... But if you can get the tree re-write going to make the code entirely stackless from there you could opt into to the tree re-write dynamically. That could be done by doing a simpler tree re-write to track where you are in the function and then throwing a .NET exception when the 1st switch occurs. There would need to be try/catch/rethrow blocks to save all of the relevant state (which would need to be in locals) and then all of the functions on the stack would need to be re-written with the full stackless re-write. I do agree that it sounds more difficult then what is going on with the CPython implementation. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Tristan Zajonc Sent: Friday, June 25, 2010 4:45 AM To: Discussion of IronPython Subject: Re: [IronPython] Implementing Greenlets API in IronPython I have been trying to hire somebody to implement the greenlet extension module, which would enable modules like eventlet and gevent to work on IronPython. The person I currently have looking into it, however, isn't hopeful. A condensed version of his perspective is below. Perhaps the IronPython list (Dino?) has an idea for a solution? == Response to Greenlets on IronPython == I looked at various solutions but none of them seem to arrive at the correct solution. I did try generating the DLR using AST again to make the function stackless but the limitation is with python and .NET. Let me explain the issue. 1) .NET lanugages (C#. VB.NET etc.) are strongly typed. In other words, if I get a variable I know what its type is at compile time. IronPython actually compiles the functions into CLR and runs them on the fly. A function is compiled once and can be executed again and again. One must know that the function needs to be stackless at compile time and a function cannot be made stackless at run time. 2) Python is a typeless language. A variable can assume any type at any point in execution at run-time. Now consider the following code in Python using the greenlet API: a = greenlet(foo) def abc(): print "X" a.switch() print "Y" Although variable a is defined, it does not have a strong type and during execution, a can be assigned a different object which can also implement the switch function and the code will execute fine. As mentioned above, IronPython needs to know at compile time that the function has to be made stackless. In python since a is not typed, a can be greenlet in one execution of abc and any other object in the second call. Also, there is no way to determine at compile that the function abc needs to be made stackless since it needs to switch since the type of a is unknown till it is actually called at runtime. Hence is it next to impossible to implement the switch because of the above implementation. CPython dos not compile the functions and does not use the yield keyword (which is not avilable in C/C++ anyways) to do it. It does this by using context switching which is built into python and so the API is fairly straightforward in CPython. CPython basically has the stack of all previous functions calls and saves the stack so that it can resume later from that point. It needs to store the context and uses the inherent context switching built into Python to do it. == End Response == Ideas? Tristan On Mon, May 31, 2010 at 1:28 PM, Dino Viehland > wrote: You'll want to first look at GeneratorRewriter.cs - it's responsible for taking a DLR AST and re-writing it so that it can re-start at an arbitrary location and so that it's stackless. There's one of these for debugging and one that's used for IronPython's generators, you can probably adapt either one. You can get the AST to re-write from the function code object but that's not public right now (we'll make it public if anyone has a compelling scenario to do so - this could be it but you'll probably need more public surface area as well). >From there I think you just need to worry about having to save multiple frames (which I get the impression is supported from the docs - eg f() calls g() and then g switches). For that you'll probably want to re-write all of the dynamic expressions in the generator (these show up in several forms though based upon how we're generating code- there's a ReduciableDynamicExpression and some PythonDynamicExpression's floating around now). If greenlets only works across calls then you just need to intercept the ones which are using invoke binders. If you can have a descriptor who's __get__ or __set__ switches then you'd also need to handle gets/sets/etc... If you can do something like import a module which hasn't been loaded yet and then have the top-level module code switch then you'll need to start getting really creative :) You'll then presumably need to change these into using some trampoline to do the actual invocation. Hopefully that will get you started - I'm sure there'll be lots of little issues so if you have questions feel free to ask. If you get it all working we can figure out what exactly we need to make public and how we should expose that so you can do this as an extension - but I'm sure you'll initially be using a bunch of internal APIs. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Tristan Zajonc Sent: Sunday, May 30, 2010 6:59 PM To: Discussion of IronPython Subject: [IronPython] Implementing Greenlets API in IronPython Hi - The greenlets C-extension module (http://packages.python.org/greenlet/) provides a very basic api that is used by eventlet and gevent to provide asynchronous programming constructs. It would be nice to have a reasonably performant version of the greenlet API in IronPython. Before I start playing around with possibilities, is there an obvious approach to implement the greenlets API in IronPython? Thanks Tristan _______________________________________________ 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 tristanz at gmail.com Mon Jun 28 21:26:03 2010 From: tristanz at gmail.com (Tristan Zajonc) Date: Mon, 28 Jun 2010 15:26:03 -0400 Subject: [IronPython] Implementing Greenlets API in IronPython In-Reply-To: <1A472770E042064698CB5ADC83A12ACD48A9B479@TK5EX14MBXC118.redmond.corp.microsoft.com> References: <1A472770E042064698CB5ADC83A12ACD489691A2@TK5EX14MBXC118.redmond.corp.microsoft.com> <1A472770E042064698CB5ADC83A12ACD48A9B479@TK5EX14MBXC118.redmond.corp.microsoft.com> Message-ID: Thanks for the comments, I'll pass this along. On Mon, Jun 28, 2010 at 2:04 PM, Dino Viehland wrote: > I think that?s a fair summary and ties into what I was saying about cross > function switching. So basically this means every method needs to be > re-written to support this including dispatching calls via returning back to > an outer loop and then dispatching to the called object with the new > arguments (including the perf hit that would come with that). I think that > can certainly be done with a DLR tree AST re-write and replacing normal > invocation with this trampoline mechanism. Obviously it?ll come with a > significant perf hit as we need to allocate memory for local variables, > calls with be slower as they need to return and call, etc? > > > > But if you can get the tree re-write going to make the code entirely > stackless from there you could opt into to the tree re-write dynamically. > That could be done by doing a simpler tree re-write to track where you are > in the function and then throwing a .NET exception when the 1st switch > occurs. There would need to be try/catch/rethrow blocks to save all of the > relevant state (which would need to be in locals) and then all of the > functions on the stack would need to be re-written with the full stackless > re-write. > > > > I do agree that it sounds more difficult then what is going on with the > CPython implementation. > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Tristan Zajonc > *Sent:* Friday, June 25, 2010 4:45 AM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] Implementing Greenlets API in IronPython > > > > I have been trying to hire somebody to implement the greenlet extension > module, which would enable modules like eventlet and gevent to work on > IronPython. The person I currently have looking into it, however, isn't > hopeful. A condensed version of his perspective is below. Perhaps the > IronPython list (Dino?) has an idea for a solution? > > > > == Response to Greenlets on IronPython == > > > > I looked at various solutions but none of them seem to arrive at the > correct solution. I did try generating the DLR using AST again to make the > function stackless but the limitation is with python and .NET. > > > > Let me explain the issue. > > 1) .NET lanugages (C#. VB.NET etc.) are strongly typed. In other words, if > I get a variable I know what its type is at compile time. IronPython > actually compiles the functions into CLR and runs them on the fly. A > function is compiled once and can be executed again and again. One must know > that the function needs to be stackless at compile time and a function > cannot be made stackless at run time. > > 2) Python is a typeless language. A variable can assume any type at any > point in execution at run-time. Now consider the following code in Python > using the greenlet API: > > a = greenlet(foo) > > def abc(): > print "X" > a.switch() > print "Y" > > Although variable a is defined, it does not have a strong type and during > execution, a can be assigned a different object which can also implement the > switch function and the code will execute fine. > > As mentioned above, IronPython needs to know at compile time that the > function has to be made stackless. In python since a is not typed, a can be > greenlet in one execution of abc and any other object in the second call. > Also, there is no way to determine at compile that the function abc needs to > be made stackless since it needs to switch since the type of a is unknown > till it is actually called at runtime. > > Hence is it next to impossible to implement the switch because of the above > implementation. > > > CPython dos not compile the functions and does not use the yield keyword > (which is not avilable in C/C++ anyways) to do it. It does this by > using context switching which is built into python and so the API is > fairly straightforward in CPython. CPython basically has the stack of all > previous functions calls and saves the stack so that it can resume later > from that point. It needs to store the context and uses the inherent context > switching built into Python to do it. > > > > == End Response == > > > > Ideas? > > > > Tristan > > > > On Mon, May 31, 2010 at 1:28 PM, Dino Viehland > wrote: > > You?ll want to first look at GeneratorRewriter.cs - it?s responsible for > taking a DLR AST and re-writing it so that it can re-start at an arbitrary > location and so that it?s stackless. There?s one of these for debugging and > one that?s used for IronPython?s generators, you can probably adapt either > one. You can get the AST to re-write from the function code object but > that?s not public right now (we?ll make it public if anyone has a compelling > scenario to do so ? this could be it but you?ll probably need more public > surface area as well). > > > > From there I think you just need to worry about having to save multiple > frames (which I get the impression is supported from the docs ? eg f() calls > g() and then g switches). For that you?ll probably want to re-write all of > the dynamic expressions in the generator (these show up in several forms > though based upon how we?re generating code- there?s a > ReduciableDynamicExpression and some PythonDynamicExpression?s floating > around now). If greenlets only works across calls then you just need to > intercept the ones which are using invoke binders. If you can have a > descriptor who?s __get__ or __set__ switches then you?d also need to handle > gets/sets/etc? If you can do something like import a module which hasn?t > been loaded yet and then have the top-level module code switch then you?ll > need to start getting really creative J You?ll then presumably need to > change these into using some trampoline to do the actual invocation. > > > > Hopefully that will get you started ? I?m sure there?ll be lots of little > issues so if you have questions feel free to ask. If you get it all working > we can figure out what exactly we need to make public and how we should > expose that so you can do this as an extension ? but I?m sure you?ll > initially be using a bunch of internal APIs. > > > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Tristan Zajonc > *Sent:* Sunday, May 30, 2010 6:59 PM > *To:* Discussion of IronPython > *Subject:* [IronPython] Implementing Greenlets API in IronPython > > > > Hi - > > > > The greenlets C-extension module (http://packages.python.org/greenlet/) > provides a very basic api that is used by eventlet and gevent to > provide asynchronous programming constructs. It would be nice to have a > reasonably performant version of the greenlet API in IronPython. > > > > Before I start playing around with possibilities, is there an obvious > approach to implement the greenlets API in IronPython? > > > > Thanks > > Tristan > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.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 merllab at microsoft.com Tue Jun 29 00:50:03 2010 From: merllab at microsoft.com (merllab at microsoft.com) Date: Mon, 28 Jun 2010 15:50:03 -0700 Subject: [IronPython] IronPython 2.6 CodePlex Source Update Message-ID: <6e6c1285-4620-4f64-a137-57c1f5acd7fa@tk5-exsmh-c101.redmond.corp.microsoft.com> This is an automated email letting you know that sources have recently been pushed out. You can download these newer sources directly from http://ironpython.codeplex.com/SourceControl/changeset/view/71564. MODIFIED SOURCES $/IronPython/IronPython_Main/Solutions/IronPython.sln From dfugate at microsoft.com Tue Jun 29 01:44:55 2010 From: dfugate at microsoft.com (Dave Fugate) Date: Mon, 28 Jun 2010 23:44:55 +0000 Subject: [IronPython] Missing folders in SVN In-Reply-To: References: <4C2763C4.7070206@bakalari.cz> <4C27AA7A.8020700@bakalari.cz> Message-ID: <32707103E022E74FA2BF41530F385A7C0F889E54@TK5EX14MBXC127.redmond.corp.microsoft.com> Thanks for spotting this. It should be fixed now. Dave -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Steve Dower Sent: Sunday, June 27, 2010 2:49 PM To: Discussion of IronPython Subject: Re: [IronPython] Missing folders in SVN I noticed this as well when one of the recent commits came through, figured it was going to be dealt with in good time. While the plan is to remove support for .NET 2.0 (which required some extra classes) and make .NET 4.0 will be the official target, the project files in IronPython_Main still have all the .NET 2.0 references (with conditionals that MSBuild respects and VS seems to ignore). I assume these will be removed at some point, but until then the IDE is going to report these as issues. 2010/6/28 Lukas Cenovsky : > Well, I just opened IronPython_Main\Solutions\IronPython.sln and the > following errors appear: > > C:\IronPython_Main\Runtime\Microsoft.Scripting.Core\Microsoft.Scriptin > g.Core.csproj > : error? : Unable to read the project file > 'Microsoft.Scripting.Core.csproj'. > C:\IronPython_Main\Runtime\Microsoft.Scripting.Core\Microsoft.Scripting.Core.csproj: > The project file could not be loaded. Could not find a part of the > path 'C:\IronPython_Main\Runtime\Microsoft.Scripting.Core\Microsoft.Scripting.Core.csproj'. > > C:\IronPython_Main\Runtime\Microsoft.Scripting.Core\Microsoft.Scriptin > g.ExtensionAttribute.csproj > : error? : Unable to read the project file > 'Microsoft.Scripting.ExtensionAttribute.csproj'. > C:\IronPython_Main\Runtime\Microsoft.Scripting.Core\Microsoft.Scripting.ExtensionAttribute.csproj: > The project file could not be loaded. Could not find a part of the > path 'C:\IronPython_Main\Runtime\Microsoft.Scripting.Core\Microsoft.Scripting.ExtensionAttribute.csproj'. > > But I tried building now and building Release and Silverlight4Release > succeeded, building Silverlight3Release failed. > > Trying Silverlight4Release however shown the following error: > > C:\IronPython_Main\bin\Silverlight4Release>Chiron.exe /d:python Chiron > - Silverlight Dynamic Language Development Utility. Version 1.0.0.0 > Chiron serving 'C:\IronPython_Main\bin\Silverlight4Release\python' as > http://localhost:2060/ > 21:40:11 200?????? 338 /css/screen.css > 21:40:11 200???? 5?146 /index.html > 21:40:11 200???? 1?249 /js/error.js > 21:40:13 500?????? 637 /app.xap [error generating XAP: Could not find > assembly: System.Numerics.dll] > > Sure I know this is not yet even beta - just reporting my attempts. > > Btw. is a release date for 2.6.2 known already? > > -- > -- Luk?? > > > On 27.6.2010 20:53, Curt Hagenlocher wrote: > > Those projects don't exist for .NET 4.0; did you want to build for 2.0 > or 4.0? > > 2010/6/27 Lukas Cenovsky >> >> ?Hi, >> I wanted to build IronPython from sources but some files are missing: >> Microsoft.Scripting.Core.csproj >> Microsoft.Scripting.ExtensionAttribute.csproj >> >> Actually the whole folder >> IronPython_Main\Runtime\Microsoft.Scripting.Core >> is missing. >> >> -- >> -- Luk?? >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.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 dfugate at microsoft.com Tue Jun 29 01:55:05 2010 From: dfugate at microsoft.com (Dave Fugate) Date: Mon, 28 Jun 2010 23:55:05 +0000 Subject: [IronPython] IronPython 2.6 CodePlex Source Update In-Reply-To: <1A472770E042064698CB5ADC83A12ACD48A7D659@TK5EX14MBXC118.redmond.corp.microsoft.com> References: <4cc7dd99-a30d-4594-ba91-0b8f371f5984@tk5-exsmh-c101.redmond.corp.microsoft.com> <32707103E022E74FA2BF41530F385A7C0F882927@TK5EX14MBXC127.redmond.corp.microsoft.com> <1A472770E042064698CB5ADC83A12ACD48A7D659@TK5EX14MBXC118.redmond.corp.microsoft.com> Message-ID: <32707103E022E74FA2BF41530F385A7C0F889EB8@TK5EX14MBXC127.redmond.corp.microsoft.com> One qualifying remark to add here - we will continue to ensure we build against .NET 3.5 and above from the DLR's CodePlex source repository, not IronPython's. If anyone's interested in doing this today simply: 1. Navigate to http://dlr.codeplex.com/SourceControl/list/changesets 2. Download a source zip file of your choosing 3. Unzip it and build the "v2Release" configuration of "DLR_Main\Solutions\CodePlex-DLR.sln" as opposed to the "Release" configuration of "IronPython_Main\Solutions\IronPython.sln" Just out of curiosity, how many people out there care about building IronPython against .NET 2.0/.NET 3.5? I'd hope not too many considering the improvements you'll get by running .NET 4.0 based IronPython assemblies - see http://knowbody.livejournal.com/20751.html :) Thanks, Dave -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland Sent: Thursday, June 24, 2010 10:57 AM To: Discussion of IronPython Subject: Re: [IronPython] IronPython 2.6 CodePlex Source Update But I think we do intend to ensure that we still build on .NET 3.5 and above - we just won't be releasing those binaries ourselves. .NET 2.0 SP1 will be dropped completely and we won't be doing our normal extensive test passes on .NET 3.5. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Dave Fugate > Sent: Thursday, June 24, 2010 10:38 AM > To: Discussion of IronPython > Subject: Re: [IronPython] IronPython 2.6 CodePlex Source Update > > That's our current thinking. > > Dave > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Jeff Hardy > Sent: Thursday, June 24, 2010 9:01 AM > To: Discussion of IronPython > Subject: Re: [IronPython] IronPython 2.6 CodePlex Source Update > > > - .NET 4.0 is required for 2.7, not .NET 2.0 SP1 > > So does this mean there won't be a version of 2.7 for .NET 2.0? Fine > by me - supporting both for 2.6 is a pain. > > - Jeff > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From tristanz at gmail.com Tue Jun 29 04:33:40 2010 From: tristanz at gmail.com (Tristan Zajonc) Date: Mon, 28 Jun 2010 22:33:40 -0400 Subject: [IronPython] IronPython 2.6 CodePlex Source Update In-Reply-To: <32707103E022E74FA2BF41530F385A7C0F889EB8@TK5EX14MBXC127.redmond.corp.microsoft.com> References: <4cc7dd99-a30d-4594-ba91-0b8f371f5984@tk5-exsmh-c101.redmond.corp.microsoft.com> <32707103E022E74FA2BF41530F385A7C0F882927@TK5EX14MBXC127.redmond.corp.microsoft.com> <1A472770E042064698CB5ADC83A12ACD48A7D659@TK5EX14MBXC118.redmond.corp.microsoft.com> <32707103E022E74FA2BF41530F385A7C0F889EB8@TK5EX14MBXC127.redmond.corp.microsoft.com> Message-ID: I care about Mono support. I believe the trunk is 4.0 compatible but binaries currently do not exist for most platforms. It would be nice if there was some minimal amount of testing against Mono to ensure major IronPython releases were cross platform. I do not believe there are major problems with Mono and IronPython currently and hopefully this can remain the case. On Mon, Jun 28, 2010 at 7:55 PM, Dave Fugate wrote: > One qualifying remark to add here - we will continue to ensure we build > against .NET 3.5 and above from the DLR's CodePlex source repository, not > IronPython's. If anyone's interested in doing this today simply: > 1. Navigate to http://dlr.codeplex.com/SourceControl/list/changesets > 2. Download a source zip file of your choosing > 3. Unzip it and build the "v2Release" configuration of > "DLR_Main\Solutions\CodePlex-DLR.sln" as opposed to the "Release" > configuration of "IronPython_Main\Solutions\IronPython.sln" > > Just out of curiosity, how many people out there care about building > IronPython against .NET 2.0/.NET 3.5? I'd hope not too many considering the > improvements you'll get by running .NET 4.0 based IronPython assemblies - > see http://knowbody.livejournal.com/20751.html :) > > Thanks, > > Dave > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland > Sent: Thursday, June 24, 2010 10:57 AM > To: Discussion of IronPython > Subject: Re: [IronPython] IronPython 2.6 CodePlex Source Update > > But I think we do intend to ensure that we still build on .NET 3.5 and > above - we just won't be releasing those binaries ourselves. .NET 2.0 > SP1 will be dropped completely and we won't be doing our normal extensive > test passes on .NET 3.5. > > > -----Original Message----- > > From: users-bounces at lists.ironpython.com [mailto:users- > > bounces at lists.ironpython.com] On Behalf Of Dave Fugate > > Sent: Thursday, June 24, 2010 10:38 AM > > To: Discussion of IronPython > > Subject: Re: [IronPython] IronPython 2.6 CodePlex Source Update > > > > That's our current thinking. > > > > Dave > > > > -----Original Message----- > > From: users-bounces at lists.ironpython.com [mailto:users- > > bounces at lists.ironpython.com] On Behalf Of Jeff Hardy > > Sent: Thursday, June 24, 2010 9:01 AM > > To: Discussion of IronPython > > Subject: Re: [IronPython] IronPython 2.6 CodePlex Source Update > > > > > - .NET 4.0 is required for 2.7, not .NET 2.0 SP1 > > > > So does this mean there won't be a version of 2.7 for .NET 2.0? Fine > > by me - supporting both for 2.6 is a pain. > > > > - Jeff > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From harry.percival at gmail.com Tue Jun 29 12:57:47 2010 From: harry.percival at gmail.com (Harry Percival) Date: Tue, 29 Jun 2010 12:57:47 +0200 Subject: [IronPython] IronPython 2.6 CodePlex Source Update In-Reply-To: References: <4cc7dd99-a30d-4594-ba91-0b8f371f5984@tk5-exsmh-c101.redmond.corp.microsoft.com> <32707103E022E74FA2BF41530F385A7C0F882927@TK5EX14MBXC127.redmond.corp.microsoft.com> <1A472770E042064698CB5ADC83A12ACD48A7D659@TK5EX14MBXC118.redmond.corp.microsoft.com> <32707103E022E74FA2BF41530F385A7C0F889EB8@TK5EX14MBXC127.redmond.corp.microsoft.com> Message-ID: +1 for Mono support. On Tue, Jun 29, 2010 at 4:33 AM, Tristan Zajonc wrote: > I care about Mono support. I believe the trunk is 4.0 compatible but > binaries currently do not exist for most platforms. ?It would be nice if > there was some minimal amount of testing against Mono to ensure major > IronPython releases were cross platform. ?I do not believe there are major > problems with Mono and IronPython currently and hopefully this can remain > the case. > On Mon, Jun 28, 2010 at 7:55 PM, Dave Fugate wrote: >> >> One qualifying remark to add here - we will continue to ensure we build >> against .NET 3.5 and above from the DLR's CodePlex source repository, not >> IronPython's. ?If anyone's interested in doing this today simply: >> 1. Navigate to http://dlr.codeplex.com/SourceControl/list/changesets >> 2. Download a source zip file of your choosing >> 3. Unzip it and build the "v2Release" configuration of >> "DLR_Main\Solutions\CodePlex-DLR.sln" as opposed to the "Release" >> configuration of "IronPython_Main\Solutions\IronPython.sln" >> >> Just out of curiosity, how many people out there care about building >> IronPython against .NET 2.0/.NET 3.5? ?I'd hope not too many considering the >> improvements you'll get by running .NET 4.0 based IronPython assemblies - >> see http://knowbody.livejournal.com/20751.html :) >> >> Thanks, >> >> Dave >> >> -----Original Message----- >> From: users-bounces at lists.ironpython.com >> [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland >> Sent: Thursday, June 24, 2010 10:57 AM >> To: Discussion of IronPython >> Subject: Re: [IronPython] IronPython 2.6 CodePlex Source Update >> >> But I think we do intend to ensure that we still build on .NET 3.5 and >> above - we just won't be releasing those binaries ourselves. ?.NET 2.0 >> SP1 will be dropped completely and we won't be doing our normal extensive >> test passes on .NET 3.5. >> >> > -----Original Message----- >> > From: users-bounces at lists.ironpython.com [mailto:users- >> > bounces at lists.ironpython.com] On Behalf Of Dave Fugate >> > Sent: Thursday, June 24, 2010 10:38 AM >> > To: Discussion of IronPython >> > Subject: Re: [IronPython] IronPython 2.6 CodePlex Source Update >> > >> > That's our current thinking. >> > >> > Dave >> > >> > -----Original Message----- >> > From: users-bounces at lists.ironpython.com [mailto:users- >> > bounces at lists.ironpython.com] On Behalf Of Jeff Hardy >> > Sent: Thursday, June 24, 2010 9:01 AM >> > To: Discussion of IronPython >> > Subject: Re: [IronPython] IronPython 2.6 CodePlex Source Update >> > >> > > - .NET 4.0 is required for 2.7, not .NET 2.0 SP1 >> > >> > So does this mean there won't be a version of 2.7 for .NET 2.0? Fine >> > by me - supporting both for 2.6 is a pain. >> > >> > - Jeff >> > _______________________________________________ >> > Users mailing list >> > Users at lists.ironpython.com >> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > >> > _______________________________________________ >> > Users mailing list >> > Users at lists.ironpython.com >> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -- ------------------------------ Harry J.W. Percival ------------------------------ Italy Mobile: +39 389 095 8959 UK Mobile: +44 (0) 78877 02511 (may be turned off) Skype: harry.percival Email: harry.percival at gmail.com From merllab at microsoft.com Tue Jun 29 17:07:53 2010 From: merllab at microsoft.com (merllab at microsoft.com) Date: Tue, 29 Jun 2010 08:07:53 -0700 Subject: [IronPython] IronPython 2.6 CodePlex Source Update Message-ID: This is an automated email letting you know that sources have recently been pushed out. You can download these newer sources directly from http://ironpython.codeplex.com/SourceControl/changeset/view/71640. ADDED SOURCES $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/DebuggerDictionaryStorage.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Runtime/CustomStringDictionary.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting/Runtime/ObjectDictionaryExpando.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting/Runtime/StringDictionaryExpando.cs DELETED SOURCES $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Ast/SymbolConstantExpression.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Runtime/BaseSymbolDictionary.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/AttributesDictionaryStorage.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Runtime/CustomSymbolDictionary.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Runtime/TransformDictEnumerator.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Runtime/SymbolDictionary.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Ast/VariableDictionaryExpression.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting/Runtime/BaseSymbolDictionary.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting/IAttributesCollection.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting/SymbolId.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting/Runtime/SymbolDictionary.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting/Runtime/TransformDictEnumerator.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting/SymbolTable.cs MODIFIED SOURCES $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/DebuggerDictionaryStorage.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Runtime/CustomStringDictionary.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/PythonTracebackListener.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/PythonContext.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting/Hosting/ScriptRuntime.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/PythonModule.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting/Hosting/ScriptEngine.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Actions/TopNamespaceTracker.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Types/OldInstance.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/IronPython.csproj $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Importer.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/ModuleContext.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Actions/Calls/ParamsDictArgBuilder.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPythonTest/AttrInjectorTest.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/PythonDocumentationProvider.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/DictionaryOps.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/PythonDictionary.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/WrapperDictionary.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPythonTest/StringDictionaryStorage.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Binding/PythonBinder.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPythonTest/EngineTest.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Operations/NamespaceTrackerOps.cs $/IronPython/IronPython_Main/Languages/IronPython/Tests/test_ipye.py $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Runtime/Exceptions/TraceBack.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Generation/ToDiskRewriter.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Runtime/ExtraKeyEnumerator.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting.Debugging/DebuggableLambdaBuilder.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting.Debugging/DebugFrame.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Actions/NamespaceTracker.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Runtime/LocalsDictionary.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Interpreter/Instructions/InstructionFactory.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Runtime/ScriptingRuntimeHelpers.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Ast/ConstantExpression.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Microsoft.Dynamic.csproj $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting.Debugging/TracePipeline/ITraceCallback.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting/Runtime/ObjectDictionaryExpando.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting/Microsoft.Scripting.csproj $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting/Runtime/InvariantContext.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting/Runtime/Scope.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting.Debugging/VariableInfo.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Runtime/BinderOps.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Scripting/Runtime/StringDictionaryExpando.cs $/IronPython/IronPython_Main/Test/ClrAssembly/Src/methodargs.cs From dinov at microsoft.com Tue Jun 29 19:00:26 2010 From: dinov at microsoft.com (Dino Viehland) Date: Tue, 29 Jun 2010 17:00:26 +0000 Subject: [IronPython] IronPython 2.6 CodePlex Source Update In-Reply-To: References: <4cc7dd99-a30d-4594-ba91-0b8f371f5984@tk5-exsmh-c101.redmond.corp.microsoft.com> <32707103E022E74FA2BF41530F385A7C0F882927@TK5EX14MBXC127.redmond.corp.microsoft.com> <1A472770E042064698CB5ADC83A12ACD48A7D659@TK5EX14MBXC118.redmond.corp.microsoft.com> <32707103E022E74FA2BF41530F385A7C0F889EB8@TK5EX14MBXC127.redmond.corp.microsoft.com> Message-ID: <1A472770E042064698CB5ADC83A12ACD48AA2E24@TK5EX14MBXC118.redmond.corp.microsoft.com> It's a good point - if Mono 2.8 isn't out in time for 2.7 then we'll need to think about what to do there. Over on the Mono list there was some discussion about this in April (http://lists.ximian.com/pipermail/mono-list/2010-April/044892.html) and it sounds like the release was supposed to be available soon after .NET 4 shipped but it's still listed as TBD on the roadmap page :( Either way there's still ~6mos before 2.7 is done so there could be a good chance Mono 2.8 will be out by then as well. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Harry Percival > Sent: Tuesday, June 29, 2010 3:58 AM > To: Discussion of IronPython > Subject: Re: [IronPython] IronPython 2.6 CodePlex Source Update > > +1 for Mono support. > > On Tue, Jun 29, 2010 at 4:33 AM, Tristan Zajonc wrote: > > I care about Mono support. I believe the trunk is 4.0 compatible but > > binaries currently do not exist for most platforms. ?It would be nice if > > there was some minimal amount of testing against Mono to ensure major > > IronPython releases were cross platform. ?I do not believe there are major > > problems with Mono and IronPython currently and hopefully this can remain > > the case. > > On Mon, Jun 28, 2010 at 7:55 PM, Dave Fugate wrote: > >> > >> One qualifying remark to add here - we will continue to ensure we build > >> against .NET 3.5 and above from the DLR's CodePlex source repository, not > >> IronPython's. ?If anyone's interested in doing this today simply: > >> 1. Navigate to http://dlr.codeplex.com/SourceControl/list/changesets > >> 2. Download a source zip file of your choosing > >> 3. Unzip it and build the "v2Release" configuration of > >> "DLR_Main\Solutions\CodePlex-DLR.sln" as opposed to the "Release" > >> configuration of "IronPython_Main\Solutions\IronPython.sln" > >> > >> Just out of curiosity, how many people out there care about building > >> IronPython against .NET 2.0/.NET 3.5? ?I'd hope not too many considering > the > >> improvements you'll get by running .NET 4.0 based IronPython assemblies - > >> see http://knowbody.livejournal.com/20751.html :) > >> > >> Thanks, > >> > >> Dave > >> > >> -----Original Message----- > >> From: users-bounces at lists.ironpython.com > >> [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland > >> Sent: Thursday, June 24, 2010 10:57 AM > >> To: Discussion of IronPython > >> Subject: Re: [IronPython] IronPython 2.6 CodePlex Source Update > >> > >> But I think we do intend to ensure that we still build on .NET 3.5 and > >> above - we just won't be releasing those binaries ourselves. ?.NET 2.0 > >> SP1 will be dropped completely and we won't be doing our normal extensive > >> test passes on .NET 3.5. > >> > >> > -----Original Message----- > >> > From: users-bounces at lists.ironpython.com [mailto:users- > >> > bounces at lists.ironpython.com] On Behalf Of Dave Fugate > >> > Sent: Thursday, June 24, 2010 10:38 AM > >> > To: Discussion of IronPython > >> > Subject: Re: [IronPython] IronPython 2.6 CodePlex Source Update > >> > > >> > That's our current thinking. > >> > > >> > Dave > >> > > >> > -----Original Message----- > >> > From: users-bounces at lists.ironpython.com [mailto:users- > >> > bounces at lists.ironpython.com] On Behalf Of Jeff Hardy > >> > Sent: Thursday, June 24, 2010 9:01 AM > >> > To: Discussion of IronPython > >> > Subject: Re: [IronPython] IronPython 2.6 CodePlex Source Update > >> > > >> > > - .NET 4.0 is required for 2.7, not .NET 2.0 SP1 > >> > > >> > So does this mean there won't be a version of 2.7 for .NET 2.0? Fine > >> > by me - supporting both for 2.6 is a pain. > >> > > >> > - Jeff > >> > _______________________________________________ > >> > Users mailing list > >> > Users at lists.ironpython.com > >> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > >> > > >> > _______________________________________________ > >> > Users mailing list > >> > Users at lists.ironpython.com > >> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > >> _______________________________________________ > >> Users mailing list > >> Users at lists.ironpython.com > >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > >> > >> _______________________________________________ > >> Users mailing list > >> Users at lists.ironpython.com > >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > > > -- > ------------------------------ > Harry J.W. Percival > ------------------------------ > Italy Mobile: +39 389 095 8959 > UK Mobile: +44 (0) 78877 02511 (may be turned off) > Skype: harry.percival > Email: harry.percival at gmail.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From williamj at tenbase2.com Tue Jun 29 23:44:53 2010 From: williamj at tenbase2.com (William Johnston) Date: Tue, 29 Jun 2010 17:44:53 -0400 Subject: [IronPython] cannot find Pickle file from ASP.NET Web app Message-ID: <002b01cb17d4$4f705aa0$ee510fe0$@com> Hello, The following Python code snippet causes a FileNotFound exception from an ASP.NET Web application: input = open('t2.pkl', 'rb') The exception message is: [Could not find file 'C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0\t2.pkl'.] The same code works for a console project. Any suggestions? Thanks, William Johnston -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdhardy at gmail.com Tue Jun 29 23:46:52 2010 From: jdhardy at gmail.com (Jeff Hardy) Date: Tue, 29 Jun 2010 15:46:52 -0600 Subject: [IronPython] cannot find Pickle file from ASP.NET Web app In-Reply-To: <002b01cb17d4$4f705aa0$ee510fe0$@com> References: <002b01cb17d4$4f705aa0$ee510fe0$@com> Message-ID: Are you running the WebDev server from Visual Studio? If so, that directory is the default "working directory" for the WebDev.WebServer.exe (the ASP.NET server), and thus where IronPython will look for files when you use 'open'. By default, IronPython doesn't know that you're running in a web app and thus follows the system rules for locating files. The same thing happens in C#/ASP.NET as well, by the way, if you don't handle it properly.. You need to use Server.MapPath to get a path that 'open' can handle. It'll look something like open(Server.MapPath('~/t2.pkl'), 'rb') Server.MapPath converts a webapp-relative path to a filesystem path the open will understand; the '~/' just means the root of the web app. - Jeff On Tue, Jun 29, 2010 at 3:44 PM, William Johnston wrote: > > > Hello, > > > > The following Python code snippet causes a FileNotFound exception from an > ASP.NET Web application: > > > > input = open('t2.pkl', 'rb') > > > > The exception message is: > > > > [Could not find file 'C:\Program Files (x86)\Common Files\Microsoft > Shared\DevServer\10.0\t2.pkl'.] > > > > The same code works for a console project. > > > > Any suggestions? > > > > Thanks, > > William Johnston > > > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > From williamj at tenbase2.com Wed Jun 30 02:37:57 2010 From: williamj at tenbase2.com (William Johnston) Date: Tue, 29 Jun 2010 20:37:57 -0400 Subject: [IronPython] cannot find Pickle file from ASP.NET Web app In-Reply-To: <002b01cb17d4$4f705aa0$ee510fe0$@com> References: <002b01cb17d4$4f705aa0$ee510fe0$@com> Message-ID: <000c01cb17ec$7de4abd0$79ae0370$@com> Hello, I attempted to set the path to the CPickle file using SetSearchPaths but this also did not work: searchPaths.Add(Server.MapPath(".")); var ipy = Python.CreateRuntime(); ipy.GetEngine("python").SetSearchPaths(searchPaths); I still cannot access my .pkl file. Any more suggestions? Thanks. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of William Johnston Sent: Tuesday, June 29, 2010 5:45 PM To: users at lists.ironpython.com Subject: [IronPython] cannot find Pickle file from ASP.NET Web app Hello, The following Python code snippet causes a FileNotFound exception from an ASP.NET Web application: input = open('t2.pkl', 'rb') The exception message is: [Could not find file 'C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0\t2.pkl'.] The same code works for a console project. Any suggestions? Thanks, William Johnston -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdhardy at gmail.com Wed Jun 30 07:00:26 2010 From: jdhardy at gmail.com (Jeff Hardy) Date: Tue, 29 Jun 2010 23:00:26 -0600 Subject: [IronPython] cannot find Pickle file from ASP.NET Web app In-Reply-To: <000c01cb17ec$7de4abd0$79ae0370$@com> References: <002b01cb17d4$4f705aa0$ee510fe0$@com> <000c01cb17ec$7de4abd0$79ae0370$@com> Message-ID: SetSearchPaths is used to set up sys.path, which controls where to find libraries for importing. To find files without a full path, IronPython will look in the directory your hosting application was launched from. What that directory is will depend on how you launch your hosting application: from the command line, from Visual Studio, or from Windows Explorer. You can set the current directory by setting System.Environment.CurrentDirectory, but this is not usually a good idea. - Jeff On Tue, Jun 29, 2010 at 6:37 PM, William Johnston wrote: > > > Hello, > > > > I attempted to set the path to the CPickle file using SetSearchPaths but > this also did not work: > > > > searchPaths.Add(Server.MapPath(".")); > > > > var ipy = Python.CreateRuntime(); > > ipy.GetEngine("python").SetSearchPaths(searchPaths); > > > > I still cannot access my .pkl file. > > > > Any more suggestions? > > > > Thanks. > > > > > > > > > > > > From: users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] On Behalf Of William Johnston > Sent: Tuesday, June 29, 2010 5:45 PM > To: users at lists.ironpython.com > Subject: [IronPython] cannot find Pickle file from ASP.NET Web app > > > > > > Hello, > > > > The following Python code snippet causes a FileNotFound exception from an > ASP.NET Web application: > > > > input = open('t2.pkl', 'rb') > > > > The exception message is: > > > > [Could not find file 'C:\Program Files (x86)\Common Files\Microsoft > Shared\DevServer\10.0\t2.pkl'.] > > > > The same code works for a console project. > > > > Any suggestions? > > > > Thanks, > > William Johnston > > > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > From merllab at microsoft.com Wed Jun 30 17:07:49 2010 From: merllab at microsoft.com (merllab at microsoft.com) Date: Wed, 30 Jun 2010 08:07:49 -0700 Subject: [IronPython] IronPython 2.6 CodePlex Source Update Message-ID: This is an automated email letting you know that sources have recently been pushed out. You can download these newer sources directly from http://ironpython.codeplex.com/SourceControl/changeset/view/71762. ADDED SOURCES $/IronPython/IronPython_Main/Hosts/SilverLight/Microsoft.Scripting.SilverLight/ReplHistory.cs MODIFIED SOURCES $/IronPython/IronPython_Main/Hosts/SilverLight/Microsoft.Scripting.SilverLight/ReplHistory.cs $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Parser.cs $/IronPython/IronPython_Main/Hosts/Silverlight/Microsoft.Scripting.SilverLight/Microsoft.Scripting.Silverlight.csproj $/IronPython/IronPython_Main/Languages/IronPython/IronPython/Compiler/Tokenizer.cs $/IronPython/IronPython_Main/Hosts/Silverlight/Microsoft.Scripting.SilverLight/Repl.cs $/IronPython/IronPython_Main/Hosts/Silverlight/Microsoft.Scripting.SilverLight/DynamicScriptTags.cs $/IronPython/IronPython_Main/Hosts/Silverlight/Microsoft.Scripting.SilverLight/BrowserVirtualFilesystem.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Generation/CompilerHelpers.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Actions/Calls/OverloadResolver.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Interpreter/Instructions/CallInstruction.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Actions/Calls/TypeInferer.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Utils/ArrayUtils.cs $/IronPython/IronPython_Main/Runtime/Microsoft.Dynamic/Utils/ReflectionUtils.cs CHECKIN COMMENTS -------------------------------------------------------------------------------- Changeset Id: 1895157 Date: 6/29/2010 10:57:09 AM Fixes a bug w/ the offsets we?re reporting for tokenization inside of VisualStudio. We aren?t respecting initial location and we?re not clearing _newLines when re-initializing the tokenizer. The parser is also failing to set the span on the function associated w/ a lambda expression. (Shelveset: FixNewParserBug;REDMOND\dinov | SNAP CheckinId: 11021) From jdhardy at gmail.com Wed Jun 30 22:38:19 2010 From: jdhardy at gmail.com (Jeff Hardy) Date: Wed, 30 Jun 2010 14:38:19 -0600 Subject: [IronPython] IronPython version on gestalt.ironpython.net? Message-ID: Hi, Which version of IronPython is on gestalt.ironpython.net? It looks to me like it's IronPython 2.6.0, since I'm hitting issues that are supposed to be fixed in 2.6.1. - Jeff