Rather than try to fix all of the errors, here's one that works.
This was done on python 3.6.2 so you may have to tweak a bit
please note that you shouldn't use _winreg, rather winreg
This was done on python 3.6.2 so you may have to tweak a bit
please note that you shouldn't use _winreg, rather winreg
import winreg import traceback import logging import sys def getMDACversion(): base = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) try: hkey = int(winreg.OpenKey( base, 'SOFTWARE\\Python\\PythonCore', 0, winreg.KEY_READ)) print(hkey) # result = winreg.QueryValueEx(hKey, "ImagePath") # return result[0] except: exc_type, exc_value, exc_traceback = sys.exc_info() logging.error(repr(traceback.format_exception(exc_type, exc_value, exc_traceback))) print(getMDACversion())