python catch exception and print