title: unsubscriptable object
body: <p>I'm using PIL </p>
  
  <pre><code>    im = Image.open(teh_file)
      if im:
          colors = im.resize( (1,1), Image.ANTIALIAS).getpixel((0,0)) # simple way to get average color
          red = colors[0] # and so on, some operations on color data
  </code></pre>
  
  <p>The problem is, on a few (very few, particulary don't know why those exactly, simple jpegs) I get 'unsubscriptable object' on line "colors[0]". Tried:</p>
  
  <pre><code>if colors: 
  </code></pre>
  
  <p>gets true and goes on. </p>
  
  <pre><code>if len(colors):
  </code></pre>
  
  <p>gives 'len() of unsized object'</p>
  
  <ol>
  <li>What condition should I apply not to get this exception?</li>
  <li>What's the cause of the problem?</li>
  </ol>