diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2020-02-09 21:07:45 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2020-02-09 21:07:45 +0100 |
commit | 13cf7d7ab356233c3bb8dc34f1143e7bb0c2c088 (patch) | |
tree | e9a9ea8dd2654f5a19810c2653e0c47bab5bbf75 /psutil/_common.py | |
parent | 72274ac02bd9b3b0c08acf861a2df223538b1c9e (diff) | |
download | psutil-13cf7d7ab356233c3bb8dc34f1143e7bb0c2c088.tar.gz |
fix #1650 [Linux] sensors_temperatures() no longer emit warnings on file not found (print debug msg instead)
Diffstat (limited to 'psutil/_common.py')
-rw-r--r-- | psutil/_common.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/psutil/_common.py b/psutil/_common.py index 729b1983..453c771d 100644 --- a/psutil/_common.py +++ b/psutil/_common.py @@ -7,7 +7,7 @@ # Note: this module is imported by setup.py so it should not import # psutil or third-party modules. -from __future__ import division +from __future__ import division, print_function import contextlib import errno @@ -66,7 +66,7 @@ __all__ = [ 'conn_tmap', 'deprecated_method', 'isfile_strict', 'memoize', 'parse_environ_block', 'path_exists_strict', 'usage_percent', 'supports_ipv6', 'sockfam_to_enum', 'socktype_to_enum', "wrap_numbers", - 'bytes2human', 'conn_to_ntuple', 'hilite', + 'bytes2human', 'conn_to_ntuple', 'hilite', 'debug', ] @@ -787,3 +787,11 @@ def hilite(s, ok=True, bold=False): if bold: attr.append('1') return '\x1b[%sm%s\x1b[0m' % (';'.join(attr), s) + + +if bool(os.getenv('PSUTIL_DEBUG', 0)): + def debug(msg): + print("psutil-debug> " + msg, file=sys.stderr) +else: + def debug(msg): + pass |