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


Groups > comp.lang.python > #19279

Determining version of OpenSSL linked against python?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!tudelft.nl!txtfeed1.tudelft.nl!multikabel.net!newsfeed20.multikabel.net!news2.euro.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ramercer@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'bug': 0.02; 'attribute': 0.07; 'subject:version': 0.07; 'python': 0.08; 'determines': 0.09; 'subject:python': 0.10; 'error:': 0.10; 'output': 0.10; 'library': 0.13; '_ssl': 0.16; 'adam': 0.16; 'filename.': 0.16; 'linux)': 0.16; 'openssl': 0.16; 'parsed': 0.16; 'subject:linked': 0.16; '>>>': 0.18; 'trying': 0.20; '(most': 0.21; "doesn't": 0.22; 'cheers': 0.23; '(on': 0.23; 'debian': 0.23; 'traceback': 0.24; 'code': 0.25; 'module': 0.26; 'import': 0.27; "i'm": 0.27; 'script': 0.28; 'message-id:@mail.gmail.com': 0.28; 'seem': 0.29; 'subject:?': 0.30; 'anyone': 0.31; 'version': 0.31; 'received:209.85.216.46': 0.32; 'received:mail- qw0-f46.google.com': 0.32; 'to:addr:python-list': 0.33; 'object': 0.33; 'last):': 0.34; 'ssl': 0.34; 'suggestions': 0.35; 'file': 0.35; 'query': 0.36; 'but': 0.37; 'received:google.com': 0.37; 'using': 0.37; 'skip:_ 10': 0.37; 'linked': 0.38; 'received:209.85': 0.38; 'received:209': 0.39; 'to:addr:python.org': 0.40; 'success': 0.60; 'alternative': 0.65; 'offer': 0.72; 'against,': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; bh=59LrnpuMyi6YG+QFk094uimAjOl/yWZ7hwW7qFn+vbg=; b=jmPbag+tfFGNWmqUNcF19WJVTfTQxoGbYYUFykSMCpsbzkZ9qRsmaIQ8roysXTQFz4 uG1nskz30HHGT4ZexQ8lp6qC8Lm5hmCbGzbuszqOIRgCeAXmMZm3Z7chEtFUMJem0qfx gGEVZ7Pys7sw1ZIgxIXPviatssXZHa/VjGM7s=
MIME-Version 1.0
From Adam Mercer <ramercer@gmail.com>
Date Mon, 23 Jan 2012 14:01:29 -0600
Subject Determining version of OpenSSL linked against python?
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4974.1327348932.27778.python-list@python.org> (permalink)
Lines 38
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1327348932 news.xs4all.nl 6963 [2001:888:2000:d::a6]:34221
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:19279

Show key headers only | View raw


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?

Cheers

Adam

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Determining version of OpenSSL linked against python? Adam Mercer <ramercer@gmail.com> - 2012-01-23 14:01 -0600
  Re: Determining version of OpenSSL linked against python? Anssi Saari <as@sci.fi> - 2012-01-25 23:21 +0200
    Re: Determining version of OpenSSL linked against python? Adam Mercer <ramercer@gmail.com> - 2012-01-25 15:40 -0600

csiph-web