piface / pifacecad

PiFace Control and Display
GNU General Public License v3.0
46 stars 38 forks source link

sysinfo.py broken in Stretch #27

Closed Trotter73 closed 5 years ago

Trotter73 commented 6 years ago

Hi,

The example sysinfo.py is broken on stretch, it looks like the format of the command "free" has changed and this is breaking the script.

This is thrown back at me.

Traceback (most recent call last): File "/usr/share/doc/python3-pifacecad/examples/sysinfo.py", line 75, in show_sysinfo() File "/usr/share/doc/python3-pifacecad/examples/sysinfo.py", line 56, in show_sysinfo cad.lcd.write(":{}".format(get_my_free_mem())) File "/usr/share/doc/python3-pifacecad/examples/sysinfo.py", line 35, in get_my_free_mem used_mem = float(run_cmd(USED_MEM_CMD)) ValueError: could not convert string to float:

Regards,

gbmorrison commented 6 years ago

Hi,

I have fixed in this way - replaced the string after grep with 'Mem'. The grep command was not finding the right line in the output of free for awk to select from.

USED_MEM_CMD = "free | grep 'Mem' | awk '{print $3}'"

regards,

tompreston commented 5 years ago

Maybe we should use a more consistent interface such as /proc/meminfo which is what free uses.