Zend certified PHP/Magento developer

Python webapp IndexError raised by FastCGI-stderr from lighttpd on remote server; executes ok locally [migrated]

I have setup a lighttpd remote server that I want to run a python application using fastcgi. The application has a login with a backdoor. When I try to use it, I get an internal server error. In the lighttpd error log, I see:

2020-01-23 20:05:51: (mod_fastcgi.c.2702) FastCGI-stderr: paswd = getEntry(“students”,”password”,”username”,user)

2020-01-23 20:05:51: (mod_fastcgi.c.2702) FastCGI-stderr: File “/root/web-crs/control.py”, line 35, in getEntry

2020-01-23 20:05:51: (mod_fastcgi.c.2702) FastCGI-stderr: return bob[0][col]

2020-01-23 20:05:51: (mod_fastcgi.c.2702) FastCGI-stderr: File “/usr/local/lib/python2.7/dist-packages/web/db.py”, line 531, in getitem

2020-01-23 20:05:51: (mod_fastcgi.c.2702) FastCGI-stderr: raise IndexError(str(i))

2020-01-23 20:05:51: (mod_fastcgi.c.2702) FastCGI-stderr: IndexError: 0

When I run the application locally on my machine, I’m able to login through the backdoor fine.

This is the code in control.py that seems to be causing the IndexError:

def getEntry(table,col,key,ID):
"""
returns value of column from corresponding key/ID. Returns
only one entry.
"""
wherestring = "{0}="{1}"".format(key,ID)
bob = ctrl.select(table,where=wherestring,what=col)
if bool(bob): #Calling bool(bob) depletes the iterator  
    bob = ctrl.select(table,where=wherestring,what=col)
    return bob[0][col]
else:
    return None

Any suggestions are greatly appreciated, my experience in this area is limited. Thanks!