Archive for the 'Python' Category

Mac OS X: decoder jpeg not available

If you are using PIL(Python Imaging Library) on Mac OS X(Tiger), you will probably have a “decoder jpeg not available” when resizing a jpeg image.
This probably means that PIL doesn’t have JPEG support, because libjpeg wasn’t found when PIL was being configured.
Here is the solution:

  • Download, compile and install jpeglib and zlib
  • Edit PIL setup.py and change to:

    JPEG_ROOT = "/usr/local/include"
    ZLIB_ROOT = "/usr/local/include"
    
  • Compile:

    python setup.py build_ext -i
    
  • Test:

    python selftest.py
    
  • If the result is something like this:

    "57 tests passed."
    
  • You are ready to go:

    python setup.py install
    

Python 2.5 is out!

Python

Python 2.5 is the latest major release of Python.
As Guido it promised, wsgiref was added to the Python 2.5 Standard Library. For those who don’t know what wsgi is, read this.
You can find what’s new in Python 2.5 here

Django is the favourite of Guido van Rossum

Django Project

Guido van Rossum said in the latest FLOSS Weekly podcast:

My personal favorite — and I expect that that will remain a personal favorite for a long time — is something named Django. … I highly recommend it.

Django has been my tool for a new project of mine, has been worth it the time spent learning Django and Python(right now my personal favourite programming language).
Django preferred setup is Apache with mod_python, this has make my choice easier because I’ve been always using Apache with PHP.
If you want to give it a try(I recommend it), read the Part 1 of the tutorial.
And if you have doubts about performance, read this.