June 18th, 2004, 08:32 AM
How to load, initialize and start ptyhon interpreter from VB?
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.
June 18th, 2004, 09:37 AM
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