Skip to content

Commit 9d72fe7

Browse files
committed
move decode into try block
1 parent 6eabc90 commit 9d72fe7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

distributed/diagnostics/nvml.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,11 @@ def init_once():
104104
NVML_STATE = NVMLState.DISABLED_LIBRARY_NOT_FOUND
105105
return
106106

107-
if _in_wsl() and parse_version(
108-
pynvml.nvmlSystemGetDriverVersion().decode()
109-
) < parse_version(MINIMUM_WSL_VERSION):
107+
try:
108+
driver_vsn = pynvml.nvmlSystemGetDriverVersion().decode()
109+
except AttributeError:
110+
driver_vsn = pynvml.nvmlSystemGetDriverVersion()
111+
if _in_wsl() and parse_version(driver_vsn) < parse_version(MINIMUM_WSL_VERSION):
110112
NVML_STATE = NVMLState.DISABLED_WSL_INSUFFICIENT_DRIVER
111113
return
112114
else:

0 commit comments

Comments
 (0)