I am getting following connection error from my python script:

    conn.close()
AttributeError: adodb_mysql instance has no attribute 'close'

Here is my relevant code below:

def worker(tq):
    while True:
        host, e = tq.get()

        c = ftplib.FTP(host)
        c.connect()
        try:
            c.login()
            p = os.path.basename(e)
            download_dir = r'H:/ftp_download/'
            ps_dir = r'H:/ftp_download/'
            filename = download_dir+p
            fp = open(filename, 'wb')
            try: c.retrbinary('RETR %s' % e, fp.write)
            finally: fp.close()
        finally: c.close()
        if (p.lower().endswith('.ps') ):
            partFileName = p.split('.', 1)
            movedFile = download_dir + p
            #movedFile = p
            finalFile = ps_dir + partFileName[0]+'.pdf'
            encode_cmd = r'ps2pdf '+ movedFile + ' '+ finalFile
            os.system(encode_cmd)

        conn = adodb.NewADOConnection('mysql')
        conn.Connect('localhost', 'temp', 'temp', 'temp')

        sql = r"update video set pdf_file_path='" +finalFile+r"' where
file_path='"+p+r"'"


        cursor = conn.Execute(sql)
        rows = cursor.Affected_Rows()

        cursor = conn.Execute(sql)
        rows = cursor.Affected_Rows()
        cursor.close()
        conn.close()
            
        tq.task_done()

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to