Where is the error?
Michael Agbenike
agbenikemichael at gmail.com
Sun Aug 6 16:59:09 EDT 2023
When i try to open a python script it either says theres no ctk module or
no pip
On Sun, Aug 6, 2023, 3:51 PM Peter J. Holzer via Python-list <
python-list at python.org> wrote:
> Mostly, error messages got a lot better in Python 3.10, but this one had
> me scratching my head for a few minutes.
>
> Consider this useless and faulty script:
>
> ------------------------------------------------------------------------
> r = {
> "x": (1 + 2 + 3)
> "y": (4 + 5 + 6)
> "z": (7 + 8 + 9)
> }
> ------------------------------------------------------------------------
>
> Python 3.9 (and earlier) reports:
>
> ------------------------------------------------------------------------
> File "/home/hjp/tmp/foo", line 3
> "y": (4 + 5 + 6)
> ^
> SyntaxError: invalid syntax
> ------------------------------------------------------------------------
>
> This isn't great, but experience with lots of programming languages
> tells me that an error is noticed where or after it actually occurs, so
> it's easy to see that there is a comma missing just before the "y".
>
> Python 3.10 and 3.11 report:
>
> ------------------------------------------------------------------------
> File "/home/hjp/tmp/foo", line 2
> "x": (1 + 2 + 3)
> ^^^^^^^^^^
> SyntaxError: invalid syntax. Perhaps you forgot a comma?
> ------------------------------------------------------------------------
>
> The error message is now a lot better, of course, but the fact that it
> points at the expression *before* the error completely threw me. The
> underlined expression is clearly not missing a comma, nor is there an
> error before that. My real program was a bit longer of course, so I
> checked the lines before that to see if I forgot to close any
> parentheses. Took me some time to notice the missing comma *after* the
> underlined expression.
>
> Is this "clairvoyant" behaviour a side-effect of the new parser or was
> that a deliberate decision?
>
> hp
>
> --
> _ | Peter J. Holzer | Story must make more sense than reality.
> |_|_) | |
> | | | hjp at hjp.at | -- Charles Stross, "Creative writing
> __/ | http://www.hjp.at/ | challenge!"
> --
> https://mail.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list