bob morane
bob morane

Reputation: 660

get version of python module.pyd

I load a .pyd file as python module. Under windows I see a version when I do a right click->Properties->"Details"-Tab

How can I read (in python) the fileversion of this pyd-file?

Exists a function or something in python to read this version?

Upvotes: 1

Views: 1703

Answers (1)

falsetru
falsetru

Reputation: 369394

Using win32api.GetFileVersionInfo:

>>> import win32api
>>> path = r'c:\python27\lib\site-packages\win32\win32api.pyd'
>>> info = win32api.GetFileVersionInfo(path, '\\')
>>> '{}.{}.{}.{}'.format(
...     win32api.HIWORD(info['FileVersionMS']),
...     win32api.LOWORD(info['FileVersionMS']),
...     win32api.HIWORD(info['FileVersionLS']),
...     win32api.LOWORD(info['FileVersionLS']))
'2.7.218.0'

Upvotes: 1

Related Questions