From lorenzph at googlemail.com Wed May 4 15:24:46 2011 From: lorenzph at googlemail.com (Philip Lorenz) Date: Wed, 04 May 2011 15:24:46 +0200 Subject: [Python.NET] Several patches to improve compilation with Mono Message-ID: <4DC1539E.1080509@googlemail.com> Hi, after trying to compile Python for .NET on ArchLinux x86_64 I have run into several issues which the attached patches fix: 1. Enable Mono config file loading. Otherwise a Python build with UCS4 Unicode strings does not work as the Mono.Posix module cannot find msvcrt (which is mapped to libc in Mono's config files). 2. Python.Runtime.dll.config is missing mappings for Python 2.7 3. The architecture detection code in the Makefile did not work correctly (checking for the 86 substring is true for both x86 as well as x86_64 targets). 4. I have renamed the clrmodule.il target in the Makefile to clrmodule_make.il. Otherwise a fresh SVN checkout would not build as clrmodule.il is already included. 5. Adapt the clrmod Makefile to support Mono 2.8 pkgconfig change. Additionally, retrieve Glib 2 options from its pkgconfig and compile the x86_64 build with -fPIC. 6. Support the standard DESTDIR parameter for the install target. Additionally, install Python.Runtime.dll and Python.Runtime.dll.config to the site-packages folder so it is found by the clr module. If you have any comments or if there are any issues with these patches please let me know. Philip -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 0001-Enable-Mono-config-loading.-This-fixes-an-issue-when.patch URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 0002-Add-mappings-for-Python-2.7-to-Mono-config.patch URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 0003-Fix-architecture-detection.-The-old-code-did-not-det.patch URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 0004-Rename-clrmodule.il-in-the-Makefile-build-to-clrmodu.patch URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 0005-Pass-ARCH-to-monoclr-Makefile-and-change-monoclr-Mak.patch URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 0006-Support-DESTDIR-parameter-when-installing-and-instal.patch URL: From lorenzph at googlemail.com Wed May 4 13:04:24 2011 From: lorenzph at googlemail.com (Philip Lorenz) Date: Wed, 04 May 2011 13:04:24 +0200 Subject: [Python.NET] Several patches to improve compilation with Mono Message-ID: <4DC132B8.2050205@gmail.com> Hi, after trying to compile Python for .NET on ArchLinux x86_64 I have run into several issues which the attached patches fix: 1. Enable Mono config file loading. Otherwise a Python build with UCS4 Unicode strings does not work as the Mono.Posix module cannot find msvcrt (which is mapped to libc in Mono's config files). 2. Python.Runtime.dll.config is missing mappings for Python 2.7 3. The architecture detection code in the Makefile did not work correctly (checking for the 86 substring is true for both x86 as well as x86_64 targets). 4. I have renamed the clrmodule.il target in the Makefile to clrmodule_make.il. Otherwise a fresh SVN checkout would not build as clrmodule.il is already included. 5. Adapt the clrmod Makefile to support Mono 2.8 pkgconfig change. Additionally, retrieve Glib 2 options from its pkgconfig and compile the x86_64 build with -fPIC. 6. Support the standard DESTDIR parameter for the install target. Additionally, install Python.Runtime.dll and Python.Runtime.dll.config to the site-packages folder so it is found by the clr module. If you have any comments or if there are any issues with these patches please let me know. Philip -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 0001-Enable-Mono-config-loading.-This-fixes-an-issue-when.patch URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 0002-Add-mappings-for-Python-2.7-to-Mono-config.patch URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 0003-Fix-architecture-detection.-The-old-code-did-not-det.patch URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 0004-Rename-clrmodule.il-in-the-Makefile-build-to-clrmodu.patch URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 0005-Pass-ARCH-to-monoclr-Makefile-and-change-monoclr-Mak.patch URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 0006-Support-DESTDIR-parameter-when-installing-and-instal.patch URL: From barton at BCDesignsWell.com Sun May 8 10:31:50 2011 From: barton at BCDesignsWell.com (Barton) Date: Sun, 08 May 2011 01:31:50 -0700 Subject: [Python.NET] Python 3 Support? In-Reply-To: <1304090118.2239.1446495085@webmail.messagingengine.com> References: <1304090118.2239.1446495085@webmail.messagingengine.com> Message-ID: <4DC654F6.8050602@BCDesignsWell.com> Plans? More like prayers... I'd love to do all the grunt work on this, but don't see a lot of free time in the near future. Yes. 2.7 is the highest know working version supported (and it has some issues - usually regarding importing 3rd party python modules that have some sort of manifest mismatch). If anyone feels like helping out on the next release, all that is needed is a deep understanding of the internal workings of python and as good smattering of C#. Thanks for the interest. On 4/29/2011 8:15 AM, Douglas Rohm wrote: > Hi, > Are there plans to add support for py3k? Is there a way I can get a > .NET .dll to work under py3k currently or will I have to use python > 2.7? Thanks. > Doug > > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet -------------- next part -------------- An HTML attachment was scrubbed... URL: From barton at BCDesignsWell.com Sun May 8 10:33:57 2011 From: barton at BCDesignsWell.com (Barton) Date: Sun, 08 May 2011 01:33:57 -0700 Subject: [Python.NET] Several patches to improve compilation with Mono In-Reply-To: <4DC1539E.1080509@googlemail.com> References: <4DC1539E.1080509@googlemail.com> Message-ID: <4DC65575.6060208@BCDesignsWell.com> Much appreciated! I'll get these applied to the subversion just as soon as I get a little free time. Thank you very much, Barton On 5/4/2011 6:24 AM, Philip Lorenz wrote: > Hi, > > after trying to compile Python for .NET on ArchLinux x86_64 I have run > into several issues which the attached patches fix: > > 1. Enable Mono config file loading. Otherwise a Python build with UCS4 > Unicode strings does not work as the Mono.Posix module cannot find > msvcrt (which is mapped to libc in Mono's config files). > 2. Python.Runtime.dll.config is missing mappings for Python 2.7 > 3. The architecture detection code in the Makefile did not work > correctly (checking for the 86 substring is true for both x86 as well as > x86_64 targets). > 4. I have renamed the clrmodule.il target in the Makefile to > clrmodule_make.il. Otherwise a fresh SVN checkout would not build as > clrmodule.il is already included. > 5. Adapt the clrmod Makefile to support Mono 2.8 pkgconfig change. > Additionally, retrieve Glib 2 options from its pkgconfig and compile > the x86_64 build with -fPIC. > 6. Support the standard DESTDIR parameter for the install target. > Additionally, install Python.Runtime.dll and Python.Runtime.dll.config > to the site-packages folder so it is found by the clr module. > > If you have any comments or if there are any issues with these patches > please let me know. > > Philip > > > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet -------------- next part -------------- An HTML attachment was scrubbed... URL: From adrianpe at bungie.com Tue May 17 03:29:36 2011 From: adrianpe at bungie.com (Adrian Perez) Date: Mon, 16 May 2011 18:29:36 -0700 Subject: [Python.NET] issue disambiguating overloaded method that takes an array Message-ID: Hello everyone, This is probably a total n00b question, but I've been using pythonnet in our toolchain to communicate with a private c# assembly for months now without ever running into a problem I couldn't eventually figure out. This one has me totally stumped, and I'm hoping something obvious will jump out at experienced eyes. (I did a find/replace for secrecy, besides silly names these are the raw results I get back) A C# class exposes a method 'WriteByte' that has 5 overloads (note that only one of them takes 2 arguments): >>> accessor= MyCompany.SomeNamespace.SomeTypeArrayAccessor >>> accessor.WriteByte.__overloads__ Boolean WriteByte(MyCompany.SomeNamespace.SomeType, Byte[]) Boolean WriteByte(MyCompany.SomeNamespace.SomeType, Byte[], Int32 ByRef) Boolean WriteByte(MyCompany.SomeNamespace.SomeType, System.Collections.Generic.IEnumerable`1[System.Byte], Int32 ByRef) Boolean WriteByte(MyCompany.SomeNamespace.SomeType, Int32, System.Collections.Generic.IEnumerable`1[System.Byte], Int32 ByRef) Boolean WriteByte(MyCompany.SomeNamespace.SomeType, Int32, Byte[], Int32 ByRef) I attempt to disambiguate by selecting the 2-arg method I want by type: >>> desired_method= accessor.WriteByte.__overloads__[MyCompany.SomeNamespace.SomeType, System.Array[System.Byte]] The problem may be right here - if I print out desired_method.__doc__ I get the same 5 methods listed above. Anyway, then I compute my arguments, and can verify they have the types I expect (If it matters, arg_b is created by a call to System.IO.BinaryReader.ReadBytes()): >>> arg_a= ... >>> arg_b= ... >>> type(arg_a) >>> type(arg_b) However, when I try to call the disambiguated method with the correct args, I get no love: >>> result= desired_method(arg_a, arg_b) Traceback (most recent call last): File "", line 1, in TypeError: No method matches given arguments Does anyone see the obvious thing I'm doing wrong? Disambiguating can be a pain but I've done it before for other methods and have never had such an impossible time getting the correct method called. Thanks, Adrian Perez From barton at BCDesignsWell.com Tue May 17 09:38:21 2011 From: barton at BCDesignsWell.com (Barton) Date: Tue, 17 May 2011 00:38:21 -0700 Subject: [Python.NET] issue disambiguating overloaded method that takes an array In-Reply-To: References: Message-ID: <4DD225ED.8080205@BCDesignsWell.com> def TestCharArray(): from System import Array charArrType = Array[Char] ##arrType = charArrType('hello') ##for char in arrType: ## print char, ## Also works on instances of the type! ## strCharArr = s.__overloads__[charArrType] s = strCharArr(list('hello')) print s On 5/16/2011 6:29 PM, Adrian Perez wrote: > Hello everyone, > > This is probably a total n00b question, but I've been using pythonnet in our toolchain to communicate with a private c# assembly for months now without ever running into a problem I couldn't eventually figure out. This one has me totally stumped, and I'm hoping something obvious will jump out at experienced eyes. > > (I did a find/replace for secrecy, besides silly names these are the raw results I get back) > > A C# class exposes a method 'WriteByte' that has 5 overloads (note that only one of them takes 2 arguments): > >>>> accessor= MyCompany.SomeNamespace.SomeTypeArrayAccessor >>>> accessor.WriteByte.__overloads__ > Boolean WriteByte(MyCompany.SomeNamespace.SomeType, Byte[]) > Boolean WriteByte(MyCompany.SomeNamespace.SomeType, Byte[], Int32 ByRef) > Boolean WriteByte(MyCompany.SomeNamespace.SomeType, System.Collections.Generic.IEnumerable`1[System.Byte], Int32 ByRef) > Boolean WriteByte(MyCompany.SomeNamespace.SomeType, Int32, System.Collections.Generic.IEnumerable`1[System.Byte], Int32 ByRef) > Boolean WriteByte(MyCompany.SomeNamespace.SomeType, Int32, Byte[], Int32 ByRef) > > I attempt to disambiguate by selecting the 2-arg method I want by type: > >>>> desired_method= accessor.WriteByte.__overloads__[MyCompany.SomeNamespace.SomeType, System.Array[System.Byte]] > The problem may be right here - if I print out desired_method.__doc__ I get the same 5 methods listed above. Anyway, then I compute my arguments, and can verify they have the types I expect (If it matters, arg_b is created by a call to System.IO.BinaryReader.ReadBytes()): > >>>> arg_a= ... >>>> arg_b= ... >>>> type(arg_a) > >>>> type(arg_b) > > > However, when I try to call the disambiguated method with the correct args, I get no love: > >>>> result= desired_method(arg_a, arg_b) > Traceback (most recent call last): > File "", line 1, in > TypeError: No method matches given arguments > > Does anyone see the obvious thing I'm doing wrong? Disambiguating can be a pain but I've done it before for other methods and have never had such an impossible time getting the correct method called. > > Thanks, > > Adrian Perez > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet > From danielstefanmader at googlemail.com Tue May 17 17:15:46 2011 From: danielstefanmader at googlemail.com (Daniel Mader) Date: Tue, 17 May 2011 17:15:46 +0200 Subject: [Python.NET] Python for .NET with PythonXY ? Message-ID: Dear list, with a couple of colleagues, I am using PythonXY as the main Python distribution when using Windows. It is based on Python 2.6 (2.7 is now in the focus so that the next release will be made for this). >From what we see it should be possible to make this installation ".NET aware" without duplicating anything. However, we can't really find the required steps to do so. Could you please point out what we'd need to download in order to proceed? Is there a "clean" installer so that PythonXY can be updated later? Or does a manual install interfere with this? Thank you many times in advance for a quick-installation guide, best regards, Daniel From dave.hirschfeld at gmail.com Tue May 17 17:50:30 2011 From: dave.hirschfeld at gmail.com (Dave Hirschfeld) Date: Tue, 17 May 2011 15:50:30 +0000 (UTC) Subject: [Python.NET] Python for .NET with PythonXY ? References: Message-ID: Daniel Mader writes: > > Dear list, > > with a couple of colleagues, I am using PythonXY as the main Python > distribution when using Windows. It is based on Python 2.6 (2.7 is now > in the focus so that the next release will be made for this). > > >From what we see it should be possible to make this installation ".NET > aware" without duplicating anything. However, we can't really find the > required steps to do so. > > Could you please point out what we'd need to download in order to > proceed? Is there a "clean" installer so that PythonXY can be updated > later? Or does a manual install interfere with this? > > Thank you many times in advance for a quick-installation guide, > best regards, > > Daniel > > To "install" Python.NET all you need to do is copy clr.pyd and Python.Runtime.dll to your Python (sys.prefix) directory. Don't know about any binary installers sorry, I've always just downloaded the source, compiled in VS and copied the files over. Works fine with PythonXY though as PythonXY doesn't know anything about the files it can't "uninstall" them (you'd just have to manually delete them) - e.g. Executing Python(x,y) 2.6.5.6 profile startup script: default.py Loading NumPy Loading SciPy Importing all NumPy functions, modules and classes Logging to C:\Users\dhirschfeld\.xy\logs\2011-05-17.py *** Pasting of code with ">>>" or "..." has been enabled. Qt: Could not initialize OLE (error 80010106) Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] Type "copyright", "credits" or "license" for more information. IPython 0.10.2 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object'. ?object also works, ?? prints more. IPython profile: xy Welcome to pylab, a matplotlib-based Python environment. For more information, type 'help(pylab)'. In [2]: import clr In [3]: import System In [4]: print System.DateTime.Now 17/05/2011 16:49:21 In [5]: HTH, Dave From adrianpe at bungie.com Tue May 17 19:18:01 2011 From: adrianpe at bungie.com (Adrian Perez) Date: Tue, 17 May 2011 10:18:01 -0700 Subject: [Python.NET] issue disambiguating overloaded method UPDATE In-Reply-To: <4DD22A1E.4060501@charter.net> References: <4DD225ED.8080205@BCDesignsWell.com> <4DD22A1E.4060501@charter.net> Message-ID: Thank you for the snippets. I had poured over the unit tests and seen similar examples of how to do this already, but two commentless replies inspired me to trace through this in a debugger. The issue ended up being that I was erroneously under the impression I was calling a static method, and was retrieving the method off of the 'type' object, rather than an instance of the type. The error you get back is the generic "no method matches given arguments", because my local 'desired_method' expected an initial 'self' argument, and so silently took 'arg_a' to be 'self'. This meant MethodBinder.Bind() only thought it had 1 input argument and could not match it to any of the overloads. Cheers, Adrian Perez -----Original Message----- From: BCline [mailto:bcline3078 at charter.net] Sent: Tuesday, May 17, 2011 12:56 AM Cc: Adrian Perez; pythondotnet at python.org Subject: Re: [Python.NET] issue disambiguating overloaded method UPDATE from System import String, Char, Int32 def TestCharArray(): from System import Array charArrType = Array[Char] ##arrType = charArrType('hello') ##for char in arrType: ## print char, ## Also works on instances of the type! ## strCharArr = String.__overloads__[charArrType] s = strCharArr(list('hello')) print s TestCharArray() On 5/17/2011 12:38 AM, Barton wrote: > > def TestCharArray(): > from System import Array > charArrType = Array[Char] > ##arrType = charArrType('hello') > ##for char in arrType: > ## print char, > ## Also works on instances of the type! ## > strCharArr = s.__overloads__[charArrType] > s = strCharArr(list('hello')) > print s > > On 5/16/2011 6:29 PM, Adrian Perez wrote: >> Hello everyone, >> >> This is probably a total n00b question, but I've been using pythonnet >> in our toolchain to communicate with a private c# assembly for months >> now without ever running into a problem I couldn't eventually figure >> out. This one has me totally stumped, and I'm hoping something >> obvious will jump out at experienced eyes. >> >> (I did a find/replace for secrecy, besides silly names these are the >> raw results I get back) >> >> A C# class exposes a method 'WriteByte' that has 5 overloads (note >> that only one of them takes 2 arguments): >> >>>>> accessor= MyCompany.SomeNamespace.SomeTypeArrayAccessor >>>>> accessor.WriteByte.__overloads__ >> Boolean WriteByte(MyCompany.SomeNamespace.SomeType, Byte[]) Boolean >> WriteByte(MyCompany.SomeNamespace.SomeType, Byte[], Int32 ByRef) >> Boolean WriteByte(MyCompany.SomeNamespace.SomeType, >> System.Collections.Generic.IEnumerable`1[System.Byte], Int32 ByRef) >> Boolean WriteByte(MyCompany.SomeNamespace.SomeType, Int32, >> System.Collections.Generic.IEnumerable`1[System.Byte], Int32 ByRef) >> Boolean WriteByte(MyCompany.SomeNamespace.SomeType, Int32, Byte[], >> Int32 ByRef) >> >> I attempt to disambiguate by selecting the 2-arg method I want by type: >> >>>>> desired_method= >>>>> accessor.WriteByte.__overloads__[MyCompany.SomeNamespace.SomeType, >>>>> System.Array[System.Byte]] >> The problem may be right here - if I print out desired_method.__doc__ >> I get the same 5 methods listed above. Anyway, then I compute my >> arguments, and can verify they have the types I expect (If it >> matters, arg_b is created by a call to >> System.IO.BinaryReader.ReadBytes()): >> >>>>> arg_a= ... >>>>> arg_b= ... >>>>> type(arg_a) >> >>>>> type(arg_b) >> >> >> However, when I try to call the disambiguated method with the correct >> args, I get no love: >> >>>>> result= desired_method(arg_a, arg_b) >> Traceback (most recent call last): >> File "", line 1, in >> TypeError: No method matches given arguments >> >> Does anyone see the obvious thing I'm doing wrong? Disambiguating >> can be a pain but I've done it before for other methods and have >> never had such an impossible time getting the correct method called. >> >> Thanks, >> >> Adrian Perez >> _________________________________________________ >> Python.NET mailing list - PythonDotNet at python.org >> http://mail.python.org/mailman/listinfo/pythondotnet >> From danielstefanmader at googlemail.com Wed May 18 10:29:32 2011 From: danielstefanmader at googlemail.com (Daniel Mader) Date: Wed, 18 May 2011 10:29:32 +0200 Subject: [Python.NET] Python for .NET with PythonXY ? In-Reply-To: References: Message-ID: Dear Dave. thank you very much for your quick reply, we've done as you recommended and it works beautifully! It was especially helpful that you pointed out that the python.exe itself is NOT necessary! Best regards, Daniel + colleagues 2011/5/17 Dave Hirschfeld : > Daniel Mader writes: > >> >> Dear list, >> >> with a couple of colleagues, I am using PythonXY as the main Python >> distribution when using Windows. It is based on Python 2.6 (2.7 is now >> in the focus so that the next release will be made for this). >> >> >From what we see it should be possible to make this installation ".NET >> aware" without duplicating anything. However, we can't really find the >> required steps to do so. >> >> Could you please point out what we'd need to download in order to >> proceed? Is there a "clean" installer so that PythonXY can be updated >> later? Or does a manual install interfere with this? >> >> Thank you many times in advance for a quick-installation guide, >> best regards, >> >> Daniel >> >> > > To "install" Python.NET all you need to do is copy clr.pyd and > Python.Runtime.dll to your Python (sys.prefix) directory. > > Don't know about any binary installers sorry, I've always just downloaded the > source, compiled in VS and copied the files over. > > > Works fine with PythonXY though as PythonXY doesn't know anything about the > files it can't "uninstall" them (you'd just have to manually delete them) - e.g. > > Executing Python(x,y) 2.6.5.6 profile startup script: default.py > ?Loading NumPy > ?Loading SciPy > ?Importing all NumPy functions, modules and classes > ?Logging to C:\Users\dhirschfeld\.xy\logs\2011-05-17.py > > *** Pasting of code with ">>>" or "..." has been enabled. > Qt: Could not initialize OLE (error 80010106) > Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] > Type "copyright", "credits" or "license" for more information. > > IPython 0.10.2 -- An enhanced Interactive Python. > ? ? ? ? ? -> Introduction and overview of IPython's features. > %quickref -> Quick reference. > help ? ? ?-> Python's own help system. > object? ? -> Details about 'object'. ?object also works, ?? prints more. > > IPython profile: xy > > ?Welcome to pylab, a matplotlib-based Python environment. > ?For more information, type 'help(pylab)'. > > In [2]: import clr > > In [3]: import System > > In [4]: print System.DateTime.Now > 17/05/2011 16:49:21 > > In [5]: > > HTH, > Dave > > > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet From Dawn at porticohr.com Mon May 9 21:01:03 2011 From: Dawn at porticohr.com (Dawn Vale) Date: Mon, 9 May 2011 14:01:03 -0500 Subject: [Python.NET] Django Developers Needed! Message-ID: <35F40966557A7649B71A316225FE15D9295AD9@PHR-SERVER.porticohr.local> I am a recruiter in Des Moines, IA working with a client that is in need of Django Developers. My client, an Iowa?based company that offers the first and only end?to?end solution for external financial reporting. The company develops and markets a fully?integrated, cloud?based solution dedicated to meeting SEC reporting requirements. Growing company which offers excellent benefits and stock options starting day one. If you or know of anyone that would be interested, below is my contact information. Dawn Vale PorticoHR 2910 Westown Parkway, Ste. 106 W. Des Moines, IA 50266 dawn at porticohr.com www.porticohr.com 515-221-3233 - phone 515-221-3236 - fax Please Be GREEN Don't print this e-mail unless really necessary! https://twitter.com/PorticoHR http://porticohr.blogspot.com Directions: We are located one block EAST of Valley West Mall on the southeast corner of Westown Parkway and 30th. Turn south on 30th and make a left into the parking lot. We are the first floor. Make a left at the elevator and we are at the end of the hall. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bcline3078 at charter.net Tue May 17 09:56:14 2011 From: bcline3078 at charter.net (BCline) Date: Tue, 17 May 2011 00:56:14 -0700 Subject: [Python.NET] issue disambiguating overloaded method UPDATE In-Reply-To: <4DD225ED.8080205@BCDesignsWell.com> References: <4DD225ED.8080205@BCDesignsWell.com> Message-ID: <4DD22A1E.4060501@charter.net> from System import String, Char, Int32 def TestCharArray(): from System import Array charArrType = Array[Char] ##arrType = charArrType('hello') ##for char in arrType: ## print char, ## Also works on instances of the type! ## strCharArr = String.__overloads__[charArrType] s = strCharArr(list('hello')) print s TestCharArray() On 5/17/2011 12:38 AM, Barton wrote: > > def TestCharArray(): > from System import Array > charArrType = Array[Char] > ##arrType = charArrType('hello') > ##for char in arrType: > ## print char, > ## Also works on instances of the type! ## > strCharArr = s.__overloads__[charArrType] > s = strCharArr(list('hello')) > print s > > On 5/16/2011 6:29 PM, Adrian Perez wrote: >> Hello everyone, >> >> This is probably a total n00b question, but I've been using pythonnet >> in our toolchain to communicate with a private c# assembly for months >> now without ever running into a problem I couldn't eventually figure >> out. This one has me totally stumped, and I'm hoping something >> obvious will jump out at experienced eyes. >> >> (I did a find/replace for secrecy, besides silly names these are the >> raw results I get back) >> >> A C# class exposes a method 'WriteByte' that has 5 overloads (note >> that only one of them takes 2 arguments): >> >>>>> accessor= MyCompany.SomeNamespace.SomeTypeArrayAccessor >>>>> accessor.WriteByte.__overloads__ >> Boolean WriteByte(MyCompany.SomeNamespace.SomeType, Byte[]) >> Boolean WriteByte(MyCompany.SomeNamespace.SomeType, Byte[], Int32 ByRef) >> Boolean WriteByte(MyCompany.SomeNamespace.SomeType, >> System.Collections.Generic.IEnumerable`1[System.Byte], Int32 ByRef) >> Boolean WriteByte(MyCompany.SomeNamespace.SomeType, Int32, >> System.Collections.Generic.IEnumerable`1[System.Byte], Int32 ByRef) >> Boolean WriteByte(MyCompany.SomeNamespace.SomeType, Int32, Byte[], >> Int32 ByRef) >> >> I attempt to disambiguate by selecting the 2-arg method I want by type: >> >>>>> desired_method= >>>>> accessor.WriteByte.__overloads__[MyCompany.SomeNamespace.SomeType, >>>>> System.Array[System.Byte]] >> The problem may be right here - if I print out desired_method.__doc__ >> I get the same 5 methods listed above. Anyway, then I compute my >> arguments, and can verify they have the types I expect (If it >> matters, arg_b is created by a call to >> System.IO.BinaryReader.ReadBytes()): >> >>>>> arg_a= ... >>>>> arg_b= ... >>>>> type(arg_a) >> >>>>> type(arg_b) >> >> >> However, when I try to call the disambiguated method with the correct >> args, I get no love: >> >>>>> result= desired_method(arg_a, arg_b) >> Traceback (most recent call last): >> File "", line 1, in >> TypeError: No method matches given arguments >> >> Does anyone see the obvious thing I'm doing wrong? Disambiguating >> can be a pain but I've done it before for other methods and have >> never had such an impossible time getting the correct method called. >> >> Thanks, >> >> Adrian Perez >> _________________________________________________ >> Python.NET mailing list - PythonDotNet at python.org >> http://mail.python.org/mailman/listinfo/pythondotnet >> From barton at bcdesignswell.com Sat May 21 20:30:41 2011 From: barton at bcdesignswell.com (Barton) Date: Sat, 21 May 2011 11:30:41 -0700 Subject: [Python.NET] [ pythonnet-Bugs-3303462 ] Stack corruption Message-ID: <4DD804D1.1090608@bcdesignswell.com> Thank you very much! It will be helpful for us to know which platform (Windows [Mono or .NET] vs Linux) where this is happening. On 05/17/11 10:52, SourceForge.net wrote: > Bugs item #3303462, was opened at 2011-05-18 02:52 > Message generated for change (Tracker Item Submitted) made by christallire > You can respond by visiting: > https://sourceforge.net/tracker/?func=detail&atid=823891&aid=3303462&group_id=162464 > > Please note that this message will contain a full copy of the comment thread, > including the initial issue submission, for this request, > not just the latest update. > Category: None > Group: None > Status: Open > Resolution: None > Priority: 5 > Private: No > Submitted By: xeph (christallire) > Assigned to: Nobody/Anonymous (nobody) > Summary: Stack corruption > > Initial Comment: > I'm using python.net heavily in my server/client project > > I found Stack buffer overflow exception OR stack corruption exception is caused when python script throws an exception, which is caught by CLR code especially when GC is collecting its own objects. > I think this problem is caused when allocated objects are unwinded by CLR engine. > (threw in CLR GC Collection/GC Security Cookie Check) > > I found problem this 2 months ago, been struggling to solve this problem, because it happens rarely, randomly when GC is collecting objects > I solved this problem via removing all of pythonexception throwing code from PythonEngine, changed to return parameters to null > > Hope you have better solution for solve this problem :) > > ---------------------------------------------------------------------- > > You can respond by visiting: > https://sourceforge.net/tracker/?func=detail&atid=823891&aid=3303462&group_id=162464 >