From pythondotnet at python.org Fri Apr 1 05:16:28 2005 From: pythondotnet at python.org (Collector: Python for .NET Issue ...) Date: Fri Apr 1 05:16:32 2005 Subject: [Python.NET] [PythonNet] 3/ 3 Resolve "Python strings should convert to byte[]" Message-ID: <20050401031850.CEA212032C4@mail.zope.org> Issue #3 Update (Resolve) "Python strings should convert to byte[]" Status Resolved, General/bug medium To followup, visit: http://www.zope.org/Members/Brian/PythonNet/Collector/3 ============================================================== = Resolve - Entry #3 by Brian on Mar 31, 2005 10:16 pm Status: Accepted => Resolved oops - meant to resolve ________________________________________ = Comment - Entry #2 by Brian on Mar 31, 2005 10:06 pm done for beta 6. -BL ________________________________________ = Request - Entry #1 by Brian on Feb 8, 2005 10:55 am Status: Pending => Accepted Supporters added: Brian It should be possible to convert a string or sequence of single-character strings to a byte array. Not sure if its too DWIM-my to do the same for unicode strings... ============================================================== From pythondotnet at python.org Fri Apr 1 05:19:37 2005 From: pythondotnet at python.org (Collector: Python for .NET Issue ...) Date: Fri Apr 1 05:19:41 2005 Subject: [Python.NET] [PythonNet] 5/ 2 Resolve "Strange errors" Message-ID: <20050401032200.B55C52032C4@mail.zope.org> Issue #5 Update (Resolve) "Strange errors" Status Resolved, General/bug medium To followup, visit: http://www.zope.org/Members/Brian/PythonNet/Collector/5 ============================================================== = Resolve - Entry #2 by Brian on Mar 31, 2005 10:19 pm Status: Pending => Resolved This is fixed for b6 - due to an ill-advised decref of globals that only happens when the CLR module is imported into an existing Python interpreter... -BL ________________________________________ = Request - Entry #1 by Anonymous User on Mar 1, 2005 5:35 pm There seems to be some sort of strange crash occurring when importing CLR in the interactive prompt. It doesn't occur when executing a script from a file or in shells like PyCrust. Also, it does not happen at all in Python 2.3/PythonNET beta 3. Importing CLR seems to wreak havoc with the interpreter: Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import CLR >>> print dir() Traceback (most recent call last): File "", line 1, in ? NameError: name 'dir' is not defined >>> print dir(__import__) Traceback (most recent call last): File "", line 1, in ? NameError: name 'dir' is not defined >>> print __import__ Traceback (most recent call last): File "", line 1, in ? NameError: name '__import__' is not defined >>> __import__ Fatal Python error: GC object already tracked This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. Keeping a reference to globals() seems to suppress it: D:\Python24>python.exe Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> a=globals() >>> import CLR >>> dir() ['CLR', '__builtins__', '__doc__', '__name__', 'a'] >>> __import__ ============================================================== From lhelm at seventeenorbust.com Fri Apr 1 06:24:03 2005 From: lhelm at seventeenorbust.com (Louis Helm) Date: Fri Apr 1 06:38:46 2005 Subject: [Python.NET] Runs OK on Linux with Mono Message-ID: <424CCCE3.90402@seventeenorbust.com> Noticed you successfully installed Python for .NET on Linux. How did you build the CLR? I have VS.NET for windows but it only builds .dll class libraries. Building Python for .NET under mono fails. Cheers, Louie From guy at r-e-d.co.nz Sat Apr 9 05:17:06 2005 From: guy at r-e-d.co.nz (Guy Robinson) Date: Sat Apr 9 05:17:16 2005 Subject: [Python.NET] how to implement Implements in py4.net Message-ID: <42574932.8000908@r-e-d.co.nz> Hello, I have an example VB.NET script (see below) that I'm trying to recreate using python for .NET. How do I implement the Implements function? Any help appreciated. Regards, Guy """ Public Class Command Implements company.program.IExternalComm Public Function Execute(ByVal application As company.program.Application, ByRef mesge As String, ByVal ds As company.program.dataSet) As company.program.IExternalComm.Result Implements company.program.IExternalComm.Execute MsgBox("Hello World") Return company.program.IExternalComm.Result.Succeeded End Function End Class """ From jvm_cop at spamcop.net Mon Apr 11 04:41:39 2005 From: jvm_cop at spamcop.net (J. Merrill) Date: Mon Apr 11 03:41:59 2005 Subject: [Python.NET] how to implement Implements in py4.net In-Reply-To: <42574932.8000908@r-e-d.co.nz> Message-ID: <4.3.2.7.2.20050410213456.061ed8f0@mail.comcast.net> I think you're looking at the wrong Python. Python.Net lets write Python code that lets you get your hands on code implemented using .Net. It does not let you write .Net code. Virtually anything that needs to implement a .Net interface (like your company.program.IExternalComm example) needs to be written in a .Net language. (The only alternative would be if the interface could be written using COM, but that would be unusual unless special arrangements are made.) It seems a shame to me that AFAIK no one has built a .Net mechanism that lets one easily embed a copy of CPython 2.x and use it as a scripting language. That would let you replace the "hello world" with something to call your existing Python code, which I presume is what you really want to be doing. IronPython might let you do the equivalent, running your existing Python code from a .Net language, depending on whether your existing Python code would work in IronPython. At 10:17 PM 4/8/2005, Guy Robinson wrote: >Hello, > >I have an example VB.NET script (see below) that I'm trying to recreate using python for .NET. > >How do I implement the Implements function? > >Any help appreciated. >Regards, > >Guy > >""" >Public Class Command > > Implements company.program.IExternalComm > > Public Function Execute(ByVal application As company.program.Application, ByRef mesge As String, ByVal ds As company.program.dataSet) As company.program.IExternalComm.Result Implements company.program.IExternalComm.Execute > > MsgBox("Hello World") > > Return company.program.IExternalComm.Result.Succeeded > > End Function > >End Class >""" J. Merrill / Analytical Software Corp From apocalypznow at gmail.com Wed Apr 13 21:06:26 2005 From: apocalypznow at gmail.com (apocalypznow) Date: Wed Apr 13 22:44:12 2005 Subject: [Python.NET] Remoting Message-ID: Has anyone tried to do dotNet Remoting with PythonNet? Can someone post a code sample? From borice23 at yahoo.com Thu Apr 14 20:37:47 2005 From: borice23 at yahoo.com (Boris Capitanu) Date: Thu Apr 14 20:37:50 2005 Subject: [Python.NET] How to get 'None' from .NET? Message-ID: <20050414183747.141.qmail@web51801.mail.yahoo.com> Hello, I'm trying to call from .NET some function defined in a Python script, and pass 'null' as one of the parameters of the function in certain situations. I was expecting that the bridge would map the 'null' in .NET to 'None' in Python, however I receive an exception in .NET when I execute the code. I have something like the following: -------------- 1. PyObject module = PythonEngine.ImportModule("script") 2. PyObject func = module.GetAttr("someFunction") 3. object aNullObject = null 4. PyObject[] arguments = new PyObject[2] 5. arguments[0] = PyObject.FromManagedObject("a string") 6. arguments[1] = PyObject.FromManagedObject(aNullObject) // I also tried: arguments[1] = null directly 8. func.Invoke(arguments) -------------------- When executed, line 6 throws a NullReferenceException if I use 'arguments[1] = null' instead of line 6, I get a NullReferenceException in line 8. How can I pass 'null' to a script? Thank you. Boris __________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ From borice23 at yahoo.com Thu Apr 14 21:11:41 2005 From: borice23 at yahoo.com (Boris Capitanu) Date: Thu Apr 14 21:11:44 2005 Subject: [Python.NET] ActivePython 2.4.1.245 problem Message-ID: <20050414191141.2352.qmail@web51807.mail.yahoo.com> Hi, I just upgraded my Python to ActiveState's 2.4.1 version and some thing apparently broke in the bridge. Here are some things I was able to do in version 2.4.0 that now no longer work: C:\Python24>python ActivePython 2.4.1 Build 245 (ActiveState Corp.) based on Python 2.4.1 (#65, Mar 30 2005, 09:33:37) [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 >>> ------------- C:\Python24>python ActivePython 2.4.1 Build 245 (ActiveState Corp.) based on Python 2.4.1 (#65, Mar 30 2005, 09:33:37) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import CLR >>> import CLR Traceback (most recent call last): File "", line 1, in ? ImportError: __import__ not found >>> >>> import os Traceback (most recent call last): File "", line 1, in ? ImportError: __import__ not found >>> ---------------- It looks that after you first "import CLR" something gets screwed up inside CPython's tables because it can't find any imports anymore. Anyone else have the same problem? Boris __________________________________ Do you Yahoo!? Make Yahoo! your home page http://www.yahoo.com/r/hs From brian at zope.com Thu Apr 14 21:19:05 2005 From: brian at zope.com (Brian Lloyd) Date: Thu Apr 14 21:19:11 2005 Subject: [Python.NET] ActivePython 2.4.1.245 problem In-Reply-To: <20050414191141.2352.qmail@web51807.mail.yahoo.com> Message-ID: Hi Boris - this is actually fixed in my local copy (hope to check it in and make a new release soon, as this will affect anyone using the bootstrap hook in a native CPython). As a temporary workaround, you can arrange to hold a reference to the globals dictionary someplace before importing the CLR module: import sys sys._hack = globals() # now you can import CLR... import CLR 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 Boris Capitanu > Sent: Thursday, April 14, 2005 2:12 PM > To: pythondotnet@python.org > Subject: [Python.NET] ActivePython 2.4.1.245 problem > > > Hi, > > I just upgraded my Python to ActiveState's 2.4.1 > version and some thing apparently broke in the bridge. > > Here are some things I was able to do in version 2.4.0 > that now no longer work: > > C:\Python24>python > ActivePython 2.4.1 Build 245 (ActiveState Corp.) based > on > Python 2.4.1 (#65, Mar 30 2005, 09:33:37) [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 > >>> > > > ------------- > > C:\Python24>python > ActivePython 2.4.1 Build 245 (ActiveState Corp.) based > on > Python 2.4.1 (#65, Mar 30 2005, 09:33:37) [MSC v.1310 > 32 bit (Intel)] on win32 > Type "help", "copyright", "credits" or "license" for > more information. > >>> import CLR > >>> import CLR > Traceback (most recent call last): > File "", line 1, in ? > ImportError: __import__ not found > >>> > >>> import os > Traceback (most recent call last): > File "", line 1, in ? > ImportError: __import__ not found > >>> > ---------------- > > It looks that after you first "import CLR" something > gets screwed up inside CPython's tables because it > can't find any imports anymore. > > Anyone else have the same problem? > > Boris > > > > > __________________________________ > Do you Yahoo!? > Make Yahoo! your home page > http://www.yahoo.com/r/hs > _________________________________________________ > Python.NET mailing list - PythonDotNet@python.org > http://mail.python.org/mailman/listinfo/pythondotnet > From brian at zope.com Thu Apr 14 21:28:33 2005 From: brian at zope.com (Brian Lloyd) Date: Thu Apr 14 21:28:38 2005 Subject: [Python.NET] How to get 'None' from .NET? In-Reply-To: <20050414183747.141.qmail@web51801.mail.yahoo.com> Message-ID: FromManagedObject wasn't handling this correctly - I've added a fix for the next release. In the meantime, the easiest thing to do is something like: PyObject module = PythonEngine.ImportModule("script") PyObject none = module.GetAttr("aliasForNone") (this presumes that in the module you have created the name 'aliasForNone' and assigned it to None) 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 Boris Capitanu > Sent: Thursday, April 14, 2005 1:38 PM > To: pythondotnet@python.org > Subject: [Python.NET] How to get 'None' from .NET? > > > Hello, > > I'm trying to call from .NET some function defined in > a Python script, and pass 'null' as one of the > parameters of the function in certain situations. I > was expecting that the bridge would map the 'null' in > .NET to 'None' in Python, however I receive an > exception in .NET when I execute the code. > > I have something like the following: > > -------------- > 1. PyObject module = > PythonEngine.ImportModule("script") > 2. PyObject func = module.GetAttr("someFunction") > > 3. object aNullObject = null > > 4. PyObject[] arguments = new PyObject[2] > 5. arguments[0] = PyObject.FromManagedObject("a > string") > 6. arguments[1] = > PyObject.FromManagedObject(aNullObject) > // I also tried: arguments[1] = null directly > > 8. func.Invoke(arguments) > -------------------- > > When executed, line 6 throws a NullReferenceException > if I use 'arguments[1] = null' instead of line 6, I > get a NullReferenceException in line 8. > > How can I pass 'null' to a script? > > Thank you. > > Boris > > > > __________________________________ > Do you Yahoo!? > Yahoo! Small Business - Try our new resources site! > http://smallbusiness.yahoo.com/resources/ > _________________________________________________ > Python.NET mailing list - PythonDotNet@python.org > http://mail.python.org/mailman/listinfo/pythondotnet > From HargraveJE at ldschurch.org Thu Apr 14 23:32:13 2005 From: HargraveJE at ldschurch.org (Jim Hargrave) Date: Fri Apr 15 15:18:32 2005 Subject: [Python.NET] PythonNET and large WinForms applications.. Message-ID: I just discovered PythonNET and it's a wonderful solution. I can now call .NET and Java (via Jpype) code from the same Python script :-) I'm considering replacing wxPython with PythonNET+WinForms for all our GUIs. Is anyone else doing this for large apps? Do you consider PythonNet ready for developing feature rich user interfaces with WinForms? regards J ------------------------------------------------------------------------------ This message may contain confidential information, and is intended only for the use of the individual(s) to whom it is addressed. ------------------------------------------------------------------------------ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20050414/6798552f/attachment.htm