ERROR CLOSING CONNECTION: mysql connection close

Discussion in 'Python' started by johnny, Dec 8, 2006.

  1. johnny

    johnny Guest

    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()
    johnny, Dec 8, 2006
    #1
    1. Advertising

  2. johnny

    Jerry Hill Guest

    On 8 Dec 2006 13:33:05 -0800, johnny <> wrote:
    > I am getting following connection error from my python script:
    >
    > conn.close()
    > AttributeError: adodb_mysql instance has no attribute 'close'


    >From the sample code on the adodb documentation page, that should be

    spelled "conn.Close()" (note the capital C in Close()).

    --
    Jerry
    Jerry Hill, Dec 8, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul van Rossem
    Replies:
    0
    Views:
    601
    Paul van Rossem
    Apr 7, 2005
  2. tshad
    Replies:
    1
    Views:
    462
    Scott M.
    Sep 6, 2006
  3. S_K
    Replies:
    6
    Views:
    663
    Russell
    Dec 7, 2007
  4. Replies:
    3
    Views:
    136
    Xavier
    Apr 27, 2006
  5. Iñaki Baz Castillo
    Replies:
    7
    Views:
    845
    Iñaki Baz Castillo
    Jan 12, 2010
Loading...

Share This Page