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

D
David (350 points)
1 1 3
asked Nov 19, 2021 in HW4 by David (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?
90 views

1 Answer

andrea.sterbini (167420 points)
488 897 1726
answered Nov 19, 2021 by andrea.sterbini (167,420 points)
dipende dall'encoding che usi nella open, se usi utf8 non viene l'errore
D
David (350 points)
1 1 3
commented Nov 19, 2021 by David (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 (167420 points)
488 897 1726
commented Nov 19, 2021 by andrea.sterbini (167,420 points)
Per ora metti DEBUG=True in test_01.py così puoi lavorare
D
David (350 points)
1 1 3
commented Nov 19, 2021 by David (350 points)
Va bene, grazie per le risposte.