getting an unsubscriptable object error on an if else statement


db = MSSQL.connect(server,login,pwd,database)
c = db.cursor()
c.execute(mySQL)
rows = c.fetchone()
   
   
#determine recipient
if str(rows[3]) == str(rows[4]):
        recipient = str(rows[0]) + " " + str(rows[1])
       
else:
        recipient = "test"



the above code works fine if rows[3] == rows[4].  it's when it doesn't equal that it gives the error::

TypeError: unsubscriptable object
     
 args = ('unsubscriptable object',)





Matthew Collins
Senior Programmer Analyst, Information Technologies
Seminole County Government
1101 E First St
Sanford, FL 32771

Office 407-665-1072
Fax 407-665-1025
http://www.seminolecountyfl.gov

--****Florida has a very broad Public Records Law. Virtually all written communications to or from State and Local Officials and employees are public records available to the public and media upon request.  Seminole County policy does not differentiate between personal and business emails.  E-mail sent on the County system will be considered public and will only be withheld from disclosure if deemed confidential pursuant to State Law.****
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to