geoffbache wrote:
Am currently being very confused over the following code on Windows

import subprocess, os

file = open("filename", "w")
try:
    proc = subprocess.Popen("nosuchprogram", stdout=file)
except OSError:
    file.close()
    os.remove("filename")

Forgot to say: slightly awkward, but you can work around
it like this:

<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>

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

Reply via email to