As mentioned wmic is deprecated ( https://docs.microsoft.com/en-us/windows/win32/wmisdk/wmic ).
I don't see why the wmi module ( https://pypi.org/project/WMI/ ) can't be used instead to get the information, I have a working implementation of this that simply does the following:
current_major_version = wmi.WMI().Win32_OperatingSystem()[0].Caption.encode("ascii", "ignore").decode(
"utf-8")
if "8" in current_major_version:
pass
elif "7" in current_major_version:
pass
elif "10" in current_major_version:
pass
elif "11" in current_major_version:
pass