Thanks Duncan. I guess you and Peter have been typing in the same minute :) It really looks like a good solution, I wasn't aware this with statement in Python. I can imagine the context handler coming handy in other cases too.
Devrim -- http://mail.python.org/mailman/listinfo/python-list