June 15th, 2004, 10:44 AM
Python + COM, problem?
Actually i am not much with COM developement. I want to make sure before get into deeply.
My requirement is to send and retrieve data from Vb to ptyhon. I dodnot know any way to do it. Then i thought of COM development in Python and use it in VB classes.
If i develope COM server in python & use VB as COM client, then can i use it in VB to send and retrieve data from python to VB and VB to python?
Can anybody provide some example or refernece or suggestion? Everything is welcome.
June 15th, 2004, 11:26 AM
Examples no since i've never used VB although as for COM you will need Mark Hammond's Win32all module - although its well worth having this installed if you on Windows, even if you never use COM.
You might also want to look at the VB2Py project but this seems to be more for GUI than anything. I could be wrong!
Hope this helps,
Last edited by netytan; June 15th, 2004 at 11:29 AM.
June 15th, 2004, 11:44 AM
You can do it all from the docs that comes with Win32All, but the docs are fairly sparse, as you have probably found out already.
I highly recommend getting hold of a copy of the book "Python Programming on Win32" by Mark Hammond and Andy Robinson. It covers using Python and COM in depth, including examples of both Python as COM servers and clients, and calling a Python COM server from VB.
Dave - The Developers' Coach
June 16th, 2004, 09:30 AM
Thanks Guys. I really appriciate your help. I have vry few days to finish it. so, i will go with documantation comes with win32all. I hope everything works out.
Still i need one more suggestion. Which one is good/fast/appropiate to develop? COM server in VB or COM server in Python?
My requirement is to provide enduser facility to write code in python and use data from VB. Python script develop by enduser will use by my program developed in VB at runtime.
June 16th, 2004, 09:43 AM
As mentioned i've never used VB but it really depends on which you are more comfortable with.
Imagine a C programmer who has done nothing else for say a year and you hand him a project to be done in Python. It will probably be faster for him to write it in C, even though Python programs are about 4 times shorter .
June 17th, 2004, 02:07 PM
I do not have any clue how to transfer data from VB to Python or Python To VB even if u use COM. Because everytime you create Instance of COM server, it is new object. It can not access data which is created by another COM client. I tried using Both Python and VB for COM Server.
what i want is to provide functionality to user to write script in python and access data whcih are available at runtime of my VB application. For that i have to provide common interface between VB and Python, so user can access data which are available at run time.
Using COM, whichevr is COM client either VB or Python, it creates new instance and using that instance it can not get runtime data which are created by another COM client or which currently available.
Do u have any idea? or any suggestion for this. I have very less time to finish this.