Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'bug': 0.02; 'attribute': 0.07; 'subject:version': 0.07; 'python': 0.08; '>>>>': 0.09; 'all?': 0.09; 'determines': 0.09; 'subject:python': 0.10; 'error:': 0.10; 'output': 0.10; 'library': 0.13; 'mon,': 0.15; '_ssl': 0.16; 'adam': 0.16; 'filename.': 0.16; 'linux)': 0.16; 'openssl': 0.16; 'parsed': 0.16; 'subject:linked': 0.16; 'wrote:': 0.16; 'jan': 0.19; 'trying': 0.20; '(most': 0.21; "doesn't": 0.22; 'header:In-Reply-To:1': 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; 'received:209.85.210.46': 0.30; 'received:mail-pz0-f46.google.com': 0.30; 'subject:?': 0.30; 'anyone': 0.31; 'version': 0.31; 'to:addr:python-list': 0.33; 'object': 0.33; 'last):': 0.34; 'ssl': 0.34; 'suggestions': 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; 'subject:: ': 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:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=gZt+BlEPfSe7xdNqEebAC6w2i2QfsjE1TWyJORwzq84=; b=qyf1ylYMhekf7FM4UVC5FEcuBH6yhiU63I+9FudhDGHJoNymwn0IqZjYaMSVX7OOtn pai+suEJ5+ptC/TFYG/egSKkT2c/wvur6DYB3MQcsJGWSmo0p8DuGWNbJcGF/roRs7Gz OoX6wWnrjzkbTPYf8ADV333jrIF10HIfPzdWc= MIME-Version: 1.0 In-Reply-To: References: From: Adam Mercer Date: Wed, 25 Jan 2012 10:02:16 -0600 Subject: Re: Determining version of OpenSSL linked against python? To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 47 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1327507379 news.xs4all.nl 6900 [2001:888:2000:d::a6]:53726 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:19403 Hi Is this possible at all? Cheers Adam On Mon, Jan 23, 2012 at 14:01, Adam Mercer 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: > > =A0 =A0import ssl > =A0 =A0ssl.OPENSSL_VERSION > > but unfortunately I need to support python-2.6, from an older script I > used the following: > > =A0 =A0import _ssl > =A0 =A0ssl_lib =3D _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): > =A0File "", line 1, in > 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