#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2004
    Posts
    27
    Rep Power
    0

    Question Python + COM, problem?


    Hii Everybody,

    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.

    Thanks.

    DevHims
  2. #2
  3. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    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.

    http://starship.python.net/crew/mhammond/

    You might also want to look at the VB2Py project but this seems to be more for GUI than anything. I could be wrong!

    http://vb2py.sourceforge.net/

    Hope this helps,

    Mark.
    Last edited by netytan; June 15th, 2004 at 11:29 AM.
    programming language development: www.netytan.com Hula

  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2004
    Location
    London, England
    Posts
    1,585
    Rep Power
    1373
    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
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2004
    Posts
    27
    Rep Power
    0

    Question


    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.

    Thanks again.

    DevHims
  8. #5
  9. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    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 .

    Good luck,

    Mark.
    programming language development: www.netytan.com Hula

  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2004
    Posts
    27
    Rep Power
    0

    Question


    Hey Mark,

    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.

    DevHims

IMN logo majestic logo threadwatch logo seochat tools logo