windows: default version to '0' when looking for Ghostscript

To avoid ValueError: max() arg is an empty sequence

As suggested by @meet1919 in #833.
This commit is contained in:
James R. Barlow
2021-11-14 23:00:08 -08:00
parent 7959f7628d
commit 7ce1692eef
+1 -1
View File
@@ -51,7 +51,7 @@ def registry_path_ghostscript(env=None) -> Iterator[Path]:
with winreg.OpenKey(
winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Artifex\GPL Ghostscript"
) as k:
latest_gs = max(registry_subkeys(k), key=LooseVersion)
latest_gs = max(registry_subkeys(k), key=LooseVersion, default='0')
with winreg.OpenKey(
winreg.HKEY_LOCAL_MACHINE, fr"SOFTWARE\Artifex\GPL Ghostscript\{latest_gs}"
) as k: