archey icon indicating copy to clipboard operation
archey copied to clipboard

Error on Ubuntu 12.04

Open deshack opened this issue 12 years ago • 4 comments

Package version: 0.2.8 Operating System: Ubuntu 12.04 LTS Python version: 2.7.3 Error message (when launching "archey" command):

Traceback (most recent call last): File "/usr/bin/archey", line 304, in func() File "/usr/bin/archey", line 288, in disk_display usedpercent = float(re.sub("[A-Z]", "", used)) / float(re.sub("[A-Z]", "", size)) * 100 ValueError: invalid literal for float(): 4,9

deshack avatar Sep 24 '12 07:09 deshack

With python 3.2.3 the error is still present, but last line is different:

ValueError: inalid literal for float(): 5,0

deshack avatar Sep 24 '12 08:09 deshack

It's the comma. I put a print statement on the line before this one and ran it on a machine where the error appeared, it gave me this: used: 2,3T -- size: 3,6T The commas are tripping it up. Python expects dots, not commas in floats.

I changed the two preceding lines to:

 used = re.sub(",",".",total.split()[3])
 size = re.sub(",",".",total.split()[2])

And voila! Problem fixed.

jherazob avatar Feb 27 '13 13:02 jherazob

Quick fix:

used = used.replace(',','.')

narrowfail avatar Apr 06 '13 16:04 narrowfail

@jherazob your tip works for me, thanks!

xnosx avatar Apr 30 '17 10:04 xnosx