[Tutor] Run a cmd program

Øyvind python at kapitalisten.no
Tue Aug 9 14:57:50 CEST 2005


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
english).

But, when I looked in the manual about the commands module, I found this:
"Availability: Unix." That might explain. However, in the manual I also
found two other commands to try. 'Execl' which made PythonWin 2.3.5 crash
regardless how I used it, and os.popen. The latter worked perfectly.

Have a great day....



>>>> import commands
>>>> commands.getoutput("uptime AUTO-SRV-001 /s /d:04/01/2005")
>
> that should do it
>
> On 8/9/05, Øyvind <python at kapitalisten.no> wrote:
>>
>> Hello.
>>
>> I need to run a program
>> (
>> http://www.microsoft.com/ntserver/nts/downloads/management/uptime/default.asp
>> )
>> thru Python. It is normally run such as "uptime AUTO-SRV-001 /s
>> /d:04/01/2005" in the command prompt. Is it possible to run a already
>> compiled exe file in Python and thereafter get the result out? What
>> module/command should I look for to run another program? Googling have
>> only given me results about how to run Python..
>>
>> Thanks in advance.
>>
>> --
>> This email has been scanned for viruses & spam by Decna as -
>> www.decna.no<http://www.decna.no>
>> Denne e-posten er sjekket for virus & spam av Decna as -
>> www.decna.no<http://www.decna.no>
>>
>> _______________________________________________
>> Tutor maillist - Tutor at python.org
>> http://mail.python.org/mailman/listinfo/tutor
>>
>
> --
> This email has been scanned for viruses & spam by Decna as - www.decna.no
> Denne e-posten er sjekket for virus & spam av Decna as - www.decna.no
>
>


-- 
This email has been scanned for viruses & spam by Decna as - www.decna.no
Denne e-posten er sjekket for virus & spam av Decna as - www.decna.no



More information about the Tutor mailing list