Move catching of KeyboardInterrupt

This necessary for when we use autopep8 via main entry point.