os.system() with redirection

Neal Norwitz neal at metaslash.com
Fri Apr 19 12:27:55 EDT 2002


Alice NgarKit Ko wrote:
> 
> Hi,
> I want to call a program with os.system().  The program redirects output
> to file only through >& outputfile.   Here is my script (temp.py).
> 
> line = 'protomol temp.conf.PME.Ewald >& run.temp.PME.Ewald'
> os.system(line)
> 
> >python temp.py
> >sh:  run.temp.PME.Ewald:  bad number

 >& is not in the standard Bourne shell.

Do:  app > file 2>&1
or specifically for your example:

	protomol temp.conf.PME.Ewald > run.temp.PME.Ewald 2>&1

Neal



More information about the Python-list mailing list