Determining version of OpenSSL linked against python?
ramercer at gmail.com
Wed Jan 25 11:02:16 EST 2012
Is this possible at all?
On Mon, Jan 23, 2012 at 14:01, Adam Mercer <ramercer at gmail.com> wrote:
> I'm trying to write a script that determines the version of OpenSSL
> that python is linked against, using python-2.7 this is easy as I can
> import ssl
> but unfortunately I need to support python-2.6, from an older script I
> used the following:
> import _ssl
> ssl_lib = _ssl.__file__
> to get the path to the _ssl.so module and then I parsed the output of
> ldd (on linux) to get the path to the OpenSSL library and then parsed
> the version from the filename. In other words it's very messy.
> I had a little success using this approach but I have recently
> received a bug report that this doesn't seem to work on Debian
> Squeeze. When I try to query the __file__ attribute of the _ssl module
> I get the following error:
>>>> import _ssl
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> AttributeError: 'module' object has no attribute '__file__'
> Can anyone offer any suggestions as to what is going wrong with the
> above code or offer an alternative way of determining the OpenSSl
> version using python-2.6?
More information about the Python-list