Hi, I'm really hoping someone can help me understand what is wrong with this piece of code. Thanks, Patty
This is how I call my function: http://hostname/mptest/ask.py/ask?host=ahost&target=atarget *************************************************************************** This is the piece of code: # Connect to the database conn = MySQLdb.connect(host = "localhost", user = "root", passwd = "", db ="ants_control_center") cursor = conn.cursor() def ask(req, host, target): gtarget = "%s" % target ghost = "%s" % host cursor.execute(""" #This is line 18 SELECT date FROM targets WHERE target_name = %s""",(gtarget)) result = cursor.fetchone() conn.commit() if ((gtarget == 'bl') | (gtarget == 'bs') | (gtarget == 'nl') | (gtarget == 'bx')): cursor.execute("UPDATE targets SET date = %s WHERE target_name = %s", (datetime.date.today(),gtarget)) conn.commit() return compare_hosts(ghost,gtarget) # This one takes care of the rest if (datetime.date.today() == result[0]): return compare_hosts(ghost,gtarget) else: return set_host_percentage(ghost,gtarget) *************************************************************************** This is the error I'm getting: <pre> Mod_python error: "PythonHandler mod_python.publisher" Traceback (most recent call last): File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 299, in HandlerDispatch result = object(req) File "/usr/lib/python2.3/site-packages/mod_python/publisher.py", line 136, in handler result = util.apply_fs_data(object, req.form, req=req) File "/usr/lib/python2.3/site-packages/mod_python/util.py", line 361, in apply_fs_data return object(**args) File "/var/www/html/mptest/ask.py", line 18, in ask cursor.execute(""" File "/usr/lib/python2.3/site-packages/MySQLdb/cursors.py", line 137, in execute self.errorhandler(self, exc, value) File "/usr/lib/python2.3/site-packages/MySQLdb/connections.py", line 33, in defaulterrorhandler raise errorclass, errorvalue AttributeError: 'NoneType' object has no attribute 'literal' </pre>