Help! py2exe or fails with M2Crypto, can't find M2Crypto.SSL.S???

Crispin Wellington crispin at
Thu Dec 20 01:34:57 EST 2001

raiseexception at (Raise Exception) wrote in message news:<97706cb6.0112190956.49d80d20 at>...

> Hi, I'm trying to generate a standalone EXE file using a pretty 

> simple program I wrote.  It uses some of the usual Python modules, 

> Tk, and M2Crypto.  When I use the py2exe program and McMillans's 

>, using M2Crypto generates the same error.  I can 

> even generate the error by simply creating a "" file with 

> just one line containing "import M2Crypto".  py2exe says:


> snip
>   File "d:\python21\lib\M2Crypto\SSL\", line 16, in ?

>     SSLError = getattr(__import__('M2Crypto.SSL', globals(), locals(),

> 'SSLError'), 'SSLError')

>   File "D:\distrib\Installer\", line 287, in importHook

>     raise ImportError, "%s not found in %s" % (nm, ctx)

> ImportError: S not found in M2Crypto.SSL


> Note that if I run my program in the interpreter, everything runs 

> fine.  I don't know what is causing M2Crypto to try and find a 

> module called "SSL.S".  Has anyoneone else ran into this?  Of course 

> I'm going to dig thru it, but I'm on a schedule and would rather fix 

> it first then figure it out later. :)  


> TIA.

Edit line 16 of the offending
change from

SSLError = getattr(__import__('M2Crypto.SSL', globals(), locals(),
'SSLError'), 'SSLError')


SSLError = getattr(__import__('M2Crypto.SSL', globals(), locals(),
['SSLError']), 'SSLError')

And rebuild your project. It should work now.

Kind Regards

Crispin Wellington
crispin at

More information about the Python-list mailing list