Grading of C1M2 Assignment - Failing section 3

I have all unit tests pass and I can see the output of revised_draft. But I fail and get a 0% on section 3.

 All tests passed!

I see this error,

Failed test case: revise_draft raised AttributeError: ‘NoneType’ object has no attribute ‘choices’. Expected: no exception, but got: ‘NoneType’ object has no attribute ‘choices’.

I did a debug print and can see response.choices[0].message.content

Can you help me with this?

Typically this sort of error is caused if your code in the notebook uses some global variable, which the grader’s tests don’t provide.

The grader uses a totally different set of tests than those in the notebook.

2 Likes

The clue was right there in the instructions:

  • Avoid using global variables unless you absolutely have to. The grader tests your code in an isolated environment without running all cells from the top. As a result, global variables may be unavailable when scoring your submission. Global variables that are meant to be used will be defined in UPPERCASE.

Thanks for the assist, I was able to figure it out with your hint. Thank you.

2 Likes