views:

30

answers:

0

What's the best way to call python scripts from Visual Basic 2005?

I've got an application written in visual basic 2005 that needs to call into a library written in python. The library requires python 2.6. I'm using the python C API to access the python library from the visual basic code (private declare function blah lib "python26.dll" etc). I'm doing it this way because I want to pull values out of python after the python library does its thing. Unfortunately, I get an error about the C run-time:

"R6034: An application has made an attempt to load the C runtime library incorrectly."

I think it's a conflict between MSVCR80.dll (the 2005 runtime) and MSVCR90.dll (the 2008 runtime that python 26 uses). A simple stub program written with Visual C++ 2005 that does essentially the same thing as the visual basic code also throws that error. If I compile with Visual C++ 2008 it runs fine.

So what do I do about it? I can't move away from VB, or even move to the 2008 version. I've already recompiled python 2.6 using MSVC 2005, and that wasn't enough. Do I have to track down all of the python packages the library uses and recompile those too? It seems like there must be an easier way.