Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > ERROR CLOSING CONNECTION: mysql connection close

Reply
Thread Tools

ERROR CLOSING CONNECTION: mysql connection close

 
 
johnny
Guest
Posts: n/a
 
      12-08-2006
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()

 
Reply With Quote
 
 
 
 
Jerry Hill
Guest
Posts: n/a
 
      12-08-2006
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to close a TCP socket? (TCPSocket#close doesn't close it) IƱaki Baz Castillo Ruby 7 01-12-2010 01:32 PM
this.Connection.Close(); does not close the Oracle session! Pleasehelp! S_K ASP .Net 6 12-07-2007 02:07 PM
Do I need to close Reader if I close the Connection? tshad ASP .Net 1 09-06-2006 12:15 AM
mysql-ruby segmentation fault when closing connection miklawlor@gmail.com Ruby 3 04-27-2006 06:21 PM
Why does JdbcRowSetImpl.close() close the database connection? Paul van Rossem Java 0 04-07-2005 07:01 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57