Python3 compatibility in __main__

I tend to use this and got frustrated when it stopped working in
python3. Fixed urllib and print issues to be 2to3 compliant.