dnif-archive / DigiVigi

GNU General Public License v3.0
1 stars 7 forks source link

While configuring SMTP I am getting error as 'SMTP Configuration failed due to string indices must be integers, not str'. #16

Closed Sharbanibasu23 closed 6 years ago

Sharbanibasu23 commented 6 years ago

Hi Everyone, I am facing an issue while configuring SMTP in DNIF container. As @PRASHANT-SAWANT has already configured this I was following the steps mentioned by him #6. As mentioned in the steps, in smtp.yaml file I commented the internal settings and uncommented the external settings. I changed the external settings as follows- domain: smtp.gmail.com username: email id1 password: email id1 password port: 587 tls: 1 from: email id1 to: email id2

After editing I saved the changes and ran the command $python configsmtp.py. But I am getting an error as 'SMTP Configuration failed due to string indices must be integers, not str'. I also opened the configsmtp.py file. But not being able to understand for which string object it is giving this error. If anyone of you have faced similar issue or have any solution for this please comment here.

PRASHANT-SAWANT commented 6 years ago

Since this is a config file, I'd suggest that you be extra careful with spaces that you might add accidentally. Also do not erase those spaces which were already there. I am guessing that must be the problem.

Anyway if that is not the case, please do not forget to post your issue solution and close this issue.

Sharbanibasu23 commented 6 years ago

Thanks for the reply @PRASHANT-SAWANT. This was happening because of a similar issue. Though I was cautious about the white spaces according to the instructions one small indentation problem was there. Because of that it was giving this error. This is resolved now. Please remember that if you are getting errors like "SMTP Configuration failed due to string indices must be integers, not str" or "SMTP Configuration failed due to 'NoneType' object has no attribute ' getitem" these are may be because of the contents of SMTP.yaml file are not written with right indentation or there may be extra white space. Python is sensitive to indentation. I am sharing the screenshot of the correct SMTP.yaml file. The contents in the file should be written in same format. smtp smtpfile