From craig at coot.net Thu Feb 3 02:40:52 2005 From: craig at coot.net (Craig H. Anderson) Date: Thu Feb 3 02:56:24 2005 Subject: [Python.NET] Python Asp.net for real? Message-ID: Are there some examples out there of asp.net WebForms done with Python for .net? I've spent several years working with Python and forgetting C++. My current job is migrating to an Asp.net shop. Today I'm trying to learn some Web Form programming and translate some working Python database code to vb.net. I stumbled across http://www.zope.org/Members/Brian/PythonNet/ and wonder if I should try this out. Thanks. From monkey at gmx.info Thu Feb 3 10:04:46 2005 From: monkey at gmx.info (Andreas Schmid) Date: Thu Feb 3 10:03:48 2005 Subject: [Python.NET] Python Asp.net for real? References: Message-ID: <002301c509cf$68bca180$1900a8c0@Desktop> You shouldn't. Unless I'm mistaken you end up using .NET functionality exclusively which is totally incompatible with Python's functionality - e.g. instances of class Array cannot be used as lists in Python without any dirty conversion going on. You lose all Python's benefits - I find it much easier, much faster and much cleaner to directly program in C#. -Andreas ----- Original Message ----- From: "Craig H. Anderson" To: Sent: Thursday, February 03, 2005 2:40 AM Subject: [Python.NET] Python Asp.net for real? > > Are there some examples out there of asp.net > WebForms done with Python for .net? > I've spent several years working with Python and > forgetting C++. My current job is migrating to > an Asp.net shop. Today I'm trying to learn some > Web Form programming and translate some working > Python database code to vb.net. I stumbled across > http://www.zope.org/Members/Brian/PythonNet/ > and wonder if I should try this out. > Thanks. > _________________________________________________ > Python.NET mailing list - PythonDotNet@python.org > http://mail.python.org/mailman/listinfo/pythondotnet > From brian at zope.com Thu Feb 3 19:40:45 2005 From: brian at zope.com (Brian Lloyd) Date: Thu Feb 3 19:41:12 2005 Subject: [Python.NET] Python Asp.net for real? In-Reply-To: Message-ID: > Are there some examples out there of asp.net > WebForms done with Python for .net? > > I've spent several years working with Python and > forgetting C++. My current job is migrating to > an Asp.net shop. Today I'm trying to learn some > Web Form programming and translate some working > Python database code to vb.net. I stumbled across > http://www.zope.org/Members/Brian/PythonNet/ > and wonder if I should try this out. Python for .NET doesn't actually compile to IL, so it won't let you use Python in asp.net pages. In theory, you could do that at some point with IronPython, but its status becomes more unclear by the day... ;( Brian Lloyd brian@zope.com V.P. Engineering 540.361.1716 Zope Corporation http://www.zope.com From stan at phidani.be Thu Feb 3 20:38:12 2005 From: stan at phidani.be (Stan Pinte) Date: Thu Feb 3 20:38:11 2005 Subject: [Python.NET] Python Asp.net for real? In-Reply-To: References: Message-ID: <42027DA4.4050804@phidani.be> Brian Lloyd a ?crit : >>Are there some examples out there of asp.net >>WebForms done with Python for .net? >> >>I've spent several years working with Python and >>forgetting C++. My current job is migrating to >>an Asp.net shop. Today I'm trying to learn some >>Web Form programming and translate some working >>Python database code to vb.net. I stumbled across >>http://www.zope.org/Members/Brian/PythonNet/ >>and wonder if I should try this out. >> >> > >Python for .NET doesn't actually compile to IL, so it won't let >you use Python in asp.net pages. > > I suggest you try http://boo.codehaus.org/. It is really close to python, and runs on top of the IL. From Peter.Schwalm at epost.de Sun Feb 6 01:58:27 2005 From: Peter.Schwalm at epost.de (Peter Schwalm) Date: Sun Feb 6 01:58:38 2005 Subject: [Python.NET] Conversion of single precision floating point to python floats Message-ID: <001301c50be6$f7ccb9a0$01000080@pschwalm.de> Hi Brian, I recently had a problem retrieving a float value from a dotNet function. I had a conversion error which was caused by the local setting of the decimal separator (a comma here in germany). I figured out that you have already corrected this problem in cvs. Before I found these correction I have tried the following version, which I would prefer because it does not use an intermediate string for the conversion. I don't know if you use this intermediate string accidentally - possibly for the sake of rounding that happens during conversion to a string? Anyway I would like to communicate my solution (your last cvs version commented out): namespace Python.Runtime { ... internal class Converter { ... internal static IntPtr ToPython(Object value, Type type) { ... case TypeCode.Single: // string ss = ((float)value).ToString(nfi); // IntPtr ps = Runtime.PyString_FromString(ss); // IntPtr op = Runtime.PyFloat_FromString(ps, IntPtr.Zero); // Runtime.Decref(ps); // return op; return Runtime.PyFloat_FromDouble((double) ((float)value)); Greetings Peter Schwalm From awatters at connotate.com Mon Feb 7 15:05:34 2005 From: awatters at connotate.com (Aaron Watters) Date: Mon Feb 7 15:05:40 2005 Subject: [Python.NET] Python Asp.net for real? Message-ID: <7B4C0B5178890D48A2E70BB1EA994764467F04@raffertys.connotate.com> Since you teased us, Brian, could you expand on the status Of IronPython? Thanks, Aaron Watters. From brian at zope.com Mon Feb 7 15:22:25 2005 From: brian at zope.com (Brian Lloyd) Date: Mon Feb 7 15:22:58 2005 Subject: [Python.NET] Python Asp.net for real? In-Reply-To: <7B4C0B5178890D48A2E70BB1EA994764467F04@raffertys.connotate.com> Message-ID: > Since you teased us, Brian, could you expand on the status > Of IronPython? Thanks, Aaron Watters. > Unfortunately, I don't know any more than anyone else. Jim seems to have 'gone underground' or something - I guess we just have to wait for him to surface and give us an update ;) Brian Lloyd brian@zope.com V.P. Engineering 540.361.1716 Zope Corporation http://www.zope.com From brian at zope.com Mon Feb 7 16:40:54 2005 From: brian at zope.com (Brian Lloyd) Date: Mon Feb 7 16:41:23 2005 Subject: [Python.NET] RE: Conversion of single precision floating point to python floats In-Reply-To: <001301c50be6$f7ccb9a0$01000080@pschwalm.de> Message-ID: Hi Peter - there is some rounding problem with the PyFloat_FromDouble approach (if you compile with that and run the unit tests, you'll see a number of them fail). The temp string is a workaround for now. Thanks for the note though - if you have time to find an approach that lets tests pass and avoids the temp, I'd be happy to check it in ;) Brian Lloyd brian@zope.com V.P. Engineering 540.361.1716 Zope Corporation http://www.zope.com > -----Original Message----- > From: Peter Schwalm [mailto:Peter.Schwalm@epost.de] > Sent: Saturday, February 05, 2005 7:58 PM > To: Brian Lloyd; pythondotnet@python.org > Subject: Conversion of single precision floating point to python floats > > > Hi Brian, > > I recently had a problem retrieving a float value from a dotNet > function. I > had a conversion error which was caused by the local setting of > the decimal > separator (a comma here in germany). > > I figured out that you have already corrected this problem in > cvs. Before I > found these correction I have tried the following version, which I would > prefer because it does not use an intermediate string for the conversion. > > I don't know if you use this intermediate string accidentally - > possibly for > the sake of rounding that happens during conversion to a string? > > Anyway I would like to communicate my solution (your last cvs version > commented out): > > namespace Python.Runtime { > ... > internal class Converter { > ... > internal static IntPtr ToPython(Object value, Type type) { > ... > > case TypeCode.Single: > // string ss = ((float)value).ToString(nfi); > // IntPtr ps = Runtime.PyString_FromString(ss); > // IntPtr op = Runtime.PyFloat_FromString(ps, IntPtr.Zero); > // Runtime.Decref(ps); > // return op; > return Runtime.PyFloat_FromDouble((double) ((float)value)); > > Greetings > Peter Schwalm > > From diener at ORsoftware.com Mon Feb 7 19:53:39 2005 From: diener at ORsoftware.com (Edward Diener) Date: Mon Feb 7 19:53:52 2005 Subject: [Python.NET] .NET character and byte Message-ID: What is the Python equivalent to the .NET 'char' and 'byte' types ? I need to pass in an array of bytes to a .NET constructor and when I attempted to pass in a list of strings of single characters, it failed. Is there a way of doing this in PythonDotNet ? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20050207/906e3634/attachment.html From michael.jonesw at rbos.com Tue Feb 8 12:17:28 2005 From: michael.jonesw at rbos.com (JONES, Michael, FM Quantitative Research) Date: Tue Feb 8 12:18:57 2005 Subject: [Python.NET] Loss of import hook? Message-ID: Hello, I've just unzipped Python.Net, and copied the two DLLs to my c:\Python24 ActivePython install directory, but if I first import CLR on it's own, then python seems to lose its import hook? ActivePython 2.4 Build 243 (ActiveState Corp.) based on Python 2.4 (#60, Nov 30 2004, 09:34:21) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import CLR >>> from CLR.System.Reflection import Assembly Traceback (most recent call last): File "", line 1, in ? ImportError: __import__ not found >>> If on the other hand I don't import CLR to begin with then it takes two attempts to import a module: ActivePython 2.4 Build 243 (ActiveState Corp.) based on Python 2.4 (#60, Nov 30 2004, 09:34:21) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from CLR.System.Reflection import Assembly Traceback (most recent call last): File "", line 1, in ? ImportError: No module named System.Reflection >>> from CLR.System.Reflection import Assembly >>> What am I doing wrong? Thanks, Michael *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: http://www.rbs.co.uk/CBFM http://www.rbsmarkets.com ******************************************************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20050208/dae6a996/attachment.html From michael.jonesw at rbos.com Tue Feb 8 13:00:09 2005 From: michael.jonesw at rbos.com (JONES, Michael, FM Quantitative Research) Date: Tue Feb 8 13:00:47 2005 Subject: [Python.NET] ToString method Message-ID: Hello again, Is there a reason why the ToString method doesn't automatically map to the __str__ python method? Thanks, Michael *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: http://www.rbs.co.uk/CBFM http://www.rbsmarkets.com ******************************************************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20050208/dee6fd7f/attachment.htm From stan at phidani.be Tue Feb 8 13:40:15 2005 From: stan at phidani.be (Stan Pinte) Date: Tue Feb 8 13:40:15 2005 Subject: [Python.NET] managed exception stack trace. In-Reply-To: References: Message-ID: <4208B32F.8010603@phidani.be> Brian Lloyd a ?crit : >>I am using pythonNet with a great pleasure, thanks a lot for that piece >>of work. >> >>IMHO, a wiki would be very very useful for this project, as I would be >>ready to contribute... >> >>One question: >> >>How do I print out managed exceptions full stack trace? >> >> > >Hi Stan - > >A trick you might be able to use is: > >print CLR.System.Environment.StackTrace > > unfortunately not: try: #do stuff that throws exception in the CLR except: print Environment.StackTrace gives what printed below, wich is fairly unusable. at System.Environment.GetStackTrace(Exception e)^M at System.Environment.GetStackTrace(Exception e)^M at System.Environment.get_StackTrace()^M at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlag s invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean i sBinderDefault, Assembly caller, Boolean verifyAccess)^M at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlag s invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean v erifyAccess)^M at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invoke Attr, Binder binder, Object[] parameters, CultureInfo culture)^M at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) at Python.Runtime.PropertyObject.tp_descr_get(IntPtr ds, IntPtr ob, IntPtr tp )^M at Python.Runtime.Runtime.Py_Main(Int32 argc, String[] argv)^M at Python.Runtime.PythonConsole.Main(String[] args) >Exceptions are in kind of an odd state right now - the C Python runtime >really wants exceptions to be old-style Python classes, and the fact >that managed exceptions aren't causes some problems in the current >version of Python for .NET. I'm still hoping to find a sneaky way >around it or successfully lobby the Python devs to remove this >restriction for a future Python version. > >Brian Lloyd brian@zope.com >V.P. Engineering 540.361.1716 >Zope Corporation http://www.zope.com > > > > > > From brian at zope.com Tue Feb 8 16:50:29 2005 From: brian at zope.com (Brian Lloyd) Date: Tue Feb 8 16:51:01 2005 Subject: [Python.NET] .NET character and byte In-Reply-To: Message-ID: Hi Edward - A Python string object or unicode object should convert to char[] automatically. Right now, the Byte converter expects to convert an int rather than a string, so a workaround might be to convert your list of strings to a list of ints to pass to the constructor: stuff = ['s', 't', 'u', 'f', 'f'] asint = map(ord, stuff) # pass asint to the constructor Hope this helps - I'll add a tracker issue that the converter should probably be smart enough to convert a string to a byte array by itself... Brian Lloyd brian@zope.com V.P. Engineering 540.361.1716 Zope Corporation http://www.zope.com -----Original Message----- From: pythondotnet-bounces@python.org [mailto:pythondotnet-bounces@python.org]On Behalf Of Edward Diener Sent: Monday, February 07, 2005 1:54 PM To: pythondotnet@python.org Subject: [Python.NET] .NET character and byte What is the Python equivalent to the .NET 'char' and 'byte' types ? I need to pass in an array of bytes to a .NET constructor and when I attempted to pass in a list of strings of single characters, it failed. Is there a way of doing this in PythonDotNet ? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20050208/7a0e4d5e/attachment.html From simonroses at granisla.com Thu Feb 10 12:18:09 2005 From: simonroses at granisla.com (Simon Roses Femerling) Date: Thu Feb 10 12:18:11 2005 Subject: [Python.NET] PythonNet VS IronPython ? Message-ID: <00a901c50f62$336dc250$4c0818ac@dis> I have just come across pythonNet and looks very nice! Can somebody tell me the differences between PythonNet and IronPython, besides Net support? Note a part: Any good examples of embedding PythonNet on c# app ? :) Thx, Sincerely, Simon Roses Femerling Consultor en Seguridad / IT Security Consultant IT Deusto http://www.itdeusto.com Madrid, Spain -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20050210/842a077b/attachment.htm From sroses at itdeusto.com Thu Feb 10 10:59:20 2005 From: sroses at itdeusto.com (Simon Roses Femerling) Date: Thu Feb 10 15:26:49 2005 Subject: [Python.NET] PythonNet VS IronPython ? Message-ID: <005c01c50f57$31d76be0$4c0818ac@dis> I have just come across pythonNet and looks very nice! Can somebody tell me the differences between PythonNet and IronPython, besides Net support? Note a part: Any good examples of embedding PythonNet on c# app ? :) Thx, Sincerely, Simon Roses Femerling Consultor en Seguridad / IT Security Consultant IT Deusto http://www.itdeusto.com Madrid, Spain -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20050210/62c3f26a/attachment.htm From hernan.martinez at ecc.es Thu Feb 10 17:58:06 2005 From: hernan.martinez at ecc.es (=?iso-8859-1?Q?Hern=E1n_Mart=EDnez_Foffani?=) Date: Thu Feb 10 17:59:27 2005 Subject: [Python.NET] PythonNet VS IronPython ? In-Reply-To: <00a901c50f62$336dc250$4c0818ac@dis> Message-ID: > Can somebody tell me the differences between PythonNet and > IronPython, besides Net support? In short, IronPython is a Python compiler which targets the CLI while PythonNet is the standard Python interpreter with a bridge to the .NET Framework. Regards, -Hern?n. From mark at walkereconomics.com Fri Feb 11 06:16:45 2005 From: mark at walkereconomics.com (Mark Anderson) Date: Fri Feb 11 06:17:09 2005 Subject: [Python.NET] Sample embedding code? Message-ID: <420C3FBD.2040703@walkereconomics.com> Hi all ; I'm a total neophyte at this, and am hoping to avoid a lot of time consuming experimentation. I've got an existing VB.NET app which I'd like to make scriptable using Python for .NET. The app is a client server thing where a fat client calls a bunch of webmethods. If anyone can post or point me to some example / template code which illustrates the necessary steps, it'd reallly help me out. Thanks, Mark Anderson From brian at zope.com Fri Feb 11 21:04:52 2005 From: brian at zope.com (Brian Lloyd) Date: Fri Feb 11 21:05:40 2005 Subject: [Python.NET] Loss of import hook? In-Reply-To: Message-ID: MessageThis appears to be a bug - I can reproduce it in a stock Python 2.4 :( I'll have to look and see if this is new to 2.4 or what. Brian Lloyd brian@zope.com V.P. Engineering 540.361.1716 Zope Corporation http://www.zope.com -----Original Message----- From: pythondotnet-bounces@python.org [mailto:pythondotnet-bounces@python.org]On Behalf Of JONES, Michael, FM Quantitative Research Sent: Tuesday, February 08, 2005 6:17 AM To: 'pythondotnet@python.org' Subject: [Python.NET] Loss of import hook? Hello, I've just unzipped Python.Net, and copied the two DLLs to my c:\Python24 ActivePython install directory, but if I first import CLR on it's own, then python seems to lose its import hook? ActivePython 2.4 Build 243 (ActiveState Corp.) based on Python 2.4 (#60, Nov 30 2004, 09:34:21) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import CLR >>> from CLR.System.Reflection import Assembly Traceback (most recent call last): File "", line 1, in ? ImportError: __import__ not found >>> If on the other hand I don't import CLR to begin with then it takes two attempts to import a module: ActivePython 2.4 Build 243 (ActiveState Corp.) based on Python 2.4 (#60, Nov 30 2004, 09:34:21) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from CLR.System.Reflection import Assembly Traceback (most recent call last): File "", line 1, in ? ImportError: No module named System.Reflection >>> from CLR.System.Reflection import Assembly >>> What am I doing wrong? Thanks, Michael **************************************************************************** ******* The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: http://www.rbs.co.uk/CBFM http://www.rbsmarkets.com **************************************************************************** **** -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20050211/6fc93233/attachment.html From bksasha at zahav.net.il Sun Feb 13 15:23:44 2005 From: bksasha at zahav.net.il (bksasha@zahav.net.il) Date: Sun Feb 13 15:23:49 2005 Subject: [Python.NET] Zope Message-ID: <00b301c511d7$a04b7df0$0500000a@gate> Greetings Does enayone have a good experionce of using Python .NET with Zope? Thanks Alexander -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20050213/1fd8b1ad/attachment.htm From brian at zope.com Mon Feb 14 04:15:39 2005 From: brian at zope.com (Brian Lloyd) Date: Mon Feb 14 04:15:46 2005 Subject: [Python.NET] Zope In-Reply-To: <00b301c511d7$a04b7df0$0500000a@gate> Message-ID: <20050214031543.2AE733B8038@smtp.zope.com> > Greetings > > Does enayone have a good experionce of using Python .NET with Zope? > > Thanks > Alexander Hi Alexander - last time I experimented, there were some odd thread problems when running under Zope. They are probably non-trivial to figure out, given the various threading rules of Python and the .NET runtime, but I'd be willing to help suss them out as I'm able. Alternatively, if the connection point that you need is small enough, you might consider setting up an external process as an xml-rpc server or something and talking to that from Zope. Not ideal, but it would work around any thread issues... Brian Lloyd brian@zope.com V.P. Engineering 540.361.1716 Zope Corporation http://www.zope.com From tduong at alarismed.com Sun Feb 20 00:28:44 2005 From: tduong at alarismed.com (Duong, Thuy) Date: Tue Feb 22 15:38:17 2005 Subject: [Python.NET] Python for .NET, multithreading case. Message-ID: <4071C0F50B14104AAB7A0AD4F55F5269DACDEB@wrexc01.na.alarismed.com> Hi Brian, We've been using Python for .NET and it's been working pretty well interacting with a .NET DLL. However, we've encountered some problems with this multithreading scenario: 1) Create a "main" thread called: ThreadA 2) ThreadA can successfully invoke our .NET DLL. 3) ThreadA now spawns a child thread: Threadaa 4) Threadaa unsuccessfully invokes the .NET DLL. When we wrote to the console, we see Threadaa invoke the .NET DLL but the control never returns back to Threadaa after the .NET DLL call. Do you have any thoughts on this and do you have any suggestions? Thanks in advance for your help! Regards, Thuy Duong From brian at zope.com Tue Feb 22 15:39:17 2005 From: brian at zope.com (Brian Lloyd) Date: Tue Feb 22 15:39:23 2005 Subject: [Python.NET] RE: Python for .NET, multithreading case. In-Reply-To: <4071C0F50B14104AAB7A0AD4F55F5269DACDEB@wrexc01.na.alarismed.com> Message-ID: Just to clarify - are you creating these threads from Python or from managed code? Brian Lloyd brian@zope.com V.P. Engineering 540.361.1716 Zope Corporation http://www.zope.com > -----Original Message----- > From: Duong, Thuy [mailto:tduong@alarismed.com] > Sent: Saturday, February 19, 2005 6:29 PM > To: pythondotnet@python.org; brian@zope.com > Cc: Smith, Don S. (ALARIS); vantuando@computer.org > Subject: Python for .NET, multithreading case. > > > Hi Brian, > > We've been using Python for .NET and it's been working pretty > well interacting > with a .NET DLL. However, we've encountered some problems with > this multithreading > scenario: > > 1) Create a "main" thread called: ThreadA > 2) ThreadA can successfully invoke our .NET DLL. > 3) ThreadA now spawns a child thread: Threadaa > 4) Threadaa unsuccessfully invokes the .NET DLL. > When we wrote to the console, we see Threadaa invoke the .NET DLL but > the control never returns back to Threadaa after the .NET DLL call. > > Do you have any thoughts on this and do you have any suggestions? > Thanks in advance for your help! > > > Regards, > > Thuy Duong > From tduong at alarismed.com Tue Feb 22 18:50:27 2005 From: tduong at alarismed.com (Duong, Thuy) Date: Tue Feb 22 18:50:31 2005 Subject: [Python.NET] RE: Python for .NET, multithreading case. Message-ID: <4071C0F50B14104AAB7A0AD4F55F5269DACDF4@wrexc01.na.alarismed.com> Hi Brian, Thanks for getting back to us so promptly! The threads (ThreadA and Threadaa) are created from Python and invoke the .NET DLL. Pls. let us know if you need any additional information. Thanks. -thuy -----Original Message----- From: Brian Lloyd [mailto:brian@zope.com] Sent: Tuesday, February 22, 2005 6:39 AM To: Duong, Thuy; pythondotnet@python.org Cc: Smith, Don S. (ALARIS); vantuando@computer.org Subject: RE: Python for .NET, multithreading case. Just to clarify - are you creating these threads from Python or from managed code? Brian Lloyd brian@zope.com V.P. Engineering 540.361.1716 Zope Corporation http://www.zope.com > -----Original Message----- > From: Duong, Thuy [mailto:tduong@alarismed.com] > Sent: Saturday, February 19, 2005 6:29 PM > To: pythondotnet@python.org; brian@zope.com > Cc: Smith, Don S. (ALARIS); vantuando@computer.org > Subject: Python for .NET, multithreading case. > > > Hi Brian, > > We've been using Python for .NET and it's been working pretty > well interacting > with a .NET DLL. However, we've encountered some problems with > this multithreading > scenario: > > 1) Create a "main" thread called: ThreadA > 2) ThreadA can successfully invoke our .NET DLL. > 3) ThreadA now spawns a child thread: Threadaa > 4) Threadaa unsuccessfully invokes the .NET DLL. > When we wrote to the console, we see Threadaa invoke the .NET DLL but > the control never returns back to Threadaa after the .NET DLL call. > > Do you have any thoughts on this and do you have any suggestions? > Thanks in advance for your help! > > > Regards, > > Thuy Duong > From brian at zope.com Tue Feb 22 19:16:56 2005 From: brian at zope.com (Brian Lloyd) Date: Tue Feb 22 19:17:02 2005 Subject: [Python.NET] RE: Python for .NET, multithreading case. In-Reply-To: <4071C0F50B14104AAB7A0AD4F55F5269DACDF4@wrexc01.na.alarismed.com> Message-ID: <20050222181659.E35163B805B@smtp.zope.com> If you can post (or email me directly) the Python code that you use to create the threads, that would help me in making a test case (just to make sure any subtle differences aren't lost...) -Thanks Brian Lloyd brian@zope.com V.P. Engineering 540.361.1716 Zope Corporation http://www.zope.com > -----Original Message----- > From: Duong, Thuy [mailto:tduong@alarismed.com] > Sent: Tuesday, February 22, 2005 12:50 PM > To: Brian Lloyd; pythondotnet@python.org > Cc: vantuando@computer.org; Smith, Daniel > Subject: RE: Python for .NET, multithreading case. > > Hi Brian, > > Thanks for getting back to us so promptly! > > The threads (ThreadA and Threadaa) are created from Python and invoke > the .NET DLL. > > Pls. let us know if you need any additional information. > > Thanks. > > -thuy > > -----Original Message----- > From: Brian Lloyd [mailto:brian@zope.com] > Sent: Tuesday, February 22, 2005 6:39 AM > To: Duong, Thuy; pythondotnet@python.org > Cc: Smith, Don S. (ALARIS); vantuando@computer.org > Subject: RE: Python for .NET, multithreading case. > > > Just to clarify - are you creating these threads from > Python or from managed code? > > > Brian Lloyd brian@zope.com > V.P. Engineering 540.361.1716 > Zope Corporation http://www.zope.com > > > > -----Original Message----- > > From: Duong, Thuy [mailto:tduong@alarismed.com] > > Sent: Saturday, February 19, 2005 6:29 PM > > To: pythondotnet@python.org; brian@zope.com > > Cc: Smith, Don S. (ALARIS); vantuando@computer.org > > Subject: Python for .NET, multithreading case. > > > > > > Hi Brian, > > > > We've been using Python for .NET and it's been working pretty > > well interacting > > with a .NET DLL. However, we've encountered some problems with > > this multithreading > > scenario: > > > > 1) Create a "main" thread called: ThreadA > > 2) ThreadA can successfully invoke our .NET DLL. > > 3) ThreadA now spawns a child thread: Threadaa > > 4) Threadaa unsuccessfully invokes the .NET DLL. > > When we wrote to the console, we see Threadaa invoke the > .NET DLL but > > the control never returns back to Threadaa after the .NET DLL call. > > > > Do you have any thoughts on this and do you have any suggestions? > > Thanks in advance for your help! > > > > > > Regards, > > > > Thuy Duong > > > From tduong at alarismed.com Thu Feb 24 09:02:39 2005 From: tduong at alarismed.com (Duong, Thuy) Date: Thu Feb 24 09:02:42 2005 Subject: [Python.NET] RE: Python for .NET, multithreading case. Message-ID: <4071C0F50B14104AAB7A0AD4F55F5269DACDF8@wrexc01.na.alarismed.com> Hi Brian, Sorry for the late reply. I've attached the Python script (_M4.py) which invokes the .NET DLL. Basically, the following happens: 1) Create a "main" thread called: Main Thread 2) Main Thread can successfully invoke the function: GetOne() in our .NET DLL. GetOne() simply prints: "Entering the C# static function GetOne()" and returns "1". 3) Main Thread now spawns a child thread: Child Thread 4) Child Thread unsuccessfully invokes the .NET DLL. When we wrote to the console, we see Child Thread entering into GetOne() but the control never returns back to Child Thread after that. Below is the actual console print out when I ran the script. ===> D:\PythonNet-1.0-beta4>python _m4.py Entering the C# static function GetOne() Main Thread - GetOne() 1 ######init MessageRouter ######run MessageRouter - Child Thread Child Thread starts Entering the C# static function GetOne() ===> Thanks for looking into this. -thuy -----Original Message----- From: Brian Lloyd To: Duong, Thuy; pythondotnet@python.org Cc: vantuando@computer.org; Smith, Daniel Sent: 2/22/2005 10:16 AM Subject: RE: Python for .NET, multithreading case. If you can post (or email me directly) the Python code that you use to create the threads, that would help me in making a test case (just to make sure any subtle differences aren't lost...) -Thanks Brian Lloyd brian@zope.com V.P. Engineering 540.361.1716 Zope Corporation http://www.zope.com > -----Original Message----- > From: Duong, Thuy [mailto:tduong@alarismed.com] > Sent: Tuesday, February 22, 2005 12:50 PM > To: Brian Lloyd; pythondotnet@python.org > Cc: vantuando@computer.org; Smith, Daniel > Subject: RE: Python for .NET, multithreading case. > > Hi Brian, > > Thanks for getting back to us so promptly! > > The threads (ThreadA and Threadaa) are created from Python and invoke > the .NET DLL. > > Pls. let us know if you need any additional information. > > Thanks. > > -thuy > > -----Original Message----- > From: Brian Lloyd [mailto:brian@zope.com] > Sent: Tuesday, February 22, 2005 6:39 AM > To: Duong, Thuy; pythondotnet@python.org > Cc: Smith, Don S. (ALARIS); vantuando@computer.org > Subject: RE: Python for .NET, multithreading case. > > > Just to clarify - are you creating these threads from > Python or from managed code? > > > Brian Lloyd brian@zope.com > V.P. Engineering 540.361.1716 > Zope Corporation http://www.zope.com > > > > -----Original Message----- > > From: Duong, Thuy [mailto:tduong@alarismed.com] > > Sent: Saturday, February 19, 2005 6:29 PM > > To: pythondotnet@python.org; brian@zope.com > > Cc: Smith, Don S. (ALARIS); vantuando@computer.org > > Subject: Python for .NET, multithreading case. > > > > > > Hi Brian, > > > > We've been using Python for .NET and it's been working pretty > > well interacting > > with a .NET DLL. However, we've encountered some problems with > > this multithreading > > scenario: > > > > 1) Create a "main" thread called: ThreadA > > 2) ThreadA can successfully invoke our .NET DLL. > > 3) ThreadA now spawns a child thread: Threadaa > > 4) Threadaa unsuccessfully invokes the .NET DLL. > > When we wrote to the console, we see Threadaa invoke the > .NET DLL but > > the control never returns back to Threadaa after the .NET DLL call. > > > > Do you have any thoughts on this and do you have any suggestions? > > Thanks in advance for your help! > > > > > > Regards, > > > > Thuy Duong > > > -------------- next part -------------- A non-text attachment was scrubbed... Name: _M4.py Type: application/octet-stream Size: 2222 bytes Desc: _M4.py Url : http://mail.python.org/pipermail/pythondotnet/attachments/20050224/038402a2/_M4.obj