Problem building/using M2Crypto extension module

Carl Waldbieser waldbie at attglobal.net
Thu Oct 2 01:59:08 EDT 2003


I tried to adapt the instructions for building the M2Crypto module
(http://sandbox.rulemaker.net/ngps/m2/INSTALL.html) to build a version
compatible with Python2.3, but I've had some mixed results.   I actually got
everything to build and install, but when I try to import M2Crypto-- well,
here is a sample session:

>>> import M2Crypto
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "C:\PYTHON23\Lib\site-packages\M2Crypto\__init__.py", line 7, in ?
    import __m2crypto
ImportError: DLL load failed: The system cannot find the file specified.
>>> import M2Crypto
>>> dir()
['M2Crypto', '__builtins__', '__doc__', '__name__', 'pywin']
>>>

>>> import M2Crypto.Rand
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "C:\PYTHON23\Lib\site-packages\M2Crypto\Rand.py", line 7, in ?
    import m2
  File "C:\PYTHON23\Lib\site-packages\M2Crypto\m2.py", line 7, in ?
    from __m2crypto import *
ImportError: DLL load failed: The system cannot find the file specified.
>>> import M2Crypto.Rand
>>>

As you can see, the first time I try to import the module, it fails, but the
next time, it works.  The same thing happens when I try to import a
sub-module underneath it.

Has anyone experienced any problems similar to this when building extension
modules?  Is there some sort of common trap I might have fallen into?

The following is version info:
I am running Python 2.3.1 on Windows98.  I built the extension from source,
using the mingw compiler 3.2.3.  I built version 0.9-7c of the OpenSSL
library to use with M2Crypto.  This is the first time I used SWIG 1.3.19 and
PExport 0.42h.

This is the first time I have actually tried to build a Python extension on
this PC, so the chances are probably pretty good that I have screwed
something up, but I am not sure how I would go about tracking it down.

If anyone else has successfully built and used this extension for Python2.3
on Windows, I would be glad to hear it, just to know it is possible.  If
anyone has any advice or suggestions, I would also be glad to hear that,
too!

Thanks,
Carl Waldbieser






More information about the Python-list mailing list