Fixed generate.py for python 2.6

I know, right?