Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
python: get rvt_file_version
import os.path as op
import olefile
import re
def get_rvt_file_version(rvt_file):
if op.exists(rvt_file):
if olefile.isOleFile(rvt_file):
rvt_ole = olefile.OleFileIO(rvt_file)
file_info = rvt_ole.openstream("BasicFileInfo").read().decode("utf-16le", "ignore")
pattern = re.compile(r"\d{4}")
rvt_file_version =, file_info)[0]
return rvt_file_version
print("file does not apper to be an ole file: {}".format(rvt_file))
print("file not found: {}".format(rvt_file))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment