archey icon indicating copy to clipboard operation
archey copied to clipboard

Encountered a bug

Open ManuelSchneid3r opened this issue 9 years ago • 6 comments

Traceback (most recent call last):
  File "/usr/bin/archey", line 261, in <module>
    out.append(classes[x]())
  File "/usr/bin/archey", line 215, in __init__
    used = int(ram[2]) - int(ram[5]) - int(ram[6])
IndexError: list index out of range

Used the version currently available in the AUR.

ManuelSchneid3r avatar Mar 21 '15 12:03 ManuelSchneid3r

If you like I can help you fix that. Reply with the output to: free -m

ghost avatar Mar 24 '15 05:03 ghost

free -m
               gesamt       benutzt     frei      gemns.  Puffer/Cache verfügbar
Speicher:        6904        1827        1324         543        3752        4243
Swap:             0           0           0

ManuelSchneid3r avatar Mar 24 '15 18:03 ManuelSchneid3r

\o/ yay! non English! lol I know Frei means free. Can you translate the other columns, please?

ghost avatar Mar 24 '15 19:03 ghost

free -m
              overall       used     free      shared.  Buffer/Cache available
mamory:        6904        1827        1324         543        3752        4243
Swap:             0           0           0

ManuelSchneid3r avatar Mar 24 '15 20:03 ManuelSchneid3r

thanks: sudo nano /usr/bin/archey

at or near line 215:

find: used = int(ram[2]) - int(ram[5]) - int(ram[6])

place a # in front of the word "used"

#used = int(ram[2]) - int(ram[5]) - int(ram[6])

This will comment the line and preserve it for later if you need to revert.

Under that line add: used = int(ram[2]) + int(ram[4])

It should look like: #used = int(ram[2]) - int(ram[5]) - int(ram[6]) used = int(ram[2]) + int(ram[4])

ctrl+x to save and hit enter without changing the name of the file.

It should be fixed.

ghost avatar Mar 24 '15 20:03 ghost

wouldn't it be easier to parse /proc/meminfo?

"Here's one I prepared earlier." :

  out = cat("/proc/meminfo").splitlines()
  for line in range(0, len(out)-1):
    mem = out[line].split()
    if mem[0] == 'MemFree:':
      outMemFree = int(mem[1])
    elif mem[0] == 'MemTotal:':
      outMemTotal = int(mem[1])
    elif mem[0] == 'Buffers:':
      outMemBuf = int(mem[1])
    elif mem[0] == 'Cached:':
      outMemCache = int(mem[1])
    elif mem[0] == 'SwapTotal:':
      outMemSwapTotal = int(mem[1])
    elif mem[0] == "SwapFree:":
      outMemSwapFree = int(mem[1])

  outMemUsed = outMemTotal - (outMemFree + outMemBuf + outMemCache)
  outMemSwapUsed = outMemSwapTotal - outMemSwapFree

Mausy5043 avatar Apr 30 '16 08:04 Mausy5043