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.

Errore test in anaconda prompt: " testlib.ForbiddenError: The import of 'unicodedata' is forbidden "

D
David (350 points)
1 2 3
in HW4 by (350 points)
Ogni volta che provo a testare il mio programma il prompt mi genera questo errore:

============================================================================================ short test summary info =============================================================================================
FAILED test_01.py::Test::test_example_0 - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
FAILED test_01.py::Test::test_example_1___02___2__0_915513__0_5_ - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
FAILED test_01.py::Test::test_example_2___06___2__0_546026__0_5_ - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
FAILED test_01.py::Test::test_example_3___01___2__0_886818__0_5_ - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
FAILED test_01.py::Test::test_example_4___08___15__0_156752__0_5_ - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
FAILED test_01.py::Test::test_example_5___05___2__0_796107__0_5_ - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
FAILED test_01.py::Test::test_example_6___07___2__0_864993__0_5_ - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
FAILED test_01.py::Test::test_example_7___03___2__0_84305__0_5_ - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
FAILED test_01.py::Test::test_example_8___04_200___7__0_960865__1_ - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
========================================================================================= 9 failed, 2 warnings in 1.37s ==========================================================================================

Non ho importato nessun'altra libreria oltre a quelle già presenti nel file.
Che cosa dovrei fare?
394 views

1 Answer

andrea.sterbini (207920 points)
750 1267 2373
by (208k points)
dipende dall'encoding che usi nella open, se usi utf8 non viene l'errore
D
David (350 points)
1 2 3
by (350 points)
Aprivo già il file con " encoding = "utf-8" " ma ho comunque provato a giocarci un po', togliendo il trattino, scrivendolo in caps e così via. Sfortunatamente l'errore continua ad esserci.
andrea.sterbini (207920 points)
750 1267 2373
by (208k points)
Per ora metti DEBUG=True in test_01.py così puoi lavorare
D
David (350 points)
1 2 3
by (350 points)
Va bene, grazie per le risposte.