diff --git a/HISTORY.rst b/HISTORY.rst index 78e533234..ad07d07c0 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -22,6 +22,9 @@ XXXX-XX-XX **Bug fixes** +- 2195_, [Linux]: no longer print exception at import time in case /proc/stat + can't be read due to permission error. Redirect it to ``PSUTIL_DEBUG`` + instead. - 2241_, [NetBSD]: can't compile On NetBSD 10.99.3/amd64. (patch by Thomas Klausner) - 2245_, [Windows]: fix var unbound error on possibly in `swap_memory()`_ diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py index cc37c0615..628cd4b35 100644 --- a/psutil/_pslinux.py +++ b/psutil/_pslinux.py @@ -16,7 +16,6 @@ import socket import struct import sys -import traceback import warnings from collections import defaultdict from collections import namedtuple @@ -284,9 +283,9 @@ def set_scputimes_ntuple(procfs_path): try: set_scputimes_ntuple("/proc") -except Exception: # pragma: no cover +except Exception as err: # pragma: no cover # Don't want to crash at import time. - traceback.print_exc() + debug("ignoring exception on import: %r" % err) scputimes = namedtuple('scputimes', 'user system idle')(0.0, 0.0, 0.0)