Found the fix
and it works.
I notice the indentation is screwed up
-- I put the encoding = 'utf-8' line in line with the try and except preceding it.
This seems to have something to do with the Windows default encoding for stdout not being UTF-8.
encoding = "ascii"
if sys.platform == 'win32':
# On Windows, we could use "mbcs". However, to give the user
# a portable encoding name, we need to find the code page
encoding = locale.getdefaultlocale()
encoding = 'utf-8'