command.getoutput()

John La Rooy nospampls.jlr at doctor.com
Thu Feb 27 18:22:51 EST 2003


Peter Wu wrote:
> Python 2.2.2 (#37, Oct 14 2002, 17:02:34) [MSC 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> 
>>>>import commands
>>>>commands.getoutput('ver')
> 
> "'{' is not recognized as an internal or external command,\noperable program or batch file."
> 
>>>>commands.getoutput("ver")
> 
> "'{' is not recognized as an internal or external command,\noperable program or batch file."
> 
> 
> 
> What's the problem here? Thanks.
> 


http://python.org/doc/current/lib/module-commands.html

Availability: Unix

Looking in commands.py we see

53:    pipe = os.popen('{ ' + cmd + '; } 2>&1', 'r')

This is where the '{' is coming from. Python is trying to get windows to 
run '{ver;} 2>&1'

John





More information about the Python-list mailing list