From mtigges at gmail.com Fri May 2 18:25:58 2008 From: mtigges at gmail.com (Mark Tigges) Date: Fri, 2 May 2008 09:25:58 -0700 Subject: [Python.NET] PyEval_GetGlobals Message-ID: I am trying to write a C# program that runs a python script. It, looks something like this: PythonEngine.Initialize(); PyList pyargv = null; PyObject sys = PythonEngine.ImportModule("sys"); if (sys.HasAttr("argv")) { pyargv = sys.GetAttr(new PyString("argv")) as PyList; } else { pyargv = new PyList(); foreach (string arg in argv) { pyargv.Append(new PyString(arg)); } } sys.SetAttr("argv", pyargv); string dir = System.IO.Path.GetDirectoryName(argv[0]); if (!String.IsNullOrEmpty(dir)) { PyList path = new PyList(sys.GetAttr("path")); PyObject pydir = new PyString(dir); if(!path.Contains(pydir)) { path.Append(pydir); } } PyObject module = PythonEngine.ImportModule(System.IO.Path.GetFileNameWithoutExtension(argv[0])); if(module!=null) module.Dispose(); PythonEngine.Shutdown(); So far, so good. At this point you may ask why I'm bothering and not just using python.exe. Just trust me, that it's a bit specialized, and I need to do a few other things. Namely, make some changes to the global namespace. So, I added a function to PythonEngine to return new PyDict(Runtime.PyEval_GetGlobals()); So that I can start adding some objects to it that the script can make use of. Unfortunately, PyEval_GetGlobals returns 0. It does so in PythonEngine.RunString as well. This seems kind of strange to me. What am I doing wrong? Thanks, Mark. From lists at net-labs.de Thu May 15 23:56:25 2008 From: lists at net-labs.de (Ulrich Eck) Date: Thu, 15 May 2008 23:56:25 +0200 Subject: [Python.NET] passing unicode strings to dotnet-library using mono on ubuntu Message-ID: Hi there, i'm working with pyhtonnet to use features from itextsharp ( a dotnet pdf library). the purpose of the app is to fill out pdf forms from within a turbogears appserver. i tried several combinations of encodings and passing str/unicode/ SystemString types to a utility function that sets the current pdf-form value with no success. i wrote a c# sample app that loads utf-8 encoded data and processes the pdf. then i ported it to ironpython with no problem (selecting data from sql-db and setting form-values in the pdfstamper). due to the lack of several essential std-lib modules i decided to use pythonnet with mono within a linux/ubuntu server to access the itext library. basically everything is working - except that there is a problem with german umlauts when passing values from result-sets to the dotnet library. the library methods dont accept pure str objects .. when i use unicode (correctly encoded) or SystemString objects the non-ascii chars wont display in the pdf or the resulting pdf is invalid (probably due to wrong encoding). i know that ironpython has a different string implementation .. is there a way how i can access the dotnet library that behaves similar to ironpythons implementation ? any hints would be greatly appreciated thanks! yours Ulrich Eck From fuzzyman at voidspace.org.uk Fri May 16 00:18:55 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Thu, 15 May 2008 23:18:55 +0100 Subject: [Python.NET] passing unicode strings to dotnet-library using mono on ubuntu In-Reply-To: References: Message-ID: <482CB6CF.8000207@voidspace.org.uk> Ulrich Eck wrote: > Hi there, > > i'm working with pyhtonnet to use features from itextsharp ( a dotnet > pdf library). > > the purpose of the app is to fill out pdf forms from within a > turbogears appserver. > > i tried several combinations of encodings and passing > str/unicode/SystemString > types to a utility function that sets the current pdf-form value with > no success. > > i wrote a c# sample app that loads utf-8 encoded data and processes > the pdf. > then i ported it to ironpython with no problem (selecting data from > sql-db and > setting form-values in the pdfstamper). > > due to the lack of several essential std-lib modules i decided to use > pythonnet > with mono within a linux/ubuntu server to access the itext library. > > basically everything is working - except that there is a problem with > german > umlauts when passing values from result-sets to the dotnet library. > > the library methods dont accept pure str objects .. when i use unicode > (correctly encoded) > or SystemString objects the non-ascii chars wont display in the pdf or > the resulting > pdf is invalid (probably due to wrong encoding). > > i know that ironpython has a different string implementation .. is > there a way how i can > access the dotnet library that behaves similar to ironpythons > implementation ? > IronPython basically doesn't have a string implementation at all - you use native .NET strings (which correspond to Python Unicode strings)... Michael Foord http://www.ironpythoninaction.com > any hints would be greatly appreciated > > thanks! > > yours Ulrich Eck > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet From gauthier.sg at wanadoo.fr Mon May 19 15:58:40 2008 From: gauthier.sg at wanadoo.fr (Serge Gauthier) Date: Mon, 19 May 2008 15:58:40 +0200 Subject: [Python.NET] Python.Net with Python 2.5 and Boa 0.6.1 Message-ID: <001801c8b9b8$71525000$0a01a8c0@bureauserge> Hi, I am french and my english is very poor !! I use Boa Constructor 0.6.1 with wxPython and Python 2.5. I have to communicate with a CPU card under Linux RT using Mono (DLL inside) and I have to interface the DLL on the client side. I try to install CLR in c:\Python25\Dlls directory: I have copied clr.pyd and Python.Runtime.dll (python 2.5-UCS2 version) in it. When I run my project I have the following message: import clr ImportError: dynamic module does not define init function (initclr) I have seen the same question on the forum without having the solution. Do you have an idea and a detailed answer ? Thanks Regards -- J'utilise la version gratu?te de SPAMfighter pour utilisateurs priv?s. Ce programme a supprim?1317 d'e-mails spam ? ce jour. Les utilisateurs qui paient n'ont pas ce message dans leurse-mails. Obtenez la version gratuite de SPAMfighter ici: http://www.spamfighter.com/lfr -------------- next part -------------- An HTML attachment was scrubbed... URL: From python at zeomega.com Tue May 20 21:53:21 2008 From: python at zeomega.com (sam) Date: Tue, 20 May 2008 14:53:21 -0500 (CDT) Subject: [Python.NET] looking for python.NET solution Message-ID: <71728168.29101211313201327.JavaMail.root@chandra.zeomega.com> Greetings We at ZeOmega have a Python based product that is used for care management in Health plans. our clients run lots of .NET apps in their data centers . They want to integrate with our product using a .NET like web services interface. We are wondering if anyone here would be interested in proposing a solution that will allow us to publish some of our services as .NET web services. I am hoping python.NET can be used to build this layer of functionality. For example we have a Python component with the following method EpisodeController.GetDiagnosisCode() We would like to make the above method available as a .NET service with corresponding WSDL for consumption by a Java or .NET client The proposed solution will have to work on windows 2003 family of server products Please advise if python.NET can be used to solve our problem. The reason we don't want to do this using ZSI or soaplib is due to many reported instances of interoperability problems between .NET clients and these SOAP based modules. So a native .NET based solution is preferable. Regards Sathya "Sam" Rangaswamy From sam at zeomega.com Tue May 20 21:49:23 2008 From: sam at zeomega.com (Sam Rangaswamy) Date: Tue, 20 May 2008 14:49:23 -0500 (CDT) Subject: [Python.NET] looing for a python.NET solution Message-ID: <491292062.29041211312963521.JavaMail.root@chandra.zeomega.com> Greetings We at ZeOmega have a Python based product that is used for care management in Health plans. our clients run lots of .NET apps in their data centers . They want to integrate with our product using a .NET like web services interface. We are wondering if anyone here would be interested in proposing a solution that will allow us to publish some of our services as .NET web services. I am hoping python.NET can be used to build this layer of functionality. For example we have a Python component with the following method EpisodeController.GetDiagnosisCode() We would like to make the above method available as a .NET service with corresponding WSDL for consumption by a Java or .NET client The proposed solution will have to work on windows 2003 family of server products Please advise if python.NET can be used to solve our problem. The reason we dont want to do this using ZSI or soaplib is due to many reported instances of interoperability problems between .NET clients and these SOAP based modules. So a native .NET based solution is preferable. Regards Sathya "Sam" Rangaswamy -- =========================================== CEO ZeOmega Open Minds' Open Solutions #2591 Dallas Parkway Suite 408 Frisco TX, 75034 214-618-9880- Ext 8002 (O) 214-975-1258 (F) 214-733-3467 (M) http://www.zeomega.com ============================================ "Who killed the electric car ?" ============================================ From gauthier.sg at wanadoo.fr Wed May 28 13:35:29 2008 From: gauthier.sg at wanadoo.fr (Serge Gauthier) Date: Wed, 28 May 2008 13:35:29 +0200 Subject: [Python.NET] About Python and Boa Message-ID: <006801c8c0b6$eef53f90$0a01a8c0@bureauserge> I have posted a question about Python.net and Boa Constructor. Thanks for the answers. I did progress: I had to recompile the python_runtime.dll with C# and now it is working under Windows. My question is: how to do the same under Linux. I have MonoDevelop installed, is it possible to use the same way ? Thanks a lot Serge -- J'utilise la version gratu?te de SPAMfighter pour utilisateurs priv?s. Ce programme a supprim?1566 d'e-mails spam ? ce jour. Les utilisateurs qui paient n'ont pas ce message dans leurse-mails. Obtenez la version gratuite de SPAMfighter ici: http://www.spamfighter.com/lfr -------------- next part -------------- An HTML attachment was scrubbed... URL: From gauthier.sg at wanadoo.fr Fri May 30 14:22:19 2008 From: gauthier.sg at wanadoo.fr (Serge Gauthier) Date: Fri, 30 May 2008 14:22:19 +0200 Subject: [Python.NET] Python.Net with Boa under Linux Message-ID: <008001c8c24f$ce0be4b0$0a01a8c0@bureauserge> I currently use Python 2.5, Boa constructor 0.6.1 under Windows and Linux Mandrake. On a motion control CPU card, running Linux on Power PC, there is a Mono, C# dll server. To communicate with under Windows XP, I had to recompile the Python-Runtime project with VS C#. It works now fine under Boa: I can import clr and do the following: lib = clr.AddReference("PPmacClassLibrary") from PPmacClassLibrary import PPmacDeviceClass self.pmac = PPmacDeviceClass(HOST, "PythonPmac", port) Under Linux, it is not possible to do the same, I tryed to use clr.so and Python-Runtime.dll and the error message is : "impossible to load the assembly". Could you tell me how to solve that ? I am not familar with C# and Mono. Do I have to recompile under Mono and how to do ? I don't understand well how it works on Linux. Thanks a lot for your help Serge -- J'utilise la version gratu?te de SPAMfighter pour utilisateurs priv?s. Ce programme a supprim?1619 d'e-mails spam ? ce jour. Les utilisateurs qui paient n'ont pas ce message dans leurse-mails. Obtenez la version gratuite de SPAMfighter ici: http://www.spamfighter.com/lfr -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jfrayne at blizzard.com Fri May 30 19:25:45 2008 From: Jfrayne at blizzard.com (Joe Frayne) Date: Fri, 30 May 2008 10:25:45 -0700 Subject: [Python.NET] Python.Net with Boa under Linux In-Reply-To: <008001c8c24f$ce0be4b0$0a01a8c0@bureauserge> References: <008001c8c24f$ce0be4b0$0a01a8c0@bureauserge> Message-ID: <07A480006269DF4CA5433912783454F704FFAC00@BL-EXCHANGE.corp.blizzard.net> Hi Serge, I got it working with Python2.5 and Mono 1.9 on MacOSX 10.5.2, but I think it is broken again under Mono 1.9.1. I checked in all my changes, but no new package has been created, so you have to rebuild everything yourself (which it sounds like you are doing). Here's what I did for MacOSX: 1. Build a UCS-2 version of Python.Runtime.dll on Windows. 2. Build the clr.so on MacOSX (see README.txt for specifics). 3. Copy the clr.so, the Python.Runtime.dll, and the \trunk\pythonnet\doc\Python.Runtime.dll.config to the site-packages folder. 4. Copy all your other .NET .dlls to the site-packages folder. I'm not sure if you need to do anything differently for Linux. Joe From: pythondotnet-bounces at python.org [mailto:pythondotnet-bounces at python.org] On Behalf Of Serge Gauthier Sent: Friday, May 30, 2008 5:22 AM To: pythondotnet at python.org Subject: [Python.NET] Python.Net with Boa under Linux I currently use Python 2.5, Boa constructor 0.6.1 under Windows and Linux Mandrake. On a motion control CPU card, running Linux on Power PC, there is a Mono, C# dll server. To communicate with under Windows XP, I had to recompile the Python-Runtime project with VS C#. It works now fine under Boa: I can import clr and do the following: lib = clr.AddReference("PPmacClassLibrary") from PPmacClassLibrary import PPmacDeviceClass self.pmac = PPmacDeviceClass(HOST, "PythonPmac", port) Under Linux, it is not possible to do the same, I tryed to use clr.so and Python-Runtime.dll and the error message is : "impossible to load the assembly". Could you tell me how to solve that ? I am not familar with C# and Mono. Do I have to recompile under Mono and how to do ? I don't understand well how it works on Linux. Thanks a lot for your help Serge ________________________________ J'utilise la version gratuite de SPAMfighter pour utilisateurs priv?s. 1619 e-mails spam ont ?t? bloqu?s jusqu'? maintenant. Les utilisateurs payant n'ont pas ce message dans leurs e-mails. Essayez SPAMfighter gratuitement maintenant! -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at cheimes.de Sat May 31 00:29:31 2008 From: lists at cheimes.de (Christian Heimes) Date: Sat, 31 May 2008 00:29:31 +0200 Subject: [Python.NET] Python 2.6 support Message-ID: Hello PythonDotNET users! I've committed some chances to the svn trunk. PythonDotNET now works with Python 2.6 again. None of the new features like bytearray, version tags and the new buffer interface are supported, though. Christian