I get the following daily. My scripts work through cron jobs. Can anyone help fix this?
File "/usr/lib64/python2.6/site-packages/MySQLdb/cursors.py", line 174, in execute self.errorhandler(self, exc, value) File "/usr/lib64/python2.6/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler raise errorclass, errorvalue _mysql_exceptions.OperationalError: (2006, 'MySQL server has gone away')
My code is:
def get_id(test_mysql_conn,id): cursor = test_mysql_conn.cursor() cursor.execute("""select id from test where id = %s """, (id)) row = cursor.fetchone() if row is not None: return row[0] return 0
brisk source share