<div dir="ltr">On Thu, Oct 10, 2013 at 2:49 PM, Isaac Gerg <span dir="ltr"><<a href="mailto:isaac.gerg@gergltd.com" target="_blank">isaac.gerg@gergltd.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div class="h5"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Oct 10, 2013 at 2:41 PM, Ned Batchelder <span dir="ltr"><<a href="mailto:ned@nedbatchelder.com" target="_blank">ned@nedbatchelder.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 10/10/13 12:44 PM, Isaac Gerg wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Sorry, I am just providing pseudo code since I the code i have is quite large.<br>
<br>
As I mentioned, the code works fine when I remove the multirpcessing stuff so the filename is not the issue (though you are right in your correction).<br>
<br>
Someone with the same problem posted a smaller, more complete example here:<br>
<br>
<a href="http://stackoverflow.com/questions/948119/preventing-file-handle-inheritance-in-multiprocessing-lib" target="_blank">http://stackoverflow.com/<u></u>questions/948119/preventing-<u></u>file-handle-inheritance-in-<u></u>multiprocessing-lib</a><br>
<br>
None of the solutions posted work.<br>
</blockquote>
<br>
(BTW: it's better form to reply beneath the original text, not above it.)<br>
<br>
None of the solutions try the obvious thing of closing the file before spawning more processes. Would that work for you? A "with" statement is a convenient way to do this:<br>
<br>
with open(filename,'r') as f:<br>
data = f.read()<br>
<br>
The file is closed automatically when the with statement ends.<br>
<br>
--Ned.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
On Thursday, October 10, 2013 12:38:19 PM UTC-4, Piet van Oostrum wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Isaac Gerg <<a href="mailto:isaac.gerg@gergltd.com" target="_blank">isaac.gerg@gergltd.com</a>> writes:<br>
<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have a function that looks like the following:<br>
</blockquote>
<br>
<br>
That doesn't look like a function<br>
<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
#-----------------------------<u></u>----<br>
filename = 'c:\testfile.h5'<br>
</blockquote>
<br>
<br>
Your filename is most probably wrong. It should be something like:<br>
<br>
<br>
<br>
filename = 'c:/testfile.h5'<br>
<br>
filename = 'c:\\testfile.h5'<br>
<br>
filename = r'c:\testfile.h5'<span><font color="#888888"><br>
<br>
-- <br>
<br>
Piet van Oostrum <<a href="mailto:piet@vanoostrum.org" target="_blank">piet@vanoostrum.org</a>><br>
<br>
WWW: <a href="http://pietvanoostrum.com/" target="_blank">http://pietvanoostrum.com/</a><br>
<br>
PGP key: [8DAE142BE17999C4]<br>
</font></span></blockquote></blockquote>
<br>
</blockquote></div><br></div></div></div><div class="gmail_extra">I will try what you suggest and see if it works.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Additionally, is there a place on the web to view this conversation and reply? Currently, I am only able to access this list through email.</div>
</div>
</blockquote></div><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Ned, I am unable to try what you suggest. The multiprocess.Process call is within a class but its target is a static method outside of the class thus no pickling. I cannot close the file and then reopen after the multiprocess.Process call because other threads may be reading from the file during that time. Is there a way in Python 3.2 to prevent the multiprocess.Process from inheriting the file descriptors from the parent process OR, is there a way to ensure that the multiprocess is completely closed and garbaged collected by the time I want to use os.remove()?</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">Isaac</div></div>