Skip to content

Commit 4e0ec81

Browse files
committed
Attach listdir output to "Unable to load" exception message.
1 parent 0ea73b1 commit 4e0ec81

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,13 @@ cdef void* load_library(const int driver_ver) except* with gil:
8989
return handle
9090
err_msg = dlerror().decode(errors="backslashreplace")
9191
error_messages.append(f"Failed to dlopen {so_name}: {err_msg}")
92-
raise RuntimeError(f"Unable to load {so_basename}: {', '.join(error_messages)}")
92+
attachment = []
93+
for so_dirname in candidate_so_dirs:
94+
attachment.append(f" listdir({repr(so_dirname)}):")
95+
for node in sorted(os.listdir(so_dirname)):
96+
attachment.append(f" {node}")
97+
attachment = "\n".join(attachment)
98+
raise RuntimeError(f"Unable to load {so_basename} from: {', '.join(error_messages)}\n{attachment}")
9399

94100

95101
cdef int _check_or_init_nvjitlink() except -1 nogil:

0 commit comments

Comments
 (0)