Question

I've built python 2.7 debug with MSVC 2008 to debug a script that imports M2Crypto. When I run my script, python_d correctly creates a Python_Eggs cache, and copies both the __m2crypto.pyd and __m2crypto_d.pyd into it. But then it attempts to load the non-debug python module from the cache, and terminates because it contains no debug information. I've rebuilt both openssl and M2Crypto and made certain that no other copies exist on the build machine (a VM.) I've traced through python itself and cannot discover why it will not load the _d.pyd.

Any ideas why this is happening?

Was it helpful?

Solution

First, the problem was that python attempted to load the non-debug version of __m2crypto.pyd, which failed, because it lacked dependent components. This caused python to terminate - not because the module was not found, but because one if its children was not found. This is a critical error for python, and whether this is a bug in python is for other minds to contemplate.

Using DEPENDENCY, I discovered that the openssl libraries were not installed into the python home folder. This was because the script that makes the M2Crypto distribution package has a "feature" which does not include these files. So the following resolved the issue:

  1. Build openssl with debug
  2. Modify the setup() call in M2Crypto\setup.py to include data_files=['ssleay32.dll','libeay32.dll']
  3. Build M2Crypto with debug, using the openssl debug
  4. Install M2Crypto.
  5. Profit!

Afterwards, I was able to import M2Crypto into both python and python_d.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top