Indentation error in modified temperature sms code

I am getting the following indentation error even though have used the proper indentation for the python code implementation of temperature system and sending sms. Using nano editor

root@ubuntu-s-1vcpu-1gb-blr1-01:~/kishan_py# python3 temp_sms.py
File “temp_sms.py”, line 27
response = sms.send_sms("The Current temperature sensor value is "+str(sensor_value))

1 Like

My fair assumption is that you have copy-pasted the code from training module. As a result there are several spaces instead of tab button.

Solution:

  1. Delete all the spaces in the beginning of the line of error and other lines with the same indentation.
  2. Provide tab spaces to them and verify correct indentation.
  3. Run the program.

Voila. You’ve successfully run the program.

1 Like

Thanks. As mentioned I re-indented the whole code with same indentation and the program is working fine. But meanwhile do let me know if there is any easier way to fix these. I mean with more complex programs the time consumed to fix them would be much higher. Is there any other editor which might help to avoid or fix these errors more easily ? or any other solution perhaps ?

Hi @raithathakishan,

You can vagrant on your laptop. Check this thread How to Copy Paste in Ubuntu in Oracle Virtual Box from windows?

1 Like

hello,
for an easy access to have your indentation errors corrected, you may use the ATOM editor, its quite easy and user friendly, take quite a less time compared to editing in ubuntu platform.


here is the link to download.
hope this helps.:slight_smile:

1 Like