More M2Crypto issues

John Nagle nagle at
Thu Jan 18 21:50:40 CET 2007

    Upgraded to Python 2.5 on the Linux system, rebuild M2Crypto,
and it stil fails, but the last line of the error message changed to:

ValueError: invalid literal for long() with base 10: '_40f91a08_p_SSL_CTX'

    Others have encountered this problem, from a Google search.

    Is "long" supposed to operate on C objects?

    					John Nagle

John Nagle wrote:
>   I've been running M2Crypto successfully using Python 2.4 on Windows 2000,
> and now I'm trying to get it to work on Python 2.3.4 on Linux.
>   Attempting to initialize a context results in
> Traceback (most recent call last):
>   File "/www/htdocs/", line 46, in ?
>     DetailsPageBuilder.detailspage(kdbfile,ktemplatefile,url)    # check 
> and display domain or URL as web page
>   File "./sitetruth/", line 70, in detailspage
>     sitecert = InfoSSL2.Certificate(siteinfo, kverifylocations, verbose)
>   File "./sitetruth/", line 147, in __init__
>     self.ctx = createsslcontext(trustedcafile, verbose)    # Generate 
> general SSL context
>   File "./sitetruth/", line 40, in createsslcontext
>     ctx = SSL.Context('sslv3')                            # Create 
> context with SSL params
>   File "/home/sitetruth/lib/python/M2Crypto/SSL/", line 43, in 
> __init__
>     map()[long(self.ctx)] = self
> ValueError: invalid literal for long(): _480e1008_p_SSL_CTX
>    which, when I look at the code and try some test cases, seems
> legitimate.  The cacheing code is trying to convert a reference to an
> object (a C object, in fact) into a "long".  Python 2.4 on Windows
> will do that.  Python 2.3.4 on Linux converts it to a string first,
> gets "_480e1008_p_SSL_CTX", and then tries to convert that to an
> integer, which fails.
>    M2Crypto is supposed to work with Python 2.3, so this should work.
>                 John Nagle

More information about the Python-list mailing list