Week 1 The notebook you provided has a syntax error that prevents it from compiling

When I Submit Assignment for Week 1 I get the next error: “The notebook you provided has a syntax error that prevents it from compiling.”

I pass all tests for all exercises and got the error for all exercises.
I tried to update the lab and got the same error for all exercises.
I tried to submit only one solved exercise and also got the same error.

But it works for other weeks.

1 Like

Hi @Ivaniuk_Petro
Maybe you have changed something you were not supposed to something like adding new cells or changing the default values.
Did you get a fresh copy of the assignment and retry to submit it?

Yes, I refreshed and send only the first solved exercise without change in any other cells and got the same error.
Probably notebook was not refreshed but i did it

I have the same issue.


@Ivaniuk_Petro @mbrkic
Ok well, the same problem occurs to me before. Please try this way: First, go to the assignment directory and delete every file or folder in it manually (Be careful about your solution file and get a local backup of it). Then get a fresh copy of the assignment files, put your answers in it and submit it.
Please let me know if this works for you.

@Mahdi_Molaei . I am also facing the same issue and I tried to follow your instructions but it is still not working for me.

Hi @Piyush_Verma07
Welcome to the community :slight_smile:
Did you change anything in the code (like adding a cell, changing default comments or values, etc.)?

This worked for me and I managed to pass the assignment. However, I earned 0 points in the Test model subsection. I got a message “There was a problem grading your submission. Check stderr for more details.”

Well, I didn’t face that error before. Can you please check the stderr and send me the complete error message?

Hello. I have inspected cell by cell, deleted all the files and uploaded the revised one. And always get the same result: “The notebook you provided…”.
Any other hint, please?

Same issue, I think maybe the compiler for our notebook and the testing notebook is different?

All my test passed but I got 0. I also tried just solving the first exercise only to debug but the compiler still gives the same error. I am very sure I did not change anything of the code.

Ok, I think the issue could be that we accidentally added a last cell at the very end of the notebook. Delete that cell and try again

Hi all, I just start on this exercise, facing the same error when submit for grade review:
“The notebook you provided has a syntax error that prevents it from compiling”

Latest, I have followed the suggestion, deleting the notebook, and replaced by a blank one, manually type back the answer (this time I shouldn’t have add any new remarks/testing cells… However the same error still persists…

Can anyone help?

Hi, is there anyone here can help?

believe we need to submit all the correct answer at the end and we can get through this

Hi, I am having the same problem. I only submitted with the first 2 exercises completed and all tests passed and the issue occurs. I added a third exercise and the issue occurs again. The error is “The notebook you provided has a syntax error that prevents it from compiling.” Zero points for all exercises completed correctly. No extra cells or global variables are being used.

Can you check please…


I got "The notebook you provided has a syntax error that prevents it from compiling. " as well after submitting for grading. The first 3 exercises have passed all tests.

The issue persisted after refreshing the workspace following Coursera | Online Courses & Credentials From Top Educators. Join for Free | Coursera

Please realize that no-one else can see your notebooks. I’m not a mentor for NLP, so I don’t know anything about the contents of that particular assignment. But typically if you pass the local tests in the notebook, but then fail the grader, it means that something you have done in the notebook is not sufficiently “general”. In other words, you’ve done some form of “hard-coding” things to match the particular test cases in the notebook. Or perhaps you are referencing global variables that happen to be defined in the notebook from within the local scope of some of your solution functions and those globals happen not to be defined in the grader context.

Since a lot of students seem to hit this very specific error on this particular notebook, there must be some error that’s easy to make that has the flavor of “hard-coding”. Please have another careful look through all your code with that idea in mind.

1 Like

I did a test that to submit the original notebook without adding any codes, you will still get the error message that “The notebook you provided has a syntax error that prevents it from compiling.” It doesn’t matter whether you passed all tests or not, your assignment is always 0. Please fix this issue.

Where does it say that a “clean” notebook will not have a syntax error? They frequently write the template code with the python token “None” in places that you need to fill in your code. So it frequently happens that gives you a syntax error until you fill in some code. Please try running the unmodified notebook with “Cell → Run All” and then scan through. I’ll bet you find some syntax errors. You’ll need to fix all of them in order to get any grading done.