Andre Roberge added the comment:
> (Anyone really want log of error?)
If by this you mean having access to the error from a known place (like
sys.last_traceback or something else specific to IDLE but available from a
script), then the answer from me is definitely yes.
--
n
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue46902>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue46838>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue46652>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue46637>
___
___
Python-bugs-list mailing list
Unsubscribe:
Andre Roberge added the comment:
As far as I am concerned, this issue can be closed. I have found a workaround
which allows me to reproduce and analyze the SyntaxError that are not captured
by custom exception hook.
--
___
Python tracker
<ht
Andre Roberge added the comment:
> This also affects 3.9 I imagine, no?
Yes. And, from what I can tell, the same incorrect line is indicated at least
all the way back to Python 3.6 (where it was "invalid token" instead of
"invalid decimal literal).
Andre Roberge added the comment:
>> For this advice (catching Exception and not BaseException) to be correct,
>> users should be advised (as they are in the tutorial) to raise exceptions
>> derived from Exception (and not BaseException).
> I disagree with that.
You are
Andre Roberge added the comment:
Irit:
In all the books and tutorials I have seen, the advice is to try to catch
specific exceptions whenever possible or, *at most*, to catch Exception (and
not BaseException). This is to allow, for example, a program to be interrupted
by a
Andre Roberge added the comment:
Irit:
Gregor indicates that, while the tutorial refers to "a class that derives from
Exception", the Python Reference Language states exceptions should be
subclasses of BaseException (which Exception *is*).
You then invited Gregor to submit
Andre Roberge added the comment:
In https://docs.python.org/3/library/exceptions.html#Exception, it is written:
"All built-in, non-system-exiting exceptions are derived from this class. All
user-defined exceptions should also be derived from this class."
Yes, technically, the r
New submission from Andre Roberge :
Given the following code containing an unclosed parenthesis:
a = (1, 2
b = 3
Here is the resulting SyntaxError:
> python ignore.py
File "C:\...\ignore.py", line 1
a = (1, 2
^
SyntaxError: invalid syntax. Perhaps you forgot a
Andre Roberge added the comment:
The last of these three cases (with FRACTION SLASH) is fixed 3.10.1.
The other two are still present in 3.10.1 and in 3.11.0a3
--
versions: +Python 3.11
___
Python tracker
<https://bugs.python.org/issue44
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue46042>
___
___
Python-bugs-list mailing list
Unsubscribe:
Andre Roberge added the comment:
>From
>(https://friendly-traceback.github.io/docs/syntax_tracebacks_en_3.10.html#for-loop-missing-in-operator),
> this is what was shown for Python 3.10.0
for x range(4):
^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
New submission from Andre Roberge :
In Python 3.10.1, a change occurred compared with 3.10.0 so that an incorrect
token is flagged for a SyntaxError. Also, in 3.11.0a2, the suggestion made
about having forgotten a comma is incorrect.
Python 3.10.1
for x range(4
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue44166>
___
___
Python-bugs-list mailing list
Unsubscribe:
Andre Roberge added the comment:
I am sorry, but I am not set up to work from the main branch and must rely on
official releases. In the future, for alpha and beta releases, I will try to
wait for the next release, see immediately if I can reproduce bugs that I had
noted before, and submit
New submission from Andre Roberge :
In the following, I execute a single invalid statement in the Python
interpreter, which gives the correct error message. Afterwards, I repeat this
example using code.interact(), generating a different traceback. This issue
affects IDLE differently as shown
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue45811>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue45807>
___
___
Python-bugs-list mailing list
Unsubscribe:
Andre Roberge added the comment:
I understand.
I reported this issue when one of my newest tests failed with Python 3.10 and
3.11. Actually, using friendly-traceback, using the location of the exception
as indicated by cPython 3.10 and 3.11, here's part of the explanation it gives:
New submission from Andre Roberge :
Python 3.10 and 3.11:
>>> sum[i for i in [1, 2, 3] if i%2==0]
File "", line 1
sum[i for i in [1, 2, 3] if i%2==0]
^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
Furthermore
Andre Roberge added the comment:
What version are you using? As far as I can test, it has become a syntax error
since 3.10. Here is the result with the latest 3.11 alpha
> python
Python 3.11.0a2 (tags/v3.11.0a2:e2b4e4b, Nov 5 2021, 20:00:05) [MSC v.1929 64
bit (AMD64)] on win32
Type &q
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue45738>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue45759>
___
___
Python-bugs-list mailing list
Unsubscribe:
Andre Roberge added the comment:
I think that "trying to run a shell command" might not be easy to understand by
a beginner.
If the special case of r"python\s+" is added, perhaps r"pip\s+" should be
considered as well since many sites on the Internet suggest t
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue45716>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue45607>
___
___
Python-bugs-list mailing list
Unsubscribe:
Andre Roberge added the comment:
If this can be implemented, then I believe that
https://bugs.python.org/issue43476 could be closed as well.
--
___
Python tracker
<https://bugs.python.org/issue45
New submission from Andre Roberge :
As stated in the documentation, sys.last_type, sys.last_value and
sys.last_traceback ... are set when an exception is not handled and the
interpreter prints an error message and a stack traceback.
This is true whether the exception is a SyntaxError or some
Andre Roberge added the comment:
+1 on adding better error messages for these cases. I also agree with having
different explanations with lambda and def.
Below is what I have with friendly-traceback: perhaps the first line of both of
these might be suitable? (I will likely change the
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue45450>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue24612>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Andre Roberge :
Consider the following:
Python 3.10.0rc1 ...
>>> __debug__
True
>>> del __debug__
Traceback (most recent call last):
File "", line 1, in
NameError: name '__debug__' is not defined
>>> __debug__
True
>
Andre Roberge added the comment:
Based on what I just read on
https://github.com/davidhalter/parso/blob/master/parso/python/issue_list.txt
I gather that this exception is only raised in the context of an import
statement with a trailing comma (usually followed by nothing
Andre Roberge added the comment:
This message is not new to Python 3.10 as it is also shown with Python 3.9.5.
>>> from math import sin, cos, and tan
File "", line 1
from math import sin, cos, and tan
^
SyntaxError: trailing comma
New submission from Andre Roberge :
Consider the following four slightly different examples:
Python 3.10.0rc1 ...
>>> from math import sin and cos
File "", line 1
from math import sin and cos
^^^
SyntaxError: invalid syntax
>>> fr
Andre Roberge added the comment:
Python 3.10.0rc1 ...
>>> print hello world!
File "", line 1
print hello world!
^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
The hint given is not exactly helpful ...
(This example was in a discussio
Andre Roberge added the comment:
I have no idea how the parser works ... but when you do the test to identify if
an 'else' is missing, could the fact that there is a colon instead of the
expected 'else' be used to avoid misidentifying this case?
Note: I am keenly aware
New submission from Andre Roberge :
Given the following code containing no if expression (only if statements):
if True:
print('hello'
if 2:
print(123))
The following traceback is generated in Python 3.10.0RC1
File "...\example.py", lin
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue44792>
___
___
Python-bugs-list mailing list
Unsubscribe:
Andre Roberge added the comment:
Third case. Showing only the output for Python 3.10
>>> a = 3 ⁄ 7 # entered with a space around ⁄
File "", line 1
a = 3 ⁄ 7
^
SyntaxError: invalid character '⁄' (U+2044)
>>> a = 3⁄7# no add
Andre Roberge added the comment:
Here's another related case.
Python 3.9:
>>> a = 1½
File "", line 1
a = 1½
^
SyntaxError: invalid character '½' (U+00BD)
Python 3.10
>>> a = 1½
File "", line 1
New submission from Andre Roberge :
Consider the following:
>>> a = (1‚ 2) # not a comma, but unicode character.
Using Python 3.9 (and earlier), we get the following correct information
>>> a = (1‚ 2)
File "", line 1
a = (1‚ 2)
^
SyntaxError: i
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue44648>
___
___
Python-bugs-list mailing list
Unsubscribe:
Andre Roberge added the comment:
@pablo: Sincere apologies ... I tested this with the wrong virtual environment
active locally. With 3.10, it is indeed SyntaxError: too many nested
parentheses
--
___
Python tracker
<https://bugs.python.
Andre Roberge added the comment:
For information: I created an actual .py file from the last example with 200
parens and got the following error message:
> python example.py
s_push: parser stack overflow
MemoryError
For consistency and greater clarity, I think that having messages such
Andre Roberge added the comment:
While I filed the original report, I am in agreement that accurate information
for debugging tools is definitely more important than the quick summary shown
in the traceback, and that the change likely represents an improvement in
situations more realistic
New submission from Andre Roberge :
Consider the following program
# example.py
one = 1
two = "two"
a = [one
.
two]
Running this program with Python versions before 3.10, yields the following
traceback:
Traceback (most recent call last):
File "C:\Users\andre\exam
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue43950>
___
___
Python-bugs-list mailing list
Unsubscribe:
Andre Roberge added the comment:
I made an error in my previous comment: the code I wrote is obviously incorrect
as it contains a SyntaxError.
--
___
Python tracker
<https://bugs.python.org/issue43
Andre Roberge added the comment:
I can confirm that, if the existing line
type, value, tb = sys.exc_info()
in pyshell.ModifiedInterpreter.showsyntaxerror is replaced by
e_type, value, tb = sys.exc_info()
err = str((type(e_type).__name__, *value)+'\n'
linecache.cache[""]
Andre Roberge added the comment:
Unless I am mistaken, when compiling the code, both SyntaxError and
OverflowError instances are caught at the same stage, and likely passed on to
showsyntaxerror. For OverflowError, e.args is not normally a tuple but a
string, and *e.args[1] would raise an
Andre Roberge added the comment:
Having a fake file with a single line containing all the exception information
as described would definitely provide all the required information needed. It
would be much better than what I had suggested previously
Andre Roberge added the comment:
I just thought of making a copy of the file content under a known name as the
least disruptive approach for IDLE's code - even less so than the recent
addition required to support user-defined exception hooks.
For SyntaxErrors and subclasses [1], Fri
Andre Roberge added the comment:
Would it be possible to add a single line of code to idlelib's pyshell.py, as
indicated below:
def showsyntaxerror(self, filename=None):
"""... """
linecache.cache[""] = linecache.cache[filename] # he
New submission from Andre Roberge :
Consider the following two examples with the latest beta release:
Python 3.10.0b3 ...
>>> def 3job(x):
File "", line 1
def 3job(x):
^
SyntaxError: invalid imaginary literal
>>> def 3ob(x):
F
Andre Roberge added the comment:
Your example is different than the one in the documentation (What's new).
>>> (x, x for x in range(7)) # Your example
File "", line 1
(x, x for x in range(7))
^^^
SyntaxError: invalid syntax
>>> foo(x, x for
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue44324>
___
___
Python-bugs-list mailing list
Unsubscribe:
Andre Roberge added the comment:
I like this. While it would be a bit longer, I'm wondering if the message
should not read instead as follows:
... Did you use the same quotes here as those enclosing the string?
===
I suspect that errors coming from the use of a single quote, as in:
&
New submission from Andre Roberge :
When using Python 3.10.0b2 on a line with more than one invalid characters, the
second one is identified as being incorrect, whereas in previous versions the
first such character was identified.
> py -3.8 unicode_quote.py
File "unicode_quote.py&
Andre Roberge added the comment:
Terry: I just checked with Idle on Windows with Python 3.9.5 and the display
works perfectly, with no incorrect characters.
--
___
Python tracker
<https://bugs.python.org/issue44
Change by Andre Roberge :
--
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue37041>
___
___
Python-bugs-list mailing list
Unsubscrib
Andre Roberge added the comment:
Up to your best judgment Pablo - and thanks for your ongoing work on improving
error messages.
--
___
Python tracker
<https://bugs.python.org/issue44
Andre Roberge added the comment:
>
> I think that the suggestion to explicitly refer to '...' instead of the
name Ellipsis would be preferable.
Aside: I had not realized that this was done at a different stage for
__debug__ and Ellipsis ("Ignorance is bliss"...) and
Andre Roberge added the comment:
I observe something similar, though with different symbols. My Windows
installation uses French (fr-ca) as default language.
===
help> COMPARISON
Comparisons
***
...
Formally, if *a*, *b*, *c*, à, *y*, *z* are expressions and *op1*,
*op2*, à, *
New submission from Andre Roberge :
Consider the following in Python 3.10
>>> ... = 1
File "", line 1
... = 1
^^^
SyntaxError: cannot assign to Ellipsis here. Maybe you meant '==' instead of
'='?
>>> __debug__ = 1
File ""
Andre Roberge added the comment:
I believe that this is similar to, but not quite as severe as a similar bug in
code.interact() https://bugs.python.org/issue43366 which affects IDLE; perhaps
fixing this might fix the other issue?
--
nosy: +aroberge
New submission from Andre Roberge :
When forgetting a comma in writing a dict literal spanning multiple lines,
the "bad token" is wrongly idenfied with Python 3.10.0b1.
>>> a = {'a': 1
... 'b': 2
File "", line 1
a = {'a':
Andre Roberge added the comment:
In the second case, I understand very well that it could have been a set
literal. In my (limited) experience, I have never seen a set literal containing
a single element obtained from an == comparison.
Since dict can be built by using keyword arguments, I
New submission from Andre Roberge :
When an equal sign is used instead of a colon in creating a dict literal,
depending on the context, either the "bad token" is misidentified OR the
would-be helpful error message is incorrect in this particular case.
1) Example of bad token.
Previ
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue44026>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue43914>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue43859>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue38530>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue43797>
___
___
Python-bugs-list mailing list
Unsubscribe:
Andre Roberge added the comment:
Since all the messages I track so far
(https://github.com/aroberge/friendly/blob/master/friendly/syntax_errors/message_analyzer.py)
had been changed when going from 6.7 to 3.8, I had (incorrectly) assumed that
all such error messages been changed to use
New submission from Andre Roberge :
Python version 3.10.0a7 added a more informative error message for:
>>> f"{**k}"
File "", line 1
(**k)
^
SyntaxError: f-string: can't use double starred expression here
Previously, the message was simply "
New submission from Andre Roberge :
Normally, for SyntaxErrors, the location of the error is indicated by a ^.
There is at least one case where the location is missing for 3.9 and 3.10.0a6
where it was shown before. Using the old parser for 3.9, or with previous
versions of Python, the
New submission from Andre Roberge :
As a result of https://bugs.python.org/issue43008, IDLE now supports custom
exception hook for almost all cases except for code entered in the interactive
shell that result in SyntaxError. It would be useful for some applications if a
way to replace the
Andre Roberge added the comment:
I understand the challenge of reproducing the behaviour of the Python
interpreter for this case. If it cannot be reproduced, then the documentation
for
https://docs.python.org/3/library/code.html#code.InteractiveConsole.interact
and others on that page
Andre Roberge added the comment:
Thonny has its own discussion site where you can report such problems:
https://groups.google.com/g/thonny
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue43
Andre Roberge added the comment:
+1 to the idea of adding something to the grammar, and have a simple error
message:
SyntaxError: Missing parentheses in call to 'print'.
in *all* cases, including the first one that prompted this bug report.
I write that even though I have creat
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue18163>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue43163>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Andre Roberge :
The following:
try:
pass
except ValueError, NameError as err:
pass
results in:
except ValueError, NameError as err:
^
SyntaxError: expected ':'
However, what is missing here are some parentheses surrounding the
Andre Roberge added the comment:
Terry: as per your earlier comment, I have tried to use Friendly-traceback with
the latest version. While it does set the exception hook correctly, it is not
useful.
Friendly-traceback (FT) needs to have access to the code that was executed.
FT's
Andre Roberge added the comment:
Pablo:
The tests are in
https://github.com/aroberge/friendly-traceback/tree/master/tests/syntax
I plan to soon add at least two dozen more based on recent contributions.
The full results can be seen on the documentation site; for example
https
Andre Roberge added the comment:
Pablo: to run the friendly-traceback test suite is simply a matter of typing
"pytest" from the root directory of the repository (after installing the
dependencies). However, it would not be helpful for the purpose of CPython
development, as l
Andre Roberge added the comment:
Pablo: I have almost exactly the same 4 test cases that you added in the test
suite, so it would pass my tests too. I would consider it to be resolved.
(For example:
https://aroberge.github.io/friendly-traceback-docs/docs/html/syntax_tracebacks_en_3.9.html
New submission from Andre Roberge :
A missing comma between list items results in an incorrect message.
Python 3.10.0a5 (tags/v3.10.0a5:b0478d7, Feb 3 2021, 01:44:54) [MSC v.1928 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license"
Andre Roberge added the comment:
A similar error exists in the table for the French documentation where
"valeurs" is indicated to be one of the options
https://docs.python.org/fr/3.8/library/tkinter.ttk.html#widget
--
nosy: +aroberge
Andre Roberge added the comment:
Such a change would be very useful and appreciated by other users as reported
on https://github.com/aroberge/friendly-traceback/issues/167 and asked about on
StackOverflow
https://stackoverflow.com/questions/60986850/why-does-creating-a-list-of-tuples-using
Andre Roberge added the comment:
I do not use IDLE (except for testing) and would not be affected by such a
change.
However, many tutorials and books intended for beginners instruct users to use
IDLE, with the assumption that it is available out of the box. Removing IDLE
would immediately
Andre Roberge added the comment:
Terry: I will put it on my todo list.
Friendly-traceback can currently work (indirectly) with IDLE; see
https://aroberge.github.io/friendly-traceback-docs/docs/html/editor.html
I am not sure what benefit this patch will yield when it comes to using
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue42955>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Andre Roberge :
--
nosy: +aroberge
___
Python tracker
<https://bugs.python.org/issue42997>
___
___
Python-bugs-list mailing list
Unsubscribe:
Andre Roberge added the comment:
I suspect that the Python parser cannot easily be changed to given any other
message. Replace the colon by "else" and add one more closing parenthesis and
you have a valid Python program. So, is it a matter of an unclosed
parenthesis, or not u
New submission from Andre Roberge :
The following code is currently consistent with the type hint syntax but
contains a line that is completely ignored.
>>> d = {}
>>> d['a']: int
>>> d
{}
>>> __annotations__
{}
>>&g
1 - 100 of 123 matches
Mail list logo