Error on Ubuntu 12.04 #7

deshack opened this Issue Sep 24, 2012 · 3 comments

3 participants


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
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


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

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


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.


Quick fix:

used = used.replace(',','.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment