I'm using .net framework 4.5 but have had the same result with 4.0:
If I write a bare bones console application to initialize python.net, it works as expected. If I try to do the same thing from a winforms application, I get "Unable to load DLL 'python27': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"
If I reference the functioning console application from the winforms application and call a method that initializes python.net, the same thing happens. Build settings are default for both projects.
I even went as far as putting python27 straight into the executable folder but the same error still occurs so I'm guessing this might be a 32 vs 64 bit issue even though both projects are configured for any cpu.
After some more poking around I found out two things:
Changing the build target to x86 solved the missing DLL error, however the application still cryptically crashed when calling PythonEngine.Initialize(). I was able to solve this by making sure that the initialization takes place before any other code is executed.
I can have some fun now :) Hope you guys good luck and have fun!
User contributions licensed under CC BY-SA 3.0