W2_unittest not defined

Hey everyone,

I’m running into an error in my week 2 programming assignment

Error:
name ‘w2_unittest’ is not defined

I’m not sure why this is happening. Has anyone seen this before or knows how to fix it.
Please help!!

That means you have not run the earlier cells in the notebook. Where is the “import” command that loads w2_unittest?

Try Cell -> Run All Above and then run your test cell again. Note that you need to rerun all the cells in order anytime you close and reopen or restart the notebook.

Thanks, but I’ve already run all the cells in the notebook. The error still persists.
I’ve run the "import w2_unittest" cell.

Error : There was a problem compiling the code from your notebook. Details:
name ‘w2_unittest’ is not defined

Are you running this on the course website? Or on your local machine?

course website

Ok, then there must be something damaged about your notebook. I will contact you by DM to look at your notebook.

Note that you need to run all of the cells every time you open the notebook.

2 Likes

It turns out that some code invoking w2_unittest had been added into one of the graded function cells and that was what was triggering this error from the grader. We had a DM conversation and I didn’t spot the bug until I actually did “linux diff” between a clean ipynb file and the actual ipynb file. :scream_cat:

2 Likes