Exception handling in get_stat.py