Fix compatability with Python 3

This raises the minimum required Python version to 2.6
Handle Python 3 exceptions