Make t.py work with python3

o encode string to utf-8
o print is now a function
o Fix exception syntax Exception, e -> Exception as e