To Python 3

And some error handling.