sb-ai-lab / Eco2AI

eco2AI is a python library which accumulates statistics about power consumption and CO2 emission during running code.
Apache License 2.0
226 stars 18 forks source link

Cast error when converting string to float in get_cpu_percent_linux. #6

Closed luciabouzaheguerte closed 1 year ago

luciabouzaheguerte commented 1 year ago

Hi, i got this error when running the tool (version 0.3.5):

image

when running top command, it shows me the values with commas:

image

Desktop

image

To fix it, i changed line 533 of eco2ai/tools/tools_cpu.py:

from: sum_cpu += float(words[8]) to: sum_cpu += float(words[8].replace(",","."))

Can you add this to the repo? thanks! Lucía

alexnkorovin commented 1 year ago

Thank you for your comment. Your fix has been implemented. You can get the update of eco2AI from PyPi