You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered this issue with a student who wrote this (a priori valid) code:
deftriangle(x, y, w, h):
""" float^4 -> Image """returndraw_triangle(x, y, x+w, y, x+w/2, y+h)
If you add show_image(triangle(0, 0, 1, 1)) at the end of the file, the triangle is displayed as expected but if you enter this in the evaluation bar this fails with the following error:
=== Evaluation de : 'show_image(triangle(0, 0, 1, 1))' ===
-----
Erreurs à l'exécution (Interprète Python) :
-----
Erreur: ligne 1
==> Erreur Python: draw_triangle() missing 2 required positional arguments: 'x2' and 'y2'
Note that the problems does not come from show_image: if you only enter triangle(0, 0, 1, 1) in the evaluation bar, you get the same error.
There are two issues here:
I guess a function named triangle was defined in the gfx module and it gets overridden by ours, which messes up internal stuff in gfx, hence the error. Maybe it would be helpful for the students to get a warning when they override an existing function.
Why don't we observe the same behavior in the evaluation bar and in the file? Looks like something weird is happening…
(Bonus issue) the error is always reported at line 1 independently of the location of my triangle function in the file, this is a bit confusing
I encountered this issue with a student who wrote this (a priori valid) code:
If you add
show_image(triangle(0, 0, 1, 1))
at the end of the file, the triangle is displayed as expected but if you enter this in the evaluation bar this fails with the following error:Note that the problems does not come from
show_image
: if you only entertriangle(0, 0, 1, 1)
in the evaluation bar, you get the same error.There are two issues here:
I guess a function named
triangle
was defined in thegfx
module and it gets overridden by ours, which messes up internal stuff ingfx
, hence the error. Maybe it would be helpful for the students to get a warning when they override an existing function.Why don't we observe the same behavior in the evaluation bar and in the file? Looks like something weird is happening…
(Bonus issue) the error is always reported at line 1 independently of the location of my
triangle
function in the file, this is a bit confusing(MrPython @ e8a212a)
The text was updated successfully, but these errors were encountered: