python IOError异常

时间:2012-04-30 10:25:12

标签: python

我在我的python脚本中遇到以下异常。脚本运行24 * 7并且每两小时抛出一次以下异常。任何关于何时发生此异常的想法都会有用。

    Traceback (most recent call last):
    File "ApprovedLeadTracker.py", line 337, in ?
    processSendMailTo(sendMailTo,dedup_leads,icenet_leads,dedup_leads_tot)
    File "ApprovedLeadTracker.py", line 274, in processSendMailTo
    ue_db.processQuery(q=query)
    File "/public/gdp/trunk/src/ukl/python/database.py", line 63, in processQuery
    print traceback.format_exc()
    IOError: [Errno 5] Input/output error

database.py

def processQuery(self, q, locals=None, returnLastRowId = False, opt=''):
        ret = None
        err = ''
        for i in range(2):
            try:
                cursor = self.getCursor(opt)
                cursor.execute(q,locals)
                if (returnLastRowId):
                    ret = cursor.lastrowid
                else:
                    ret = cursor.fetchall()
                cursor.close()
                #q = cursor._last_executed
                #self.log('SUCCESS',q)
                return ret
            except MySQLdb.OperationalError, e:
                print "Exception Query:", q
                print "Exception:", e
                err = e
                print traceback.format_exc()
                self.conn = self.connect()
            except Exception, e:
                print "Exception Query:", q
                print "Exception:", e
                err = e
                print traceback.format_exc()
                self.conn = self.connect()
                break
        #q = cursor._last_executed
        #self.log('FAILURE',q)
        raise RuntimeError, str(err)

0 个答案:

没有答案