[New-bugs-announce] [issue42578] Add tip when encountering UnicodeDecode/Encode Error in open()

wyz23x2 report at bugs.python.org
Sat Dec 5 10:22:35 EST 2020

New submission from wyz23x2 <wyz23x2 at 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:
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 <report at bugs.python.org>

More information about the New-bugs-announce mailing list