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

    Join Date
    May 2004
    Posts
    27
    Rep Power
    0

    Question How to load, initialize and start ptyhon interpreter from VB?


    Hii All,

    Does anybody know how to load, start python interpreter from VB? What i need is, to send data from VB to Python when it needs. As an example, At runtime i want to send object of perticular class to python and use that object in python script.

    And reference, idea or example is welcome. Please provide your feedback.

    Thanks to all.

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

    Join Date
    Feb 2004
    Location
    London, England
    Posts
    1,585
    Rep Power
    1373
    If you have the Win32All extensions installed then there should already be a COM object registered called "Python.Interpreter". This exposes the functions Eval and Exec, which do what you would expect. This will allow you to execute Python code, but you will not be able to pass Python or VB objects back and forth, just strings, numbers and other basic types.

    The source is in Python\Lib\site-packages\win32com\servers\interp.py.

    Extending it to handle objects is possible, but outside the scope of this post.

    Dave - The Developers' Coach

IMN logo majestic logo threadwatch logo seochat tools logo