From 31c0c239f9bc163b968f9d7f19c3b59cd6aa368d Mon Sep 17 00:00:00 2001 From: SanderJo Date: Wed, 5 Apr 2017 17:11:50 +0200 Subject: [PATCH] getformance.getcpu(): if no cpu info, fallback to platform.platform() --- sabnzbd/utils/getperformance.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sabnzbd/utils/getperformance.py b/sabnzbd/utils/getperformance.py index 05f0319..1dad2db 100644 --- a/sabnzbd/utils/getperformance.py +++ b/sabnzbd/utils/getperformance.py @@ -3,8 +3,7 @@ import platform, subprocess def getcpu(): # find the CPU name (which needs a different method per OS), and return it - # return None if none found - # works on Linux, MacOS (aka OSX), Windows + # If none found, return platform.platform(). cputype = None @@ -25,15 +24,17 @@ def getcpu(): # model name : Intel(R) Xeon(R) CPU E5335 @ 2.00GHz cputype = myline.split(":", 1)[1] # get everything after the first ":" break # we're done - except: # An exception, maybe due to a subprocess call gone wrong - cputype = "Unknown" pass if cputype: - # remove unnneeded space: + # OK, found. Remove unnneeded spaces: cputype = " ".join(cputype.split()) + else: + # Not found, so let's fall back to platform() + cputype = platform.platform() + return cputype