Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor bug with native messaging example #557

Open
dahn-zk opened this issue Apr 19, 2024 · 2 comments · May be fixed by #558
Open

minor bug with native messaging example #557

dahn-zk opened this issue Apr 19, 2024 · 2 comments · May be fixed by #558
Labels
idle Issues and pull requests with no activity for three months.

Comments

@dahn-zk
Copy link

dahn-zk commented Apr 19, 2024

this line will throw when you create required key in HKEY_LOCAL_MACHINE instead of HKEY_CURRENT_USER ( which is allowed ) , so this script should not behave like this :

key = winreg.OpenKey(getattr(winreg, root), key_path)

also , as the script is in Python anyway , the whole thing can be simplified using for-else :

for root in key_roots:
    try:
        key = winreg.OpenKey(getattr(winreg, root), key_path)
        print('Checking:', root, key_path)
        res = winreg.QueryValueEx(key, '')
    except FileNotFoundError:
        continue
    break
else:
    raise ValueError('Could not find a registry entry, aborting.')

let me know if you want me rather create a small PR with this fix

Copy link

It looks like this is your first issue. Welcome! 👋 One of the project maintainers will be with you as soon as possible. We appreciate your patience. To safeguard the health of the project, please take a moment to read our code of conduct.

@Rob--W
Copy link
Member

Rob--W commented Apr 19, 2024

Thanks for the report. Please submit a PR and I will merge it.

@github-actions github-actions bot added the idle Issues and pull requests with no activity for three months. label May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idle Issues and pull requests with no activity for three months.
Projects
None yet
2 participants