Getting File (exe or dll) Versions

Lo Sheng losheng at yahoo.com
Thu Oct 7 03:46:16 EDT 2004


Hi, 

I have dugged through the newsgroups to find a simple solution to find
the file version of a windows exe or dll file. The following approach
that uses Scripting object only works for 2k and XP:

import win32com.client
fso = win32com.client.Dispatch('Scripting.FileSystemObject')
fso.GetFileVersion('c:\\foo.dll')

On a Korean Windows 98SE, I get the following problem:

--- output log --
>>> fso.GetFileVersion('c:\\foo.dll')
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "C:\Python23\Lib\site-packages\win32com\client\dynamic.py",
line 489, in __getattr__
    raise AttributeError, "%s.%s" % (self._username_, attr)
AttributeError: scripting.filesystemobject.GetFileVersion
--- end of output log ---

Does any one know what the root problem is, or what the workaround
should be?

Thanks in advance!

ls



More information about the Python-list mailing list