[Tutor] Run a cmd program

Kent Johnson kent37 at tds.net
Tue Aug 9 15:29:10 CEST 2005

oliver wrote:
> On 8/9/05, Øyvind <python at kapitalisten.no> wrote:
>>Thanks a lot. However, it didn't work. I got an error stating something
>>along: "Is not recognized as an internal or external command, executable
>>program or ...... file" (I don't know how to translate the word ..... to
> That looks like a windows error not a python problem.  Python cannot
> find the path to the uptime executable.  You need to either fully
> qualify the uptime command ( C:\path\to\uptime ) or somehow set the
> path in the python environment.

The commands module is not supported on Windows. It's kind of strange, because the module is present, but it doesn't work.

 >>> import commands
 >>> commands.getoutput('java')
"'{' is not recognized as an internal or external command,\noperable program or batch file."

Note the '{' - this is the unrecognized command. From the docs for command:
 cmd is actually run as { cmd ; } 2>&1

which shows where the { comes from...


More information about the Tutor mailing list