STINNER Victor <vstin...@redhat.com> added the comment:

The traceback comes from Python 3.5. Python 3.7 now uses UTF-8 when the 
LC_CTYPE locale is "C" or "POSIX", thanks to C locale coercion (PEP 538) and 
UTF-8 Mode (PEP 540):
https://vstinner.github.io/posix-locale.html
https://vstinner.github.io/python37-new-utf8-mode.html

Can you please retry your test using Python 3.7?

I would prefer to not start to use errors="surrogateescape" everywhere, 
especially if the issue is already fixed.

errors="surrogateescape" basically means: "I want to produce a file that other 
people will unable to read...

---

def write_file (filename, contents):
    """Create a file with the specified name and write 'contents' (a
    sequence of strings without line terminators) to it.
    """
    f = open(filename, "w")
    ...

For me, the first obvious bug is that the encoding is not specified. I don't 
see how an application on a different computer is supposed to read a text file 
if the encoding is not well defined...

----------
nosy: +vstinner

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36998>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to