Does anyone know how I can find the version of a binary file that has been passed to my function?
I got the following code from this page:
def version(fpath):
f = open(fpath, 'rb')
s = f.read(1024)
print s
f.close()
However, this does not give me any useful output similar to what the mentioned website shows.
Edit: @BoazYaniv tells me that the file format plays in important part in this problem. This is a windows EXE file
We use this code to pull versions from one of our executables for use throughout other programs.
— To encompass the comments —
This requires that the Windows Bindings for Python be installed. They’re available here: http://starship.python.net/~skippy/win32/. This also limits this solution to Windows platforms (which may or may not be an important factor in the final project).