Added compatibility with python 2.4

Hi, 

I'm the Vincent that contacted you by mail this WE.

I've been forking your latest code and cleaning my mods. The 'with' statement replacement was made as in PEP 343. The rest is straightforward.

Have a nice day !

Vincent.