diff --git a/CHANGELOG.md b/CHANGELOG.md index 7266be8..81058ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- +- Gracefully ignore UTF-8 decoding errors by [@XuehaiPan](https://github.com/XuehaiPan). ### Removed diff --git a/nvitop/api/device.py b/nvitop/api/device.py index f257809..6b56693 100644 --- a/nvitop/api/device.py +++ b/nvitop/api/device.py @@ -3146,7 +3146,7 @@ def _parse_cuda_visible_devices( # pylint: disable=too-many-branches,too-many-s ), ], ) - .decode('utf-8') + .decode('utf-8', errors='replace') .strip() .split(',') ) diff --git a/nvitop/api/libnvml.py b/nvitop/api/libnvml.py index fb17667..515ec5a 100644 --- a/nvitop/api/libnvml.py +++ b/nvitop/api/libnvml.py @@ -461,7 +461,7 @@ def nvmlQuery( raise if isinstance(retval, bytes): - retval = retval.decode('utf-8') + retval = retval.decode('utf-8', errors='replace') return retval