summaryrefslogtreecommitdiffstats
path: root/glances/cpu_percent.py
diff options
context:
space:
mode:
Diffstat (limited to 'glances/cpu_percent.py')
-rw-r--r--glances/cpu_percent.py16
1 files changed, 3 insertions, 13 deletions
diff --git a/glances/cpu_percent.py b/glances/cpu_percent.py
index 595bd917..6789a9c9 100644
--- a/glances/cpu_percent.py
+++ b/glances/cpu_percent.py
@@ -2,20 +2,10 @@
#
# This file is part of Glances.
#
-# Copyright (C) 2021 Nicolargo <nicolas@nicolargo.com>
+# SPDX-FileCopyrightText: 2022 Nicolas Hennion <nicolas@nicolargo.com>
#
-# Glances is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# SPDX-License-Identifier: LGPL-3.0-only
#
-# Glances is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""CPU percent stats shared between CPU and Quicklook plugins."""
@@ -87,7 +77,7 @@ class CpuPercent(object):
# TODO: Multisystem...
try:
self.cpu_info['cpu_name'] = open('/proc/cpuinfo', 'r').readlines()[4].split(':')[1].strip()
- except:
+ except (FileNotFoundError, PermissionError, IndexError, KeyError, AttributeError):
self.cpu_info['cpu_name'] = 'CPU'
return self.cpu_info['cpu_name']