[Tutor] execute an OS command, get the output

Terry Carroll carroll at tjc.com
Sat Mar 11 07:18:32 CET 2006


On Fri, 10 Mar 2006, [ISO-8859-1] Hugo González Monteverde wrote:

> Looks like you are looking for the commands module, it provides:
> 
> getstatusoutput( cmd)
> 
> getoutput( cmd)
> 
> getstatus( file)
> 
> 
> Which do exactly what tou want. Take a look at the docs at:
> 
> http://python.active-venture.com/lib/module-commands.html

Thanks, Hugo.  Unfortunately, it doesn't work for me; for example:

>>> print getoutput("dir")
'{' is not recognized as an internal or external command,
operable program or batch file.

The docs say:

  Availability: Unix.

And I'm on Windows/XP, so I'm guessing that although the module's there,
it just doesn't work on Windows.



More information about the Tutor mailing list