From expo at expobrain.net Mon Dec 1 14:53:29 2008 From: expo at expobrain.net (Daniele Esposti) Date: Mon, 01 Dec 2008 14:53:29 +0100 Subject: [Python.NET] Cannot initialize OLE Message-ID: <4933EC59.2010106@expobrain.net> Hi all, if I run my application (a wxPython frame with a wx.Activex Flash component) with the python.exe in pythonnet folder its work like expected. Instead, if I run my application with the standard Python interpreter, with clr.pyd in DLLs folder and Python.Runtime.dll in the same interpreter folder, I get a warnings says Cannot initialize OLE and the ActiveX is locked. I'm using Python 2.5.2 on a Windows XP SP3 machine, PythonNet 2.0-alpha2-clr2.0 compiled with VisualStudio Express 2008. Have I missing something ? Only clr.pyd and Python.Runtime.dll are needed or there are others resources to copy in Python interpreter folder ? Thanks in advance From brian.lloyd at revolutionhealth.com Mon Dec 1 20:45:05 2008 From: brian.lloyd at revolutionhealth.com (Brian Lloyd) Date: Mon, 01 Dec 2008 14:45:05 -0500 Subject: [Python.NET] Cannot initialize OLE In-Reply-To: <4933EC59.2010106@expobrain.net> Message-ID: This probably has to do with the threading model being auto-magically set for you when the CLR is cranked up, absent any prior initialization. The managed version of python.exe is able to set the threading model (to MTA I believe) because it is a managed executable. When you import clr via the standard python.exe, you are probably getting the default model (STA). I could have those backwards - its been a while ;) If you are using the win32com extensions, you might be able to import those, set the threading model for the process, then import clr. Not sure if that will work, but its worth a shot. I don't think there is any way to change the threading model once it's set. -Brian On 12/1/08 8:53 AM, "Daniele Esposti" wrote: > Hi all, > > if I run my application (a wxPython frame with a wx.Activex Flash > component) with the python.exe in pythonnet folder its work like expected. > Instead, if I run my application with the standard Python interpreter, > with clr.pyd in DLLs folder and Python.Runtime.dll in the same > interpreter folder, I get a warnings says Cannot initialize OLE and the > ActiveX is locked. > I'm using Python 2.5.2 on a Windows XP SP3 machine, PythonNet > 2.0-alpha2-clr2.0 compiled with VisualStudio Express 2008. > > Have I missing something ? Only clr.pyd and Python.Runtime.dll are > needed or there are others resources to copy in Python interpreter folder ? > > Thanks in advance > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet -------------------------------- Brian Lloyd 540.845.2975 brian.lloyd at revolutionhealth.com From hsu.feihong at yahoo.com Mon Dec 1 22:13:46 2008 From: hsu.feihong at yahoo.com (Feihong Hsu) Date: Mon, 1 Dec 2008 13:13:46 -0800 (PST) Subject: [Python.NET] Cannot initialize OLE In-Reply-To: Message-ID: <92147.52637.qm@web34805.mail.mud.yahoo.com> I believe Brian's assessment is correct. The easiest way to handle this is to use pywin32's pythoncom module to set the threading model. You can find a sample of how to do that here: http://www.ironpython.info/index.php/Using_the_WebBrowser_Widget In the sample, the WebBrowser widget (which uses ActiveX underneath) is embedded in a form. By invoking pythoncom.CoInitialize(), we set the threading model to STA which prevents the program from crashing when it initializes the form. --- On Mon, 12/1/08, Brian Lloyd wrote: From: Brian Lloyd Subject: Re: [Python.NET] Cannot initialize OLE To: "Daniele Esposti" , pythondotnet at python.org Date: Monday, December 1, 2008, 1:45 PM This probably has to do with the threading model being auto-magically set for you when the CLR is cranked up, absent any prior initialization. The managed version of python.exe is able to set the threading model (to MTA I believe) because it is a managed executable. When you import clr via the standard python.exe, you are probably getting the default model (STA). I could have those backwards - its been a while ;) If you are using the win32com extensions, you might be able to import those, set the threading model for the process, then import clr. Not sure if that will work, but its worth a shot. I don't think there is any way to change the threading model once it's set. -Brian On 12/1/08 8:53 AM, "Daniele Esposti" wrote: > Hi all, > > if I run my application (a wxPython frame with a wx.Activex Flash > component) with the python.exe in pythonnet folder its work like expected. > Instead, if I run my application with the standard Python interpreter, > with clr.pyd in DLLs folder and Python.Runtime.dll in the same > interpreter folder, I get a warnings says Cannot initialize OLE and the > ActiveX is locked. > I'm using Python 2.5.2 on a Windows XP SP3 machine, PythonNet > 2.0-alpha2-clr2.0 compiled with VisualStudio Express 2008. > > Have I missing something ? Only clr.pyd and Python.Runtime.dll are > needed or there are others resources to copy in Python interpreter folder ? > > Thanks in advance > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet -------------------------------- Brian Lloyd 540.845.2975 brian.lloyd at revolutionhealth.com _________________________________________________ Python.NET mailing list - PythonDotNet at python.org http://mail.python.org/mailman/listinfo/pythondotnet -------------- next part -------------- An HTML attachment was scrubbed... URL: From helink at sandia.gov Tue Dec 2 01:04:18 2008 From: helink at sandia.gov (Hamilton Link) Date: Mon, 1 Dec 2008 17:04:18 -0700 Subject: [Python.NET] questions from a new PythonNet user In-Reply-To: <1c0b4a390811281932ka63c15ex24bafa689df499dc@mail.gmail.com> References: <491E282F.4040202@sandia.gov> <1c0b4a390811281932ka63c15ex24bafa689df499dc@mail.gmail.com> Message-ID: <49347B82.5010608@sandia.gov> Brian Lloyd wrote: > On Fri, Nov 14, 2008 at 8:38 PM, Hamilton Link > wrote: > > ... > > > > > I suppose the first question is, > Why are there no apparent build instructions in the distribution? > > > Hi there - unfortunately I think the problem is that it would take a > large effort > to come up with a build process that works reliably for all possible > platforms > (mono, win32), python versions, unicode requirements, build > toolchains, etc. > Consequently, the docs are kind of all over the place. > > Thus far, while python.net has been useful for > some people, I don't think the > user community is large enough yet for any group of people to get > together to > put together anything really comprehensive in terms of distribution > tools or > docs. > > If you're willing to write some, I'm willing to give you whatever > access you need to > get them in svn ;) If anyone thinks a lighter weight tool would help, > we could set up > a mediawiki instance or something as well... Python.net serves a niche's niche's niche, so I don't expect it will ever have too many users. But SVN access would be great, thanks. I will try to put in a README of some sort that combines the relevant documentation I can find plus whatever works for me into a (disclaimer-ed) set of build instructions. Also if I am able to do a before/after test of the .net SP1 patch would anyone mind if I committed that into the repository? Also, if the SP1 patch and anything else goes in to the trunk (and if I can figure out how to do it) I will package a new distro that includes the setup.py script and the patches and I'll put it on sourceforge as alpha 3 or some such. But don't hold your breath until it's already done, 'k? > > > How actively maintained is PythonNet at the moment? > > > I have, and will continue to, give those folks access to > sourceforge etc. to improve the platform as they are able. But my > impression is > that where we are now is a situation where people can "scratch their > own itch", but > there is no organized effort to track the .NET or mono platform > changes going > forward. My opinion is that it will take an invested champion to make > that happen. > > FWIW, Resolver and others seem to be using some of the code and > concepts from > python.net to further use of native extensions > with IronPython -- that may also be a > good avenue to explore if you're looking for long-term supportability > (and I'm sure > resolver would welcome the help!) > > -Brian > Well, for what it's worth, for the near future I have a vested interest in making sure python.net works on linux, windows, and os x. IronPython isn't an option for me. Other good news is that mono now claims approximate 2.0 compliance and so the underpinnings of the CLR shouldn't change for a good while yet, minimizing portability issues. The bad news is most of my time is being spent on other projects than this one. Beyond extensive testing we'll see what happens. I can't promise I'll be in a place to debug any problems, since I'm not really a python programmer. And I _really_ can't promise upgrades for python 2.6 (if it doesn't already work... haven't tried it) or python 3.x. h From JBurnett at blizzard.com Tue Dec 2 01:43:34 2008 From: JBurnett at blizzard.com (John Burnett) Date: Mon, 1 Dec 2008 16:43:34 -0800 Subject: [Python.NET] questions from a new PythonNet user In-Reply-To: <49347B82.5010608@sandia.gov> References: <491E282F.4040202@sandia.gov><1c0b4a390811281932ka63c15ex24bafa689df499dc@mail.gmail.com> <49347B82.5010608@sandia.gov> Message-ID: <44055E60E3A2174080A3086D5CD4D03907485D44@BL-EXCHANGE.corp.blizzard.net> Getting a new "official" distribution up would be great - on this end, I know Joe Frayne and myself have provided several patches that let Python.net run on 64bit, fixes bugs, etc, some of which others seem to have run into when just downloading the alpha2 zip... John -----Original Message----- From: pythondotnet-bounces+jburnett=blizzard.com at python.org [mailto:pythondotnet-bounces+jburnett=blizzard.com at python.org] On Behalf Of Hamilton Link Sent: Monday, December 01, 2008 4:04 PM To: Brian Lloyd Cc: pythondotnet at python.org Subject: Re: [Python.NET] questions from a new PythonNet user Brian Lloyd wrote: > On Fri, Nov 14, 2008 at 8:38 PM, Hamilton Link > wrote: > > ... > > > > > I suppose the first question is, > Why are there no apparent build instructions in the distribution? > > > Hi there - unfortunately I think the problem is that it would take a > large effort > to come up with a build process that works reliably for all possible > platforms > (mono, win32), python versions, unicode requirements, build > toolchains, etc. > Consequently, the docs are kind of all over the place. > > Thus far, while python.net has been useful for > some people, I don't think the > user community is large enough yet for any group of people to get > together to > put together anything really comprehensive in terms of distribution > tools or > docs. > > If you're willing to write some, I'm willing to give you whatever > access you need to > get them in svn ;) If anyone thinks a lighter weight tool would help, > we could set up > a mediawiki instance or something as well... Python.net serves a niche's niche's niche, so I don't expect it will ever have too many users. But SVN access would be great, thanks. I will try to put in a README of some sort that combines the relevant documentation I can find plus whatever works for me into a (disclaimer-ed) set of build instructions. Also if I am able to do a before/after test of the .net SP1 patch would anyone mind if I committed that into the repository? Also, if the SP1 patch and anything else goes in to the trunk (and if I can figure out how to do it) I will package a new distro that includes the setup.py script and the patches and I'll put it on sourceforge as alpha 3 or some such. But don't hold your breath until it's already done, 'k? > > > How actively maintained is PythonNet at the moment? > > > I have, and will continue to, give those folks access to > sourceforge etc. to improve the platform as they are able. But my > impression is > that where we are now is a situation where people can "scratch their > own itch", but > there is no organized effort to track the .NET or mono platform > changes going > forward. My opinion is that it will take an invested champion to make > that happen. > > FWIW, Resolver and others seem to be using some of the code and > concepts from > python.net to further use of native extensions > with IronPython -- that may also be a > good avenue to explore if you're looking for long-term supportability > (and I'm sure > resolver would welcome the help!) > > -Brian > Well, for what it's worth, for the near future I have a vested interest in making sure python.net works on linux, windows, and os x. IronPython isn't an option for me. Other good news is that mono now claims approximate 2.0 compliance and so the underpinnings of the CLR shouldn't change for a good while yet, minimizing portability issues. The bad news is most of my time is being spent on other projects than this one. Beyond extensive testing we'll see what happens. I can't promise I'll be in a place to debug any problems, since I'm not really a python programmer. And I _really_ can't promise upgrades for python 2.6 (if it doesn't already work... haven't tried it) or python 3.x. h _________________________________________________ Python.NET mailing list - PythonDotNet at python.org http://mail.python.org/mailman/listinfo/pythondotnet From helink at sandia.gov Wed Dec 3 02:05:45 2008 From: helink at sandia.gov (Hamilton Link) Date: Tue, 2 Dec 2008 18:05:45 -0700 Subject: [Python.NET] ubuntu clarification Message-ID: <4935DB69.3020808@sandia.gov> I figured out the python.exe is a dynamically-linked python for use under systems like ubuntu where the provided distribution is statically linked. But I had already installed an overriding distribution of python from sources. FYI, ubuntu's distribution is this way because for whatever reason it is configured with --disable-shared. If you (like me) check out python from sources and configure a version with --enable-shared and install it, you don't have to use python.exe. Not that I'm anti-python.exe, but I wanted to know precisely what was different under ubuntu, and it turns out this is the necessary and sufficient configuration change. h From expo at expobrain.net Wed Dec 3 02:18:37 2008 From: expo at expobrain.net (Daniele Esposti) Date: Wed, 03 Dec 2008 02:18:37 +0100 Subject: [Python.NET] Cannot initialize OLE In-Reply-To: <92147.52637.qm@web34805.mail.mud.yahoo.com> References: <92147.52637.qm@web34805.mail.mud.yahoo.com> Message-ID: <4935DE6D.4090509@expobrain.net> Feihong Hsu ha scritto: > I believe Brian's assessment is correct. The easiest way to handle this > is to use pywin32's pythoncom module to set the threading model. You can > find a sample of how to do that here: > > http://www.ironpython.info/index.php/Using_the_WebBrowser_Widget > > In the sample, the WebBrowser widget (which uses ActiveX underneath) is > embedded in a form. By invoking pythoncom.CoInitialize(), we set the > threading model to STA which prevents the program from crashing when it > initializes the form. > Ok, import pythoncom pythoncom.CoInitialize() and every it's working right. Thank's to all From helink at sandia.gov Wed Dec 3 02:18:30 2008 From: helink at sandia.gov (Hamilton Link) Date: Tue, 2 Dec 2008 18:18:30 -0700 Subject: [Python.NET] path question: clr.so being picky about paths Message-ID: <4935DE66.3090605@sandia.gov> In the readme, it says that "python for .net uses the pythonpath (sys.path) to look for assemblies to load, in addition to the usual application base and the gac. Unfortunately at the moment the assembly I'm trying to load is... clr.pyd. If I run python (ubuntu, mono, rebuilt python 2.5.2 with --enable-shared) from a directory where clr.pyd and Python.Runtime.dll reside, with clr.so in the lib/python2.5/site-packages folder... everything works. I can import clr and System.Drawing and make a System.Drawing.Point instance. If I run python from a directory without these libraries, in particular if I'm in my home folder somewhere and clr.pyd and Python.Runtime.dll are in the lib/python2.5/site-packages folder where I want them... import clr gives me an error trying to load some unspecified module (I suspect clr.pyd). Am I supposed to set some path or other for mono in contravention of the docs? I suspect that either clr.so can't find mono, or mono is being loaded and then can't find clr.pyd. I will continue to fiddle with this, probably Friday, if I don't get a response, but it seems like there's probably a simple answer that I'm overlooking. Setting MONO_PATH to my site-packages folder (the variable was unbound before) didn't fix it. h From Jfrayne at blizzard.com Wed Dec 3 03:08:26 2008 From: Jfrayne at blizzard.com (Joe Frayne) Date: Tue, 2 Dec 2008 18:08:26 -0800 Subject: [Python.NET] path question: clr.so being picky about paths In-Reply-To: <4935DE66.3090605@sandia.gov> References: <4935DE66.3090605@sandia.gov> Message-ID: <07A480006269DF4CA5433912783454F704FFB025@BL-EXCHANGE.corp.blizzard.net> I got it working on MacOSX under Mono. I'm pretty sure the clr.pyd is only for Windows. I think you just need the Python.Runtime.dll, the Python.Runtime.dll.config, and the clr.so in the site-packages folder. Joe -----Original Message----- From: pythondotnet-bounces+jfrayne=blizzard.com at python.org [mailto:pythondotnet-bounces+jfrayne=blizzard.com at python.org] On Behalf Of Hamilton Link Sent: Tuesday, December 02, 2008 5:19 PM To: pythondotnet at python.org Subject: [Python.NET] path question: clr.so being picky about paths In the readme, it says that "python for .net uses the pythonpath (sys.path) to look for assemblies to load, in addition to the usual application base and the gac. Unfortunately at the moment the assembly I'm trying to load is... clr.pyd. If I run python (ubuntu, mono, rebuilt python 2.5.2 with --enable-shared) from a directory where clr.pyd and Python.Runtime.dll reside, with clr.so in the lib/python2.5/site-packages folder... everything works. I can import clr and System.Drawing and make a System.Drawing.Point instance. If I run python from a directory without these libraries, in particular if I'm in my home folder somewhere and clr.pyd and Python.Runtime.dll are in the lib/python2.5/site-packages folder where I want them... import clr gives me an error trying to load some unspecified module (I suspect clr.pyd). Am I supposed to set some path or other for mono in contravention of the docs? I suspect that either clr.so can't find mono, or mono is being loaded and then can't find clr.pyd. I will continue to fiddle with this, probably Friday, if I don't get a response, but it seems like there's probably a simple answer that I'm overlooking. Setting MONO_PATH to my site-packages folder (the variable was unbound before) didn't fix it. h _________________________________________________ Python.NET mailing list - PythonDotNet at python.org http://mail.python.org/mailman/listinfo/pythondotnet From helink at sandia.gov Wed Dec 3 07:17:57 2008 From: helink at sandia.gov (Link, Hamilton) Date: Tue, 2 Dec 2008 23:17:57 -0700 Subject: [Python.NET] path question: clr.so being picky about paths In-Reply-To: <07A480006269DF4CA5433912783454F704FFB025@BL-EXCHANGE.corp.blizzard.net> References: <4935DE66.3090605@sandia.gov>, <07A480006269DF4CA5433912783454F704FFB025@BL-EXCHANGE.corp.blizzard.net> Message-ID: <796FAD48C7891F43A943B67DF279C58927E5F440B4@ES04SNLNT.srn.sandia.gov> I'll go back and look again, but as far as I could tell from the .il code and the .c code for clr.pyd and clr.so... - clr.so bootstraps mono (under Windows the OS knows how to dlload a .net assembly already) to enable .net assembly extensions and I assumed perhaps recklessly that it laterals to clr.pyd - clr.pyd loads Python.Runtime.dll - Python.Runtime.dll, regardless of platform, turns around and uses P/Invoke to connect into the libpython2.5.so/dll, and then you're all set Maybe a dev can confirm or correct me on this, and elaborate a bit? I can certainly try setting aside clr.pyd and I'll keep studying the code, but I guess I didn't notice if clr.so knew to find Python.Runtime.dll after it set up mono. h ________________________________________ From: Joe Frayne [Jfrayne at blizzard.com] Sent: Tuesday, December 02, 2008 7:08 PM To: Link, Hamilton; pythondotnet at python.org Subject: RE: [Python.NET] path question: clr.so being picky about paths I got it working on MacOSX under Mono. I'm pretty sure the clr.pyd is only for Windows. I think you just need the Python.Runtime.dll, the Python.Runtime.dll.config, and the clr.so in the site-packages folder. Joe -----Original Message----- From: pythondotnet-bounces+jfrayne=blizzard.com at python.org [mailto:pythondotnet-bounces+jfrayne=blizzard.com at python.org] On Behalf Of Hamilton Link Sent: Tuesday, December 02, 2008 5:19 PM To: pythondotnet at python.org Subject: [Python.NET] path question: clr.so being picky about paths In the readme, it says that "python for .net uses the pythonpath (sys.path) to look for assemblies to load, in addition to the usual application base and the gac. Unfortunately at the moment the assembly I'm trying to load is... clr.pyd. If I run python (ubuntu, mono, rebuilt python 2.5.2 with --enable-shared) from a directory where clr.pyd and Python.Runtime.dll reside, with clr.so in the lib/python2.5/site-packages folder... everything works. I can import clr and System.Drawing and make a System.Drawing.Point instance. If I run python from a directory without these libraries, in particular if I'm in my home folder somewhere and clr.pyd and Python.Runtime.dll are in the lib/python2.5/site-packages folder where I want them... import clr gives me an error trying to load some unspecified module (I suspect clr.pyd). Am I supposed to set some path or other for mono in contravention of the docs? I suspect that either clr.so can't find mono, or mono is being loaded and then can't find clr.pyd. I will continue to fiddle with this, probably Friday, if I don't get a response, but it seems like there's probably a simple answer that I'm overlooking. Setting MONO_PATH to my site-packages folder (the variable was unbound before) didn't fix it. h _________________________________________________ Python.NET mailing list - PythonDotNet at python.org http://mail.python.org/mailman/listinfo/pythondotnet From pieters at randcontrols.co.za Wed Dec 3 08:51:21 2008 From: pieters at randcontrols.co.za (Pieter Steenekamp) Date: Wed, 3 Dec 2008 09:51:21 +0200 Subject: [Python.NET] How to use a Python function that returns a double array in VB vie C++ Message-ID: <003c01c9551b$f8025470$0100000a@pieterLaptop> Hi all, I want to use a Python function that returns a double array in VB dot net via embedding Python in C++ dot net. Using the CLR it is easy to access C++ from VB. Then also I don't have a problem if the Python function returns a single variable of type double, using the following lines in my C++ code: myPythonObjectPointer = PyObject_CallObject(pFunc, pArgs); myCppDoubleVariable = PyFloat_AsDouble(myPyObjectPointer); (I have obviously done all the required thingies as per the Python documentation) I can further achieve what I want by changing the Python function to a number of functions, each returning a single double variable and call them one by one, using code like above, and then passing them into an array in C++, but I would prefer a more elegant way of doing it, because my return variable could have hundreds, if not thousands, of values. Can somebody help me please. Thanks Pieter Steenekamp. From honey33145 at gmail.com Wed Dec 3 11:41:41 2008 From: honey33145 at gmail.com (navneet khanna) Date: Wed, 3 Dec 2008 16:11:41 +0530 Subject: [Python.NET] Problem loading vb.net DLL in Python Message-ID: Hello Everybody I am trying to load vb.net dll in Python, but its showing errors. >>> from ctypes import * >>> dll = windll.Userdll >>> dll >>> dll_function1 = dll.xml_load("C:\test.xml") Traceback (most recent call last): File "", line 1, in dll_function1 = dll.xml_init("C:\test.xml") File "C:\Python25\lib\ctypes\__init__.py", line 361, in __getattr__ func = self.__getitem__(name) File "C:\Python25\lib\ctypes\__init__.py", line 366, in __getitem__ func = self._FuncPtr((name_or_ordinal, self)) AttributeError: function 'xml_init' not found Userdll is a dll created in vb.net. xml_load is a function in it. I tried loading this dll in vb.net its working fine. I accessed in vb.net by referencing in settings. Do we have any such option in Python? Can I call the class of vb.net dll in Python , so that i can create its object and access its functions. Please help me out. I would be grateful to you. Thanks Navneet -------------- next part -------------- An HTML attachment was scrubbed... URL: From sambasivareddy.s at patni.com Wed Dec 3 11:59:34 2008 From: sambasivareddy.s at patni.com (sambasivareddy) Date: Wed, 3 Dec 2008 16:29:34 +0530 Subject: [Python.NET] Problem loading vb.net DLL in Python In-Reply-To: Message-ID: <012501c95536$39e98510$750ba8c0@patni.com> Hi Navneet, If I understand u r problem correct. Don't use python...use python.net..have a look in to below link.u will get clear idea on it. http://pythonnet.sourceforge.net/readme.html Above link they clearly mention how to load/import dlls .plz go through it. Regards, Sambu. _____ From: pythondotnet-bounces+sambasivareddy.s=patni.com at python.org [mailto:pythondotnet-bounces+sambasivareddy.s=patni.com at python.org] On Behalf Of navneet khanna Sent: Wednesday, December 03, 2008 4:12 PM To: pythondotnet at python.org Subject: [Python.NET] Problem loading vb.net DLL in Python Hello Everybody I am trying to load vb.net dll in Python, but its showing errors. >>> from ctypes import * >>> dll = windll.Userdll >>> dll >>> dll_function1 = dll.xml_load("C:\test.xml") Traceback (most recent call last): File "", line 1, in dll_function1 = dll.xml_init("C:\test.xml") File "C:\Python25\lib\ctypes\__init__.py", line 361, in __getattr__ func = self.__getitem__(name) File "C:\Python25\lib\ctypes\__init__.py", line 366, in __getitem__ func = self._FuncPtr((name_or_ordinal, self)) AttributeError: function 'xml_init' not found Userdll is a dll created in vb.net. xml_load is a function in it. I tried loading this dll in vb.net its working fine. I accessed in vb.net by referencing in settings. Do we have any such option in Python? Can I call the class of vb.net dll in Python , so that i can create its object and access its functions. Please help me out. I would be grateful to you. Thanks Navneet _____________________________________________________________________ This e-mail message may contain proprietary, confidential or legally privileged information for the sole use of the person or entity to whom this message was originally addressed. Any review, e-transmission dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error kindly delete this e-mail from your records. If it appears that this mail has been forwarded to you without proper authority, please notify us immediately at netadmin at patni.com and delete this mail. _____________________________________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at cheimes.de Wed Dec 3 13:13:04 2008 From: lists at cheimes.de (Christian Heimes) Date: Wed, 03 Dec 2008 13:13:04 +0100 Subject: [Python.NET] path question: clr.so being picky about paths In-Reply-To: <796FAD48C7891F43A943B67DF279C58927E5F440B4@ES04SNLNT.srn.sandia.gov> References: <4935DE66.3090605@sandia.gov>, <07A480006269DF4CA5433912783454F704FFB025@BL-EXCHANGE.corp.blizzard.net> <796FAD48C7891F43A943B67DF279C58927E5F440B4@ES04SNLNT.srn.sandia.gov> Message-ID: Link, Hamilton wrote: > - clr.so bootstraps mono (under Windows the OS knows how to dlload a .net assembly already) to enable .net assembly extensions and I assumed perhaps recklessly that it laterals to clr.pyd The code in src/monoclr is compiled to a shared library (.so on most Unices and .dyload on Mac OS X) and a standalone Python executable. The library is a Python extension which initializes Mono, loads the Python.Runtime assembly and initializes the rest of PythonDotNET. Finally the clr module is replaced by the clr module from PythonDotNET. However the code is currently broken. svn blame points to r98 jfrayne. :) > - clr.pyd loads Python.Runtime.dll clr.pyd is a Windows and .NET only Python extension that loads the runtime. The clr.so/pyd/dyload module is only required when you want to embed .NET code into CPython. For the other way around it's not required. > - Python.Runtime.dll, regardless of platform, turns around and uses P/Invoke to connect into the libpython2.5.so/dll, and then you're all set Yeah. The Python.Runtime assembly also provides the clr module you can see inside Python and the import hook to import namespaces from .NET assemblies. Christian From helink at sandia.gov Wed Dec 3 19:12:15 2008 From: helink at sandia.gov (Hamilton Link) Date: Wed, 3 Dec 2008 11:12:15 -0700 Subject: [Python.NET] path question: clr.so being picky about paths In-Reply-To: References: <4935DE66.3090605@sandia.gov>, <07A480006269DF4CA5433912783454F704FFB025@BL-EXCHANGE.corp.blizzard.net> <796FAD48C7891F43A943B67DF279C58927E5F440B4@ES04SNLNT.srn.sandia.gov> Message-ID: <4936CBFF.5070501@sandia.gov> Sure enough, under ubuntu (though I'm about to switch to fedora) I only need clr.so and Python.Runtime.dll. So, obviously I have some more digging to do on how this all works. But how is clr.so broken precisely? It appears to work... h Christian Heimes wrote: > Link, Hamilton wrote: > >> - clr.so bootstraps mono (under Windows the OS knows how to dlload a .net assembly already) to enable .net assembly extensions and I assumed perhaps recklessly that it laterals to clr.pyd >> > > The code in src/monoclr is compiled to a shared library (.so on most > Unices and .dyload on Mac OS X) and a standalone Python executable. The > library is a Python extension which initializes Mono, loads the > Python.Runtime assembly and initializes the rest of PythonDotNET. > Finally the clr module is replaced by the clr module from PythonDotNET. > > However the code is currently broken. svn blame points to r98 jfrayne. :) > > >> - clr.pyd loads Python.Runtime.dll >> > > clr.pyd is a Windows and .NET only Python extension that loads the runtime. > > The clr.so/pyd/dyload module is only required when you want to embed > .NET code into CPython. For the other way around it's not required. > > >> - Python.Runtime.dll, regardless of platform, turns around and uses P/Invoke to connect into the libpython2.5.so/dll, and then you're all set >> > > Yeah. The Python.Runtime assembly also provides the clr module you can > see inside Python and the import hook to import namespaces from .NET > assemblies. > > Christian > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet > > > From honey33145 at gmail.com Thu Dec 4 06:55:41 2008 From: honey33145 at gmail.com (navneet khanna) Date: Thu, 4 Dec 2008 11:25:41 +0530 Subject: [Python.NET] Access functions in dll class Message-ID: Hello Everybody I am able to import the dll and able to access the class of the dll. But when I am trying to access the methods in the dll its showing error. #Class1 is the class in dll and next is the function. Class1.Bin_To_Dec("11") Traceback (most recent call last): File "", line 1, in Class1.Bin_To_Dec("11") TypeError: No method matches given arguments Please help me to find out where am i wrong? Do I need to create object of dll class and then access it? If yes then how can I access it? Thanks Navneet -------------- next part -------------- An HTML attachment was scrubbed... URL: From honey33145 at gmail.com Thu Dec 4 10:20:47 2008 From: honey33145 at gmail.com (navneet khanna) Date: Thu, 4 Dec 2008 14:50:47 +0530 Subject: [Python.NET] TypeError: not enough arguments Message-ID: Hello Everbody I have imported a class from vb.net dll in Python. I am able to import all the functions, but its showing such error when trying to access it. g() is a simple function in dll which takes no argument but returns a string. print Class1.g() Traceback (most recent call last): File "", line 1, in print Class1.g() TypeError: not enough arguments Please help me out. Thanks Navneet -------------- next part -------------- An HTML attachment was scrubbed... URL: From sambasivareddy.s at patni.com Wed Dec 3 11:51:40 2008 From: sambasivareddy.s at patni.com (sambasivareddy) Date: Wed, 3 Dec 2008 16:21:40 +0530 Subject: [Python.NET] How to write a string with required color in a file with python.net? Message-ID: <011501c95535$20b302c0$750ba8c0@patni.com> Hi all, I have couple of double on python futures .Quires listed below: * How to write a particular string with required/selected color in a file with python.net? Which module I need to use it? How to set color for particular string in file? --------------------------------- file=open("C:\\test\\TestResult.txt","w") file.writelines("testcase1 pass \n") file.writelines("testcase2 Faile \n") file.close() ----------------------------- I want output like this in file: testcase1 pass testcase2 Faile * How to create .exe file in python.net? I have tried with py2exe module but it is not supporting with python.net if anyone have any information or code on the same queries plz send it. thanks in advance. Regards, sambu _____________________________________________________________________ This e-mail message may contain proprietary, confidential or legally privileged information for the sole use of the person or entity to whom this message was originally addressed. Any review, e-transmission dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error kindly delete this e-mail from your records. If it appears that this mail has been forwarded to you without proper authority, please notify us immediately at netadmin at patni.com and delete this mail. _____________________________________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: From honey33145 at gmail.com Wed Dec 3 14:20:56 2008 From: honey33145 at gmail.com (navneet khanna) Date: Wed, 3 Dec 2008 18:50:56 +0530 Subject: [Python.NET] Where does the clr in IronPython look the dll Message-ID: Hello Everybody I am trying to import dll with clr.AddReference("TCdll") I am getting the following error. Traceback (most recent call last): File "", line 1, in clr.AddReference("TCdll") FileNotFoundException: Unable to find assembly 'TCdll'. at Python.Runtime.CLRModule.AddReference(String name) I have loaded the dll in system32 folder. Have I loaded the dll at the right place or do I need to place it anywhere else? Waiting for your replies. Regards Navneet -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at cheimes.de Thu Dec 4 15:09:03 2008 From: lists at cheimes.de (Christian Heimes) Date: Thu, 04 Dec 2008 15:09:03 +0100 Subject: [Python.NET] path question: clr.so being picky about paths In-Reply-To: <4936CBFF.5070501@sandia.gov> References: <4935DE66.3090605@sandia.gov>, <07A480006269DF4CA5433912783454F704FFB025@BL-EXCHANGE.corp.blizzard.net> <796FAD48C7891F43A943B67DF279C58927E5F440B4@ES04SNLNT.srn.sandia.gov> <4936CBFF.5070501@sandia.gov> Message-ID: Hamilton Link wrote: > Sure enough, under ubuntu (though I'm about to switch to fedora) I only > need clr.so and Python.Runtime.dll. So, obviously I have some more > digging to do on how this all works. But how is clr.so broken > precisely? It appears to work... There is an error inside the Makefile for clr.so. It can't be build anymore because it's using a wrong argument when linking the object file. Christian From honey33145 at gmail.com Fri Dec 12 06:52:45 2008 From: honey33145 at gmail.com (navneet khanna) Date: Fri, 12 Dec 2008 11:22:45 +0530 Subject: [Python.NET] concept of creating structures in python Message-ID: Hello Everybody I want to create a structure within a structure i.e. nested structures in python. I tried with everything but its not working. my code is like this: class L(Structure): def __init__(self,Name='ND',Addr=0,ds_obj = D()): self.Name = Name self.Addr = Addr self.ds_obj = ds_obj class D(Structure): def __init__(self,dataName='ND',index = 0,ele_obj=E()): self.dataName = dataName self.index = index self.ele_obj = ele_obj these are two structures. I want to refer D structure in L one and use it. I want to access the value of D structure like L.D.index = 0. Please help me Thanks in advance Navneet -------------- next part -------------- An HTML attachment was scrubbed... URL: From craig_farrow at sil.org Fri Dec 12 09:49:00 2008 From: craig_farrow at sil.org (Craig Farrow) Date: Fri, 12 Dec 2008 16:49:00 +0800 Subject: [Python.NET] Where does the clr in IronPython look the dll In-Reply-To: References: Message-ID: <4942257C.407@sil.org> The dll needs to be on the Python path (sys.path). You can either add to the path with sys.path.append("c:\....") or put your dll in a folder in the Python site-packages directory and add a .pth file (for Python.NET, but not IronPython -- it doesn't recognise the .pth files). Regards, Craig. 3/12/2008 9:20 p.m. d?, navneet khanna wrote: > Hello Everybody > > I am trying to import dll with clr.AddReference("TCdll") > I am getting the following error. > > Traceback (most recent call last): > File "", line 1, in > clr.AddReference("TCdll") > FileNotFoundException: Unable to find assembly 'TCdll'. > at Python.Runtime.CLRModule.AddReference(String name) > > I have loaded the dll in system32 folder. Have I loaded the dll at the > right place or do I need to place it anywhere else? > Waiting for your replies. > > Regards > Navneet > ------------------------------------------------------------------------ > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet From davidgshi at yahoo.co.uk Thu Dec 18 16:45:44 2008 From: davidgshi at yahoo.co.uk (David Shi) Date: Thu, 18 Dec 2008 15:45:44 +0000 (GMT) Subject: [Python.NET] Extracting data from XML containing CDATA and store data in a .dbf file Message-ID: <987290.25265.qm@web26304.mail.ukl.yahoo.com> I am looking for advice/efficient script to extract data from XML containing CDATA. ? I wish to extract all the data and store it in a .dbf file. ? Regards. ? David -------------- next part -------------- An HTML attachment was scrubbed... URL: From expo at expobrain.net Thu Dec 18 17:11:58 2008 From: expo at expobrain.net (Daniele Esposti) Date: Thu, 18 Dec 2008 17:11:58 +0100 Subject: [Python.NET] Extracting data from XML containing CDATA and store data in a .dbf file In-Reply-To: <987290.25265.qm@web26304.mail.ukl.yahoo.com> References: <987290.25265.qm@web26304.mail.ukl.yahoo.com> Message-ID: <494A764E.2090406@expobrain.net> David Shi ha scritto: > > > I am looking for advice/efficient script to extract data from XML > containing CDATA. > > I wish to extract all the data and store it in a .dbf file. > Using System.XML you can iterate over all nodes and call InnerText