changes on disk not visible to script ?

Bruce epost2 at gmail.com
Mon Oct 8 15:27:04 CEST 2007


Hi,
I am trying to have my script automate a task, by using os.system, but
I cant get it to work.

manually, outside the script I can do this thing by

C:\echo argument_file | the_program

This works very well when argument_file is created before my script is
started

In the script I try to do it like this:
f = open("argument_file",'w')
f.write(argument)
f.close()
cmd = "echo %s | %s"%(argument_file,the_program)
os.system(cmd)

The script works if the argument_file is already in the directory
before os.system(cmd), but the script must create argument_file before
using os.system. Problem is the_program cannot find argument_file or
the_program cannot find anything inside argument_file.

The python script cannot see changes on disk. In the "My computer"
window, if I do a refresh, I can see the argument_file is created
during the script. I have also tried delays with time.sleep right
after creating the file, but still no success.

Is there some way to around this? must use windows I`m afraid.




More information about the Python-list mailing list