Changed print to python3 function and fixed exception syntax