i write the correct syntax for while in twilio sms project i checked lot times but it shows invlid syntax
Bro in python indentation should be in proper… You wrote except outside the while statement
bro could you write the code please because i did’t get it
You need to have the correct indentation in order to get the right output.
align the except with try.
keep it exactly bottom to try.
you will get it.
print (“Reading sensor value”)
response = mybolt.analogRead(‘A0’)
data = json.loads(response)
print("Sensor value is: " + str(data[‘value’]))
sensor_value = int(data[‘value’])
if sensor_value > maximum_limit or sensor_value < minimum_limit:
print(“Making request to Twilio to send a SMS”)
response = sms.send_sms("The Current temperature sensor value is " +str(sensor_value))
print("Response received from Twilio is: " + str(response))
print(“Status of SMS at Twilio is :” + str(response.status))
except Exception as e:
print (“Error occured: Below are the details”)
@vamsikrishnareddy.ko Are you using a mix of tabs and spaces for indenting the code?
how to remove this mix of tabs and spaces. plz help @shoeb.ahmed
Check this thread Indentation error in Telegram alert system
Do let me know in case you need further assistance.