Python 3.2 | WIndows 7 -- Multiprocessing and files not closing

Isaac Gerg isaac.gerg at gergltd.com
Thu Oct 10 11:31:21 EDT 2013


I have a function that looks like the following:

#---------------------------------
filename = 'c:\testfile.h5'
f = open(filename,'r')
data = f.read()

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





More information about the Python-list mailing list