Python Forum
Testing If a string has anything in it
Thread Rating:
  • 4 Vote(s) - 3.25 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Testing If a string has anything in it
#2
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
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())
Reply


Messages In This Thread
Testing If a string has anything in it - by elliep - Jul-28-2017, 02:54 PM
RE: Testing If a string has anything in it - by Larz60+ - Jul-28-2017, 04:38 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  testing if a character in a string is an intended one Skaperen 2 2,697 Feb-27-2018, 02:51 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020