co2mon icon indicating copy to clipboard operation
co2mon copied to clipboard

error message humanization

Open 532910 opened this issue 5 years ago • 2 comments

If co2mond has never beed runned and CntR/Tamb are absent it gives could not convert string to float instead of clean error message:

% cat /etc/collectd/collectd.conf.d/co2mon.conf 
LoadPlugin python
<Plugin python>
	ModulePath "/home/sergio/co2mon/graph/collectd"
	LogTraces true
	Interactive false
	Import "co2mon"
</Plugin>
collectd: Unhandled python exception in read callback: ValueError: could not convert string to float: 
collectd: Traceback (most recent call last):
collectd:   File "/home/sergio/co2mon/graph/collectd/co2mon.py", line 26, in read_callback#012    co2 = [read_metric('CntR')]
collectd:   File "/home/sergio/co2mon/graph/collectd/co2mon.py", line 12, in read_metric#012    return float(v)
collectd: ValueError: could not convert string to float: 
collectd: read-function of plugin `python.co2mon' failed. Will suspend it for 40.000 seconds.
collectd: Unhandled python exception in read callback: ValueError: could not convert string to float: 
collectd: Traceback (most recent call last):
collectd:   File "/home/sergio/co2mon/graph/collectd/co2mon.py", line 26, in read_callback#012    co2 = [read_metric('CntR')]
collectd:   File "/home/sergio/co2mon/graph/collectd/co2mon.py", line 12, in read_metric#012    return float(v)
collectd: ValueError: could not convert string to float: 
collectd: read-function of plugin `python.co2mon' failed. Will suspend it for 80.000 seconds.

532910 avatar Aug 14 '19 12:08 532910

Hi

With this config co2mon.py should try to read values from /var/lib/co2mon/CntR and /var/lib/co2mon/Tamb. That is the default location where co2mond stores current readings. What do you have in this files? Pls show head /var/lib/co2mon/*

Self-Perfection avatar Aug 16 '19 20:08 Self-Perfection

Sory for late response. co2mond has never been runned. Issue updated.

532910 avatar Sep 05 '19 17:09 532910