Strange error on unmatched ")"

I completed the assignment 2 (Alappaca) of Week 2 and all cells are working fine. However, when I submit to grader, I’m getting the strangest error. Here’s the text

Cell #UNQ_C2. Can't compile the student's code. Error: SyntaxError("unmatched ')'", ('/tmp/student_solution_cells/cell_16.py', 41, 5, '    )'))
 Traceback (most recent call last):
  File "/home/www/app/grading/exceptions.py", line 112, in handle_solution_errors
    yield {}
  File "/home/www/app/grading/abstract.py", line 393, in _grade
    context = compiled_code.run(cell_index=cell.index)
  File "/home/www/app/grading/submission/compiled_code.py", line 195, in run
    return list(self._code_items.values())[cell_num - 1].run()
  File "/home/www/app/grading/submission/compiled_code.py", line 54, in run
    return import_module(self.import_statement, items)
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 839, in exec_module
  File "<frozen importlib._bootstrap_external>", line 976, in get_code
  File "<frozen importlib._bootstrap_external>", line 906, in source_to_code
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/tmp/student_solution_cells/cell_16.py", line 41
    )
    ^
SyntaxError: unmatched ')'

If everything runs correctly for you, but fails the grader in that way, one possibility is that you did not do a “Save” before the “Submit” and the grader is seeing an older (and broken) version of your code.

Try this:

Kernel -> Restart and Clear Output
Cell -> Run All

Now scan through and make sure everything runs correctly. If so, then do this sequence:

Kernel -> Restart and Clear Output
Save
Submit Assignment

Let us know what happens.

For whatever reason, I think you are right. When I tried saving the code, it showed me this dialog. Looks like another session (I don’t know how) is opened somewhere trying to save my old code.

I did overwrite and then again Ran all cells to make sure, it’s all running smoothly. Doing that showed me that a new checkpoint was made for the notebook.

I’m still getting the same error. I really don’t know what to do to solve it. I’m literally stuck in my progress in this course due to this.

You seem to have had two copies of the notebook open in different browser windows. This confuses the Jupyter workspace manager.

You may deed to delete your notebook and start over.

I’ve seen the notebook and it turns out that the whole beginning section has just been deleted. Here’s what it looks like:

Why did you do that? It’s a mistake in general to modify things outside the “YOUR CODE HERE” segments. It’s not illegal, but you need to be careful when you do that. You must have trashed some of the JSON metadata that is not visible in the notebook, but which the grader depends on.

Please get a fresh copy and then copy over just your code from the “YOUR CODE HERE” segments and then try submitting to the grader again.

Please let us know if that resolves the problem for you.