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

Crispin Wellington crispin at iinet.net.au
Thu Dec 20 01:34:57 EST 2001


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

> 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 

> Standalone.py, using M2Crypto generates the same error.  I can 

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

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

> 

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

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

> 'SSLError'), 'SSLError')

>   File "D:\distrib\Installer\iu.py", 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 Connection.py
change from

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

to

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

And rebuild your project. It should work now.

Kind Regards

Crispin Wellington
crispin at iinet.net.au



More information about the Python-list mailing list