Syntax error in Project 9 Python code 1


I am getting syntax error for the Python code in Project 9. Please help me with the solution.

Please paste your entire code here

@sohammethul10 please share SS of your code.

  1. Python is very particular about formatting and you must ensure that the formatting is done properly.
  2. Just check the line number where the error is popping up.
  3. Check if there is any formatting error or typo that is causing interpreter to stop in that line or the previous line. I think the code is misspelt as resonse.status. Most likely it should be response.status. Please check.
  4. Check if all the dependent modules are imported in the beginning of the code and the correct version of the library has been downloaded in your compuer.

Hope that helps.

1 Like


I have corrected the spelling of response, still the same error is being shown.

In the line above the error, please close the braces of the print line after the function call str(response)
like:
print(“Response received from Twilio is”,str(response))

Hope this helps.

1 Like

in the line you have written
response = sms.send_sms("The current temperature value is: "+str(sensor_value$
which is wrong you have to close the bracket at the end of this line for example:
response = sms.send_sms("The current temperature value is: "+str(sensor_value))
and then again below that line you have also missed the closing braces for that line
which should be like this
print("Response received from twilio is "+str(response))
i hope that will solve your query. Have a nice day.

@sohammethul10 you are supposed to close the print statement on line 21.
"print(“Response received from Twilio is: " + str(response))”.