On Thu, 10 Oct 2013 18:16:07 -0500, mapoe wrote: > On Thu, 10 Oct 2013 08:31:21 -0700, Isaac Gerg wrote: > >> I have a function that looks like the following: >> >> #--------------------------------- >> filename = 'c:\testfile.h5' >> f = open(filename,'r') >> data = f.read() > > it seems kind of obvious from your sample: > add: f.close() should have read a little bit further :)
but I would close the file right after I have read all the data > >> q = multiprocessing.Queue() >> p = multiprocess.Process(target=myFunction,args=(data,q)) >> p.start() >> result = q.get() >> p.join() >> q.close() >> >> f.close() >> >> os.remove(filename) >> #--------------------------------- >> >> When I run this code, I get an error on the last line when I try to >> remove the file. It tells me that someone has access to the file. >> When I remove the queue and multiprocessing stuff, the function works >> fine. >> >> What is going on here? >> >> Thanks in advance, >> Isaac -- https://mail.python.org/mailman/listinfo/python-list