This is an automated email from the ASF dual-hosted git repository.

junrushao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm-ffi.git


The following commit(s) were added to refs/heads/main by this push:
     new 53a7fe9  [PYTHON] Robustify libinfo finding (#185)
53a7fe9 is described below

commit 53a7fe9f64a96eacdb044b1d7ac1ed1d17f3da70
Author: Tianqi Chen <[email protected]>
AuthorDate: Tue Oct 21 11:33:41 2025 -0700

    [PYTHON] Robustify libinfo finding (#185)
    
    This PR robustifies libinfo finding via resolve
---
 python/tvm_ffi/libinfo.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/python/tvm_ffi/libinfo.py b/python/tvm_ffi/libinfo.py
index a16d5fc..dcbfda4 100644
--- a/python/tvm_ffi/libinfo.py
+++ b/python/tvm_ffi/libinfo.py
@@ -64,7 +64,17 @@ def get_dll_directories() -> list[str]:
         dll_path.extend(Path(p) for p in split_env_var("PATH", ":"))
     elif sys.platform.startswith("win32"):
         dll_path.extend(Path(p) for p in split_env_var("PATH", ";"))
-    return [str(path.resolve()) for path in dll_path if path.is_dir()]
+
+    valid_paths = []
+    for path in dll_path:
+        try:
+            if path.is_dir():
+                valid_paths.append(str(path.resolve()))
+        except OSError:
+            # need to ignore as resolve may fail if
+            # we don't have permission to access it
+            pass
+    return valid_paths
 
 
 def find_libtvm_ffi() -> str:

Reply via email to