This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gjb1002
Recipients gjb1002
Date 2008-06-26.15:22:40
SpamBayes Score 3.8434493e-08
Marked as misclassified No
Message-id <>
Run the following code on Windows:

import subprocess, os

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

This produces the following exception:

Traceback (most recent call last):
  File "C:\", line 10, in <module>
WindowsError: [Error 32] The process cannot access the file because it
is being used by another process: 'filename'

When the CreateProcess call fails the subprocess module should release
the handles it provides. Unfortunately it seems to raise WindowsError
before doing this.

See also

As Tim Golden points out, this can be worked around by doing
os.close(file.fileno()) at the end instead of file.close()
Date User Action Args
2008-06-26 15:22:43gjb1002setspambayes_score: 3.84345e-08 -> 3.8434493e-08
recipients: + gjb1002
2008-06-26 15:22:42gjb1002setspambayes_score: 3.84345e-08 -> 3.84345e-08
messageid: <>
2008-06-26 15:22:41gjb1002linkissue3210 messages
2008-06-26 15:22:40gjb1002create