Some syntax updates

Use newer, Python3-compatible syntax for exceptions and printing.