New submission from wyz23x2 <wyz2...@163.com>:

Programmers often stumble over UnicodeDecode/EncodeError during open(), and 
especially beginners don't know what to do.
There are lots of questions on Stackoverflow:
https://stackoverflow.com/questions/16528468/while-reading-file-on-python-i-got-a-unicodedecodeerror-what-can-i-do-to-resol
https://stackoverflow.com/questions/38186847/python-line-replace-returns-unicodeencodeerror
https://stackoverflow.com/questions/3224268/python-unicode-encode-error
https://stackoverflow.com/questions/50331257/python3-unicodeencodingerror
https://stackoverflow.com/questions/24717808/python-cant-write-to-file-unicodeencodeerror
......
Maybe a helpful tip can be added to the error message.
We have done this before:
>>> (1,)(2, 3)                                                                  
>>>                                               <stdin>:1: SyntaxWarning: 
>>> 'tuple' object is not callable; perhaps you missed a comma?
>>> print 3                                                                     
>>>                                                 
  File "<stdin>", line 1                                                        
                                                  
    print 3                                                                     
                                                        
          ^                                                                     
                                              SyntaxError: Missing parentheses 
in call to 'print'. Did you mean print(3)?

----------
components: IO
messages: 382567
nosy: wyz23x2
priority: normal
severity: normal
status: open
title: Add tip when encountering UnicodeDecode/Encode Error in open()
versions: Python 3.10, Python 3.9

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

Reply via email to