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

Do you need help?

import of typing forbidden

z
zoe_matrullo (2090 points)
4 8 12
in HW8 by (2.1k points)
Hi everyone!

when I test my homework I get this error

testlib.ForbiddenError: The import of 'typing' is forbidden

although I didn't import that module. Can anyone explain why this happens and what should I do?
396 views
closed

5 Answers

Best answer
gabrimat (5630 points)
2 4 25
by (5.6k points)
selected by
Some ides give you advices on what to import and when you press enter on the hint (probably without even noticing it) they automatically import the library. Happened to me a few times. Look for all the program sheet and try to search something like 'from typing import....' or 'import typing' and delete that. Let me know if you can find something, search above and below the homework assignment, the big commented text.
Simone Russolillo (5790 points)
7 10 22
by (5.8k points)
I've never seen this, but maybe it is a module imported from a built in function or something.

Check which line raises this error while in debugger mode. Maybe you can solve the problem.
gabriel.bustamante (2540 points)
3 6 20
by (2.5k points)
https://docs.python.org/3/library/typing.html

It seems to be a module for hints, maybe your IDE automatically imports it. Are you using Spyder?
z
zoe_matrullo (2090 points)
4 8 12
by (2.1k points)
yes I'm using Spyder
rokshana03 (16750 points)
1 4 35
by (16.8k points)

I'm not sure if this is even possible or I'm saying something stupid but maybe you named something inside your code that, when you test your code, recognizes it as some method of that module?

This is the whole typing module with all its methods, you could check it. Otherwise, as Simone said, debugging is the only thing that can help you out in figuring where the mistake lays

andrea.sterbini (207920 points)
750 1267 2373
by (208k points)
edited by
If you upload it I could have a look.

Anyway, you could deactivate all checks and timeout by setting DEBUG=True in test_01.py
z
zoe_matrullo (2090 points)
4 8 12
by (2.1k points)
the code is not finished but I uploaded it. In any case thanks.
andrea.sterbini (207920 points)
750 1267 2373
by (208k points)
I am not getting on the VM the 'typing' import error but only the usual terminalwriter one.

I have corrected the tests to avoid spitting out the terminalwriter error. Please re-upload your code to get the true error.