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.

classification
Title: os.system() oddity under Windows XP SP2
Type: behavior Stage:
Components: Interpreter Core Versions: Python 2.3
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes, pythonmeister, tim.golden
Priority: normal Keywords:

Created on 2007-10-15 13:12 by pythonmeister, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg56439 - (view) Author: Stefan Sonnenberg-Carstens (pythonmeister) Date: 2007-10-15 13:12
When doing such
os.system("a command wich writes a outfile")
f = open("the file the command before wrote")

the file is empty.

If I do this:

os.popen("a command wich writes a outfile")
f = open("the file the command before wrote")

everything is fine
msg56440 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2007-10-15 13:44
Not, apparently, on my (XP SP2) box:

<dump>
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.system ("""python -c "f=open
('temp.txt','w');f.write('hello');f.close ()"""); print open
("temp.txt").read ()
0
hello
>>>

</dump>

Perhaps you could provide a runnable piece of code which demonstrates
the problem?
msg59183 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2008-01-03 23:58
It might happen when the program hasn't terminated yet. You have to make
sure the program has terminated before you read the file. Subprocess and
its wait() should help.
History
Date User Action Args
2022-04-11 14:56:27adminsetgithub: 45620
2008-01-03 23:58:40christian.heimessetstatus: open -> closed
resolution: wont fix
messages: + msg59183
nosy: + christian.heimes
2007-10-15 13:44:25tim.goldensetnosy: + tim.golden
messages: + msg56440
2007-10-15 13:12:56pythonmeistercreate