Runs fine but an error during grading

Week 2 - Linear Regression lab

All the code runs fine and the output matches the expected with all tests passing but when I submit for grading there is the following error.

Cell #UNQ_C1. Can’t compile the student’s code. Error: IndentationError(‘unexpected indent’, (‘/tmp/student_solution_cells/cell_7.py’, 40, 4, ’ return total_cost\n’))

The grader is complaining about something in the function that computes the total_cost value.

One reason this happens is if you copied-and-pasted any of the “hint code” into your notebook.

Often the hint code contains formatting characters that Jupyter ignores, but the grader doesn’t like.

You can tell whether this happened by looking at your code in that function, and seeing whether any of the keywords or variables are displayed in a red font.

If so, you can delete and re-enter that line by hand, this should fix the issue.

Please reply if that does (or doesn’t) fix the issue for you.

Ok I figured it out. I did a “Save As” earlier because I did not have time to finish it in that moment. However this was saved with a new name and it seems no matter which form you submit on it is looking for a specific notebook in spite of what I’d named it.

You are correct. The grader always uses the original file name.

It does not matter what is the name of the notebook you have open when you submit for grading. It will always submit the notebook with the original file name.

The safe way to save your work is using “File->Save and Checkpoint”. This does not change the file name. But you can go back and restore an earlier version of your work.

1 Like