title: ValueError: too many values to unpack in python
body: <p>I am running the follow script and I get the error:</p>
  
  <pre><code>Traceback (most recent call last): 
  File "C:/Users/me/PycharmProjects/MySmplePythonApplication/src/Test2.py", line 22, in &lt;module&gt; print smooth(array) 
  File "C:/Users/me/PycharmProjects/MySmplePythonApplication/src/Test2.py", line 10, in smooth dx, dy= array.shape 
  ValueError: too many values to unpack
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>import math
  import numpy as np
  from PIL import Image
  
  array = np.array(Image.open('noisy.tif'))
  
  #Apply a 3x3 mean filter to my image array.
  
  def smooth(array, window=3.0):
      dx, dy = array.shape
      new_array = np.copy(array)
      edgex = int(math.floor(window / 2.0))
      edgey = int(math.floor(window / 2.0))
  
      for i in range(dx):
          for j in range(dy):
              window_array = array[max(i - edgex, 0):min(i + edgex + 1, dx),
                                   max(j - edgey, 0):min(j + edgey + 1, dy)]
              new_array[i, j] = window_array.mean()
      return new_array
  
  print smooth(array)
  </code></pre>
  
  <p>I know that there are too many topics about that but still could not fix it.</p>