geoffbache wrote:
Tim,

Unfortunately my previous message was premature, it seems your
workaround doesn't work
either on my system (Windows XP, Python 2.5.1) I get the following
printed out

Traceback (most recent call last):
  File "C:\TextTest\processown.py", line 12, in <module>
    os.remove ("filename")
WindowsError: [Error 32] The process cannot access the file because it
is being used by another process: 'filename'
close failed: [Errno 9] Bad file descriptor

Strange. I've just double-checked and it works perfectly
well for me, although I haven't traced all the way through
the code paths of the subprocess module: it was a bit of
an educated guess. Just to confirm, I'm talking about this
code running on Python 2.5.2 on Win XP SP2.

<code>
import os
import subprocess

f = open ("filename", "w")
try:
 proc = subprocess.Popen ("blah", stdout=f)
except OSError:
 os.close (f.fileno ())

os.remove ("filename")
</code>

If I get a chance I'll try to look more closely at the subprocess
code. Could you dump out the code (or the interpreter session
in its entirety) just to make sure there's not a typo or a thinko
getting in the way?

TJG
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to