Python3 compat

This is an attempt at Python 3 compatibility.  It addresses uses of the print function and decoding opened files.  I could not test it (as we discussed).