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.
The error comes up at the first line on the following:
cd = context.sql.sql_enroll_location(myid = id_cookie) 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  or not as I have at the end of the first line.
Thank you for the help.