3 ms·
The accidental complexity here is due to Windows, not Python. Python would rather generate an error than give you garbled output without your knowledge.
by mark-r 11y ago
The accidental complexity here is due to Windows, not Python. Python would rather generate an error than give you garbled output without your knowledge.
- vetinari 11y agoMost developers are not aware of that and write code, that just bombs out for the user. The user would prefer at least garbled text instead of exception, because he is used to that anyway in other apps. He has at least some result, instead of stack trace. Well, and that's before the user tries to redirect stdout to file, in which case it will end up with error too, because that is going to be 7-bit ascii. Anyway, Python3 does the right thing with defining the encoding at the edges and everything works right for the user out of the box.