Problem with subprocess module on Windows with open file in appendmode

A

Andrew Savige

When I run this little test program on Linux:

import subprocess
subprocess.call(["python","-V"], stderr=open("log.tmp","a"))

the file log.tmp is appended to each time I run it.
When I run it on Windows, however, the file log.tmp gets
overwritten each time I run it.

Though I can make it append on Windows like this:

import os
import subprocess
f = open("log.tmp", "a")
f.seek(0, os.SEEK_END)
subprocess.call(["python","-V"], stderr=f)

I don't understand why that should be necessary.

Is this a Python/subprocess bug on Windows?

(I tested with Python 2.5.1 and Python 2.6.2 on Windows XP SP2).

Thanks,
/-\



__________________________________________________________________________________
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top