[issue31140] Insufficient error message with incorrect formated string literal
New submission from chris.259263:
Trying to run a script with a bug in a formated string literal (in the example
the ":" is missing) throws an "invalid syntax" error at the first expression of
the script.
Example:
import math
a = "a"
b = f"{a>2s}" # forgotten ":", should be f"{a:>2s}"
Running this script throws an "invalid syntax" error in the first line "import
math".
In a large program this behavior makes it nearly impossible to find the real
bug in the program as the error message does not give any hint about the line
or the type of the error in the program.
Using Python 3.6.2, IDLE 3.6.2 on Mac macOS Sierra (10.12.1)
--
messages: 299901
nosy: chris.259263
priority: normal
severity: normal
status: open
title: Insufficient error message with incorrect formated string literal
type: behavior
versions: Python 3.6
___
Python tracker
<http://bugs.python.org/issue31140>
___
___
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31140] Insufficient error message with incorrect formated string literal
chris.259263 added the comment: Hi Eric, running the script from the terminal on my system (macOS, Python 3.6.2) gives the same ErrorMessage as you stated. The problem is the output "line 1". Running the script from IDLE (3.6.2), the error points to the first line. And in IDLE you do not get the useful hint "(a>2s)" but just "SyntaxError: invalid syntax". -- ___ Python tracker <http://bugs.python.org/issue31140> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
