I have an issue with my python code and in some cases, users are getting the "IndexError: list index out of range" message. However, I'm not getting the error and it's not happening with every case so it's a bit confusing.
I did search the site and found this article that sort of addressed the problem but I wasn't able to make sense of it with my code.
http://www.daniweb.com/software-development/python/threads/354113
The error comes up at the first line on the following:
cd = context.sql.sql_enroll_location(myid = id_cookie)[0]
if(cd.company):
flocation = cd.company
else:
flocation = 'Not Selected'
Is there anything obvious that I'm doing wrong or could be improved? I have had issues with similar code and using the [0] or not as I have at the end of the first line.
Thank you for the help.