Running external programs: what is the best way?

Peter Hansen peter at engcorp.com
Mon Jan 2 07:09:16 EST 2006


sir_alex wrote:
> If i have to execute an external program (for example, in the frontend
> that i created for convert, from ImageMagick) i have 2 possibilities: i
> can call one function between the exec* family, or i can call the
> system function: so, which in your opinion is the best? The only
> difference that i know (but i may be in error) between these 2
> functions is that the former doesn't return (so you have to create a
> child process), but the latter returns. Is this the only difference?

Those are options.  So is the newer subprocess module, which I believe 
is considered to be a reason to deprecate almost all other ways of doing 
the same thing (os.system, possibly excluded, because of it's sheer 
simplicity).

-Peter




More information about the Python-list mailing list