Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #19423 > unrolled thread

Re: Determining version of OpenSSL linked against python?

Started byTerry Reedy <tjreedy@udel.edu>
First post2012-01-25 15:04 -0500
Last post2012-01-25 15:04 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Determining version of OpenSSL linked against python? Terry Reedy <tjreedy@udel.edu> - 2012-01-25 15:04 -0500

#19423 — Re: Determining version of OpenSSL linked against python?

FromTerry Reedy <tjreedy@udel.edu>
Date2012-01-25 15:04 -0500
SubjectRe: Determining version of OpenSSL linked against python?
Message-ID<mailman.5088.1327521886.27778.python-list@python.org>
On 1/25/2012 11:02 AM, Adam Mercer wrote:

> Is this possible at all?

If you are not willing to tell Debian Squeeze users to install 2.7, or 
that they cannot run your program, ask the bug reporter to tell you what 
version of OpenSSL the system comes with and code it into your program.

Or possibly, depending on what you do with the version info and what the 
differences are between versions, replace 'if version ...' constructs 
with 'try ... except...' constructs.

> On Mon, Jan 23, 2012 at 14:01, Adam Mercer<ramercer@gmail.com>  wrote:
>> Hi
>>
>> 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
>> use:
>>
>>     import ssl
>>     ssl.OPENSSL_VERSION
>>
>> 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
>>>>> _ssl.__file__
>> 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?

-- 
Terry Jan Reedy

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web