resove UnboundLocalError within Python3

resove UnboundLocalError within Python3