title: How to fix ValueError: not enough values to unpack (expected 2, got 1) in python?
body: <p>I want to monitor my docker container ram use. Now I found a script online that generates a txt file with the stats like so:</p>
  
  <pre><code>LOG_FILE="/volume1/docker/docker-logs.txt"
  
  while true;
  do
      sleep 10m
      docker stats --format "{{.Name}}, {{.MemUsage}}" --no-stream &gt;&gt; $LOG_FILE
      #echo "-" &gt;&gt; $LOG_FILE
  done
  </code></pre>
  
  <p>Have it running at boot with my Synology NAS. Works fine I get this file:</p>
  
  <pre><code>-
  Python3, 46.42MiB / 150MiB
  hassio, 160.8MiB / 3.855GiB
  Jacket, 255.4MiB / 3.855GiB
  Radarrnodebug, 96.87MiB / 3.855GiB
  Sonarrnodebug, 112.8MiB / 3.855GiB
  Ombii, 212.2MiB / 3.855GiB
  watchtower, 11.48MiB / 50MiB
  -
  Python3, 46.42MiB / 150MiB
  hassio, 68.34MiB / 3.855GiB
  Jacket, 258.3MiB / 3.855GiB
  Radarrnodebug, 101.8MiB / 3.855GiB
  Sonarrnodebug, 114.8MiB / 3.855GiB
  Ombii, 212.4MiB / 3.855GiB
  watchtower, 11.48MiB / 50MiB
  -
  Python3, 46.42MiB / 150MiB
  hassio, 71.06MiB / 3.855GiB
  Jacket, 262.7MiB / 3.855GiB
  Radarrnodebug, 102.2MiB / 3.855GiB
  Sonarrnodebug, 124.1MiB / 3.855GiB
  Ombii, 217.7MiB / 3.855GiB
  watchtower, 11.48MiB / 50MiB
  -
  Python3, 46.42MiB / 150MiB
  hassio, 81.38MiB / 3.855GiB
  Jacket, 262.7MiB / 3.855GiB
  Radarrnodebug, 102.5MiB / 3.855GiB
  Sonarrnodebug, 125.1MiB / 3.855GiB
  Ombii, 217.6MiB / 3.855GiB
  watchtower, 11.48MiB / 50MiB
  -
  Python3, 46.42MiB / 150MiB
  hassio, 76.55MiB / 3.855GiB
  Jacket, 269.2MiB / 3.855GiB
  Radarrnodebug, 103.3MiB / 3.855GiB
  Sonarrnodebug, 123.8MiB / 3.855GiB
  Ombii, 219MiB / 3.855GiB
  watchtower, 11.48MiB / 50MiB
  -
  Python3, 46.42MiB / 150MiB
  hassio, 77.52MiB / 3.855GiB
  Jacket, 268.4MiB / 3.855GiB
  Radarrnodebug, 106.2MiB / 3.855GiB
  Sonarrnodebug, 117.8MiB / 3.855GiB
  Ombii, 213.1MiB / 3.855GiB
  watchtower, 11.48MiB / 50MiB
  -
  </code></pre>
  
  <p>Now to make it as a nice PNG I have the following:</p>
  
  <pre><code>from pip._internal import main
  main(["install", "matplotlib", "numpy","pandas"])
  
  import matplotlib.pyplot as plt
  import numpy as np
  import pandas as pd
  
  log_path = "/stats/docker-logs.txt"
  
  with open(log_path) as f:
      raw_data = f.readlines()
  nrows = 8
  n = len(raw_data) // nrows
  data = []
  for i in range(n):
      start = i * nrows
      end = start + nrows - 1
      d = raw_data[start:end]
      datum = {}
      datum['i'] = i
      for line in d:
          name, stats = line.strip().split(',')
          stats = float(stats.split('/')[0].strip()[:-3])
          datum[name] = stats
      data.append(datum)
  
  data = pd.DataFrame(data)
  data['time (hour)'] = data['i'] * 10 / 60
  ax = data.drop(columns='i').set_index('time (hour)').plot()
  ax.set_ylabel('RAM Usage (MiB)')
  ax.figure.savefig('/stats/plot.png')
  </code></pre>
  
  <p>Which worked fine in the beginnen but out of the blue it stopped working and I got the following error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/stats/genstat.py", line 22, in &lt;module&gt;
      name, stats = line.strip().split(',')
  ValueError: not enough values to unpack (expected 2, got 1)
  </code></pre>
  
  <p>Did some debugging and found out that</p>
  
  <pre><code>var i
  </code></pre>
  
  <p>became 0 so nothing worked anymore (since it has to skip the "-" char) what happened and how do i fixed it? I tried a lot already by removing the "-" char, chaning the nrows but nothing really matters (to meeeee)</p>
  
  <p>Hope some can help</p>