Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPUTemp format None #77

Open
danielemarmiroli opened this issue Dec 5, 2017 · 2 comments
Open

CPUTemp format None #77

danielemarmiroli opened this issue Dec 5, 2017 · 2 comments

Comments

@danielemarmiroli
Copy link

danielemarmiroli commented Dec 5, 2017

Hi!

When the output of _fetch_VARIABLENAME() is None , there's no __format__ and you get

errors like non-empty format string passed to object.__format__

E.g. in may case, in class CPUTemp, fomat(self._fetch_cputemp()) (in sensors.py ln 581) generates

a runtime error of that kind.

I changed the line above to return "{!s:2s}\u00B0C".format(self._fetch_cputemp())

to force formatting the output of _fetch_cputemp to a str obj. Not very pretty but works as a quick fix.

I don't even know if this is the best way to do it! ahahah

About why I get None, this is a mystery. When I first apt installed it, it was reading the cputemp,

after reboot it doesn't anymore. I have a dual Xeon W5580. On my laptop it works perfectly.

Any advice is strongly welcome! Tnx!

Dan

@fossfreedom
Copy link
Owner

def _fetch_cputemp(self): - line 583 in sensors.py

It is trying to find the temperature via /sys/class/thermal/thermal_zone0/temp

and as a fallback via /sys/class/hwmon/

So the former should be defined by the linux kernel - it would be interesting to navigate to /sys/class/thermal ... and see if the temperature is defined in a slightly different file name/folder-name

Yeah - the function should not return a None - it will only do so when both fallbacks fail. So the final ret statement should check if None and instead return a zero number

@danielemarmiroli
Copy link
Author

Hi, under /sys/class/thermal/ I find 17 subdirs named cooling_deviceN with N=0,1,..16

The tree is the same for each of them

dan@Odin:cooling_device12$ ls
cur_state device max_state power subsystem type uevent

I've looked everywhere but I don't find temp ..they're mostly empty files or empty dirs ...

lm-sensors works fine, do you know how to locate where it reads from?

Thank you for your help!

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants