Executing a system command

Chris Liechti cliechti at gmx.net
Wed May 22 18:13:06 EDT 2002


jb <jblazi at hotmail.com> wrote in news:3cec0fa1_1 at news2.newsgroups.com:

> I should like to execute the bash command
> 
> (cd prefix;latex file.tex;dvips file)
> 
> Can I do that with the os.system function?

i think you can.

>It seems I am having diffculties with that.

then descibe that problem so that we can help :-)

some wild guesses:
- if you want to capture the output you can use os.popen()
- or maybe you need to use an absolute path for "prefix"

try "&&" instead of ";" so that when latex fails, the dvips command is not 
executed and os.system returns the non zero exit code (at least on Linux, i 
think)

chris

-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list