Skip to content

Commit 6ec439c

Browse files
fs-eireCopilot
authored andcommitted
python: make print_debug_info robust when LD_LIBRARY_PATH is unset on Linux (microsoft#25704)
### Description fixes microsoft#25700 --------- Co-authored-by: Copilot <[email protected]>
1 parent 72bd6dc commit 6ec439c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

onnxruntime/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@ def print_debug_info():
215215
print(f"{package} not installed")
216216

217217
if platform.system() == "Windows":
218-
print(f"\nEnvironment variable:\nPATH={os.environ['PATH']}")
218+
print(f"\nEnvironment variable:\nPATH={os.environ.get('PATH', '(unset)')}")
219219
elif platform.system() == "Linux":
220-
print(f"\nEnvironment variable:\nLD_LIBRARY_PATH={os.environ['LD_LIBRARY_PATH']}")
220+
print(f"\nEnvironment variable:\nLD_LIBRARY_PATH={os.environ.get('LD_LIBRARY_PATH', '(unset)')}")
221221

222222
if importlib.util.find_spec("psutil"):
223223

0 commit comments

Comments
 (0)