On May 9, 9:52 pm, Andrew Berg <bahamutzero8...@gmail.com> wrote: > 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).
I don't know of anything that does that. If you wanted to do it yourself the correct place to start is by reading up on the Protable Executable Format: http://en.wikipedia.org/wiki/PE_format. That page has references to the MSDN article which is probably most useful. Other platforms have other executable formats of course but there's no reason it couldn't exist... -- http://mail.python.org/mailman/listinfo/python-list