title: 'Unknown extension' in save function of PIL due to empty EXTENSION array
body: <p>I am rather new to python and have a problem with the <code>save</code> function of the Pillow fork of PIL.</p>
  
  <p>With this minimal example</p>
  
  <pre><code>import Image
  
  im = Image.new("RGB", (200, 30), "#ddd")
  im.save("image.png")
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>File "/usr/lib64/python2.7/site-packages/PIL/Image.py", line 1667, in save
    raise KeyError(ext)  # unknown extension
  KeyError: '.png'
  </code></pre>
  
  <p>The corresponding lines in the <code>save</code> function are</p>
  
  <pre><code>preinit()
  
  [...]
  
  try:
    format = EXTENSION[ext]
  except KeyError:
    raise KeyError(ext)  # unknown extension
  </code></pre>
  
  <p>I looked at the <code>EXTENSION</code> array and detected that it is empty, although it should be initialized in <code>preinit()</code> by for example <code>from PIL import PngImagePlugin</code>. <code>PngImagePlugin.py</code> calls <code>Image.register_extension("PNG", ".png")</code>. Watching the array inside this function or inside <code>PngImagePlugin</code> it is indeed filled with file extensions.</p>
  
  <p>Putting <code>print(EXTENSION)</code> right before the try-except-block however shows an empty <code>EXTENSION</code> array.</p>
  
  <p>(Same issue with the <code>SAVE</code> array a few lines down in the <code>save</code> function.)</p>
  
  <p>Any help is appreciated.</p>
  
  <p>EDIT: I recently upgraded from OpenSuse 13.1. to 13.2. It worked fine in 13.1 but not in 13.2.</p>