[issue21669] Custom error messages when print & exec are used as statements

Nick Coghlan report at bugs.python.org
Mon Jun 9 03:32:05 CEST 2014


Nick Coghlan added the comment:

My main aim here is to offer a custom error message that can be looked up
in an internet search (likely ending up at a Stack Overflow answer - which
we could create in advance of the 3.4.x release that includes this change).

That answer can then explain the various reasons this error can come up,
like:
* following a Python 2 tutorial in Python 3
* running a Python 2 script in Python 3
* attempting to install a Python 2 only dependency on Python 3

And possible solutions like:
* if it's your own code, changing the print statements to be compatible
with both Python 2 & 3 by using string formatting and surrounding
parentheses (& print("") for blank lines)
* looking for a Python 3 tutorial instead
* using Python 2 instead of Python 3
* looking for an alternative package that runs on Python 3

It's never going to be possible to fit all that into an error message,
hence why I consider "can be looked up in an internet search more easily
than the generic 'invalid syntax' error message" to be the most important
characteristic of the custom error message. I don't expect the exact
wording to really matter all that much.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21669>
_______________________________________


More information about the Python-bugs-list mailing list