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


Groups > comp.lang.python > #5027

Finding the bitness of an arbitrary executable with Python

Path csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <bahamutzero8825@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'subject:Python': 0.04; 'assign': 0.05; 'parameter': 0.05; '32-bit': 0.09; 'received:192.168.1.3': 0.09; 'underlying': 0.09; 'exception': 0.12; 'win32': 0.12; "'')": 0.16; 'file).': 0.16; 'file,': 0.22; '(and': 0.22; '(on': 0.23; '64-bit': 0.23; 'windows': 0.26; 'google': 0.27; "doesn't": 0.28; 'raise': 0.29; 'message- id:@gmail.com': 0.30; 'to:addr:python-list': 0.32; "isn't": 0.34; 'uses': 0.34; 'received:192.168.1': 0.34; 'received:192': 0.34; 'there': 0.35; 'file': 0.35; 'header:User-Agent:1': 0.35; 'executable': 0.35; 'rather': 0.36; 'received:192.168': 0.37; 'received:209.85': 0.37; 'subject:with': 0.37; 'received:google.com': 0.38; 'but': 0.38; 'anything': 0.38; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'would': 0.40; 'header:Received:5': 0.40; 'give': 0.61; 'nice,': 0.84; 'received:209.85.210.174': 0.84; 'received:mail- iy0-f174.google.com': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:x-enigmail-version:content-type:content-transfer-encoding; bh=ToHL009xdIjyCKMhLjrnLVTAcFUbniSLrMp7MbxIQ30=; b=hqWX9H25zbyUx1QWUuOdBWwt0pVD2Bs5ou53JGS5bKsWCclg4CuSMBhAA+V1o9uWCB /gpotVfNNWKVp0y3TmcrC8RLa+HreB32A4iSKnJjJFHu2F83aV18N+Fm1+qt7lvZi0SQ lfuTUhicBEymPYMq+wUzhhO102bGhEhOu7Wqg=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :x-enigmail-version:content-type:content-transfer-encoding; b=o/mL7o9oWqiN+uns7GIGB2DaoU80dsmQa2VE7iCA+/rfXE3gVD5MyMlqE1wcD5SSaE NXFOj4vBNDGP/Kq/2zQnOWZCXcqdji0jHF1zuarkuVEBCC6F2OwrJ6vHGqbzucafKwQ5 f06gu0WbAfx4Ku8mrldsPoIuSdtCQ11NUZdXg=
Date Mon, 09 May 2011 15:52:52 -0500
From Andrew Berg <bahamutzero8825@gmail.com>
User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 ThunderBrowse/3.3.5
MIME-Version 1.0
To python-list@python.org
Subject Finding the bitness of an arbitrary executable with Python
X-Enigmail-Version 1.1.1
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
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.1358.1304974381.9059.python-list@python.org> (permalink)
Lines 9
NNTP-Posting-Host 82.94.164.166
X-Trace 1304974381 news.xs4all.nl 41103 [::ffff:82.94.164.166]:55319
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:5027

Show key headers only | View raw


I need to find whether a given file is 32-bit or 64-bit (and raise an
exception if the file doesn't exist or isn't an executable file). I
thought platform.architecture() would do this, but it returns ('64bit',
'') no matter what value I assign to the executable parameter (looks
like it uses the given executable to find info on the underlying system
rather than info on the specific file, reverting to sys.executable if
there are any errors). A quick look on Google doesn't give me anything
useful. Something cross-platform would be nice, but it really only needs
to work on Windows (on win32 binaries).

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


Thread

Finding the bitness of an arbitrary executable with Python Andrew Berg <bahamutzero8825@gmail.com> - 2011-05-09 15:52 -0500
  Re: Finding the bitness of an arbitrary executable with Python Richard Thomas <chardster@gmail.com> - 2011-05-09 14:02 -0700
  Re: Finding the bitness of an arbitrary executable with Python Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2011-05-09 23:10 +0200
    Re: Finding the bitness of an arbitrary executable with Python Andrew Berg <bahamutzero8825@gmail.com> - 2011-05-09 16:44 -0500

csiph-web