mirror of
https://github.com/XuehaiPan/nvitop.git
synced 2026-05-15 06:06:12 -06:00
[GH-ISSUE #212] [BUG] Device methods not throwing exceptions #118
Labels
No labels
api
bug
bug
cli / tui
dependencies
documentation
documentation
documentation
duplicate
enhancement
exporter
invalid
pull-request
pynvml
question
question
upstream
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/nvitop#118
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @lancylot2004 on GitHub (May 2, 2026).
Original GitHub issue: https://github.com/XuehaiPan/nvitop/issues/212
Originally assigned to: @XuehaiPan on GitHub.
Required prerequisites
What version of nvitop are you using?
1.6.2
Operating system and version
Rocky Linux 9.5 (Blue Onyx) / macOS Tahoe 26.4
Problem description
Device.from_indices(and thereforeDevice.all) promises to throw exceptions such asNVMLError_LibraryNotFoundbut actually swallows all. I'd expect NVML related exceptions to be surfaced.Steps to Reproduce
The Python snippets (if any):
@XuehaiPan commented on GitHub (May 2, 2026):
Hi @lancylot2004, I think it is intentional. The exception is catched in
Device.from_indices()(noindicesargument is passed):2f68dd269d/nvitop/api/device.py (L463-L467)If you pass the
indicesargument to the method, it will raise theNVMLError_LibraryNotFoundexception:The better way is to use
Device.is_available()method:2f68dd269d/nvitop/api/device.py (L331-L337)Or
Device.count()like the CLI does:2f68dd269d/nvitop/cli.py (L299-L308)