Martin Panter added the comment: Python 3 will only use UTF-8 encoding if you ask it to, or if the default locale encoding happens to be UTF-8. I suspect one of the file names in the “hay” list must contain a Unicode hyphen (U+2010), and your default encoding is some single byte encoding that cannot encode the hyphen. If you definitely want to write a UTF-8 file, use the open(encoding="utf-8") parameter.
---------- nosy: +vadmium _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23543> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com