Corrected some exception constructs to py3

Should hopefully resolve ticket #326

Some more corrections.

Corrected some print statements for py3.

Convert tabs to spaces.

Fixed tab, messed up indentation. Corrected.