Skip to content

Commit

Permalink
catch FileNotFoundError
Browse files Browse the repository at this point in the history
  • Loading branch information
zariiii9003 committed Oct 26, 2023
1 parent bac6406 commit 8fb9166
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pycanape/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ def _kill_canape_processes() -> None:
def get_canape_versions() -> List[CANapeVersion]:
"""Return a list of all CANape versions, that can be found in Windows Registry."""
versions: List[CANapeVersion] = []
with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\VECTOR\\CANape") as key:
with contextlib.suppress(FileNotFoundError), winreg.OpenKey(
winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\VECTOR\\CANape"
) as key:
_sub_key_count, value_count, _last_modified = winreg.QueryInfoKey(key)
for idx in range(value_count):
name, _data, _type = winreg.EnumValue(key, idx)
Expand Down

0 comments on commit 8fb9166

Please sign in to comment.