[EMAIL PROTECTED] wrote: > > That depends on how you invoke it: os.system creates a new shell which > in turn creates a new process; the spawn* functions do that directly.
I am using os.system. Here is my code import ftplib, posixpath, threading from TaskQueue import TaskQueue def worker(tq): while True: host, e = tq.get() c = ftplib.FTP(host) c.connect() try: c.login() p = posixpath.basename(e) 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) tq.task_done() if __name__ == '__main__': main() def main(): q = TaskQueue() #host = 'ftp.microsoft.com' host = 'mysite.com' c = ftplib.FTP(host) c.connect() try: #c.login() c.login() #folder = '/deskapps/kids/' folder = '' for n in c.nlst(folder): if n.lower().endswith('.ps'): q.put((host, n)) finally: c.close() numworkers = 4 for i in range(numworkers): t = threading.Thread(target=worker, args=(q,)) t.setDaemon(True) t.start() q.join() print 'Done.' > Anyway, if you have many conversion processes running, you should pass > them unique file names to avoid conflicts. > Where does the '1' name come from? If it's you, don't use a fixed name > - the tempfile module may be useful. I am giving unique name to the converted file with .pdf. I think something up with the thread. I am new to python, I am not sure what's wrong. -- http://mail.python.org/mailman/listinfo/python-list