How do you create multiple connection in the treads. Lets say I will have at most 5 threads and I want to create at most 5 connections. If I create a connection in the "worker method", does it create connection for each threads.
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 file where file_path='"+p+"' set pdf_file_path='" +finalFile+"'" cursor = conn.Execute(sql) rows = cursor.Affected_Rows() tq.task_done() -- http://mail.python.org/mailman/listinfo/python-list