In article <[EMAIL PROTECTED]>,
Eric Price <[EMAIL PROTECTED]> wrote:
>
>I have a couple bugs to work out in the below script; namely, I don't
>know how to capture the result of an os.system command, nor am I
>convinced that the call to os.system actually results in the execution
>of the command. H
From: "Eric Price" <[EMAIL PROTECTED]>
Date: March 31, 2007 9:38:53 AM EDT
To: [EMAIL PROTECTED], [EMAIL PROTECTED]
Cc: python-list@python.org
Subject: Re: os.system questions
Oops! The problem isn't in the os.system call. It's in the fact
that I don'
Thank you :)
Eric
>From: "Parthan SR" <[EMAIL PROTECTED]>
>To: "Eric Price" <[EMAIL PROTECTED]>
>Subject: Re: os.system questions
>Date: Sat, 31 Mar 2007 19:52:01 +0530
>
>On 3/31/07, Eric Price <[EMAIL PROTECTED]> wrote:
>>
>>
a cron event such that "freshReboot"
actually gets called when I run test.py?
TIA,
Eric
>From: "Eric Price" <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>CC: python-list@python.org
>Subject: Re: os.system questions
>Date: Sat, 31 Mar 2007 09:33:03 -0400
>
&g
Great! That seems to work fine:
#!/usr/local/bin/python
import re, os
def freshReboot():
up = os.popen('uptime').readlines()
up = up[0]
if re.search('day|hour', up):
pass
else:
tup = re.split('min', up)
first = tup[0]
On 3/31/07, Eric Price <[EMAIL PROTECTED]> wrote:
> Hi;
> I have a couple bugs to work out in the below script; namely, I don't know
> how to capture the result of an os.system command, nor am I convinced that
> the call to os.system actually results in the execution of the command. Here
> is the s
Eric Price schrieb:
> up = os.system("uptime")
> How do I assign the output of "uptime" to the variable "up"?
| >>> print os.system.__doc__
| system(command) -> exit_status
|
| Execute the command (a string) in a subshell.
os.system returns the exitcode of the given command. To get the output
try