Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Problem with subprocess module on Windows with open file in appendmode

Reply
Thread Tools

Problem with subprocess module on Windows with open file in appendmode

 
 
Andrew Savige
Guest
Posts: n/a
 
      10-04-2009
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/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Print file via file association using os.system or subprocess?(Windows) python@bdurham.com Python 0 07-19-2010 01:49 AM
how to import subprocess into my 'subprocess.py' file hiral Python 2 05-05-2010 12:56 PM
Re: how to open a file in some application using Tkinter i am usingTKINTER to create GUI application i want to know how to open a worddocument in open office or any other applicatio Fredrik Lundh Python 1 01-09-2008 10:40 AM
[Subprocess/Windows] subprocess module under Windows 98 Andreas Jung Python 2 11-02-2005 05:41 PM
Buffering problem using subprocess module Dr. Who Python 1 07-21-2005 08:18 PM



Advertisments