On 2019-01-05, Stefan Ram <r...@zedat.fu-berlin.de> wrote: > r...@zedat.fu-berlin.de (Stefan Ram) writes: >> print( chr( 0x231E )) # Unicode Character 'BOTTOM LEFT CORNER' (U+231E) >> File "~~~\Python\Python37\lib\encodings\cp1252.py", line 19, in encode > > I also have: > > print(chr) ><built-in function chr> > > . Don't see how the call gets to cp1252.py. I see: > > bltinmodule.c.h > > #define BUILTIN_CHR_METHODDEF \ > {"chr", (PyCFunction)builtin_chr, METH_O, builtin_chr__doc__},
It isn't chr() that's throwing the exception, it's print(). chr(0x231e) is returning a unicode string, print() is trying to display that string on stdout, and apparently on your machine Python thinks stdout is encoded as cp1252. -- https://mail.python.org/mailman/listinfo/python-list