Skip to content

Commit

Permalink
fix #2195 / linux: no longer print exception at import time
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Oct 13, 2023
1 parent 84cdeb4 commit becbe86
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 3 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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()`_
Expand Down
5 changes: 2 additions & 3 deletions psutil/_pslinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import socket
import struct
import sys
import traceback
import warnings
from collections import defaultdict
from collections import namedtuple
Expand Down Expand Up @@ -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)


Expand Down

0 comments on commit becbe86

Please sign in to comment.