ERROR CLOSING CONNECTION: mysql connection close

J

johnny

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()
 
J

Jerry Hill

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()).
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top