Python and VB6
Date: 11.09.17 - 6:01am
Ok..so there are a ton of python libraries out there I dont want to immediately port over to vb6. How do we communicate between python code and vb6?
Let me start by saying part of me hates this because its pretty hackish and requires dependencies and moons in alignment with packages etc. So this is just for one offs, at present I would never distribute code that ran like this, but with that said I may still need to do it to accomplish a research goal.
So here are our options as I see it so far:
The IPC went smoothly and of course the stdout/file out will go smooth.
As for embedding python and using it from vb6 directly as the dll. This was my first thought on the way to go and I may play with it, but it will be the most work. The python dll is not stdcall so we will need a C shim to access its api and provide wrappers. This is probably the only way I would consider this technique for distribution with an app because I could control the environment.
*BugFix for cached classes:
So apparently it is by design that once a class is loaded in a process it is cached and changes to the file do not take effect until the module is manually reloaded or the you get a new process.
For our test code this matters while working in the vb6 IDE since we are doing development work and probably want to edit the python source but are always calling it from the same IDE process instance.
So here is the fix..
In the python class we add an exec method:
Then in VB we can add the following code: