Cannot use with statement due to python 2.4