changes on disk not visible to script ?

Nick Craig-Wood nick at craig-wood.com
Mon Oct 8 16:30:13 CEST 2007


Bruce <epost2 at gmail.com> wrote:
>  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.

Send some real code, plus a sequence of steps to be followed to
replicate the problem and you'll get some real help.  The above is
just too vague.

The above code has a syntax error in it so obviously isn't from
working code.

PS I really doubt the problem is windows not seeing the created file...

-- 
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick



More information about the Python-list mailing list