Please ignore secret bonuses. Secret tests do NOT award bonus. Max hw grade is 30+2 bonus efficiency

Do you need help?

Notice Board

Per partecipare al corso di Fondamenti di programmazione 2023-24 loggatevi e attivatelo nella vostra pagina dei corsi preferiti. A quel punto il corso appare nel menù personale cliccando sul proprio avatar. Per i materiali degli anni precedenti seguite lo stesso metodo.

To join the Programming/Lab 2023-24 course, log-on and select it on the my courses page. It will appear on the personal menu of your avatar. For earlier years use the same method.

HW2 passes tests on the terminal but gives forbidden error on q2a

z
zoe_matrullo (2090 points)
4 8 12
in HW2 by (2.1k points)

Hi everyone. 

I finished the mandatory homework and when I tested it on the terminal on my computer it passed all of the tests. However when I uploaded it on q2a I got 3 test failed, all of them due to this error:

  testlib.ForbiddenError= The import of 'py._io.terminalwriter' is forbidden

I haven't imported anything though. If someone knows what can I do let me know! 

thanks

268 views
closed

3 Answers

Best answer
gabrimat (5630 points)
2 4 25
by (5.6k points)
selected by
It is probably a timeout, since it passes all the test on your machine it means that your computer is fast. Same problem occurred with another student with the optional homework, the problem were timeouts. I am not 100% sure.
KilianS (3590 points)
7 10 27
by (3.6k points)
no idea but good luck with your code!

PS: im not just saying this for the points mr spognardi
andrea.sterbini (207920 points)
749 1267 2373
by (208k points)
Sometimes pytest imports other libs to show errors in colors.

I have added a check on HW2req to fail tests when the ex arguments are modified.

Perhaps that error triggered the import and so the second error message
z
zoe_matrullo (2090 points)
4 8 12
by (2.1k points)
I did not modify the arguments
GabrielAlexandru (7760 points)
2 4 29
by (7.8k points)

When I delivered the optional Homework I had the same problem, as you can see here. Same thing happened: pytest tried to write the error in red text but it didn’t work and raised another error. For me it was actually a TimeoutError what triggered it.

Since you said that you did not change the argument of the ex function, perhaps it’s just a Timeout for you too.