[gentoo-user] Adding output of 'uptime' to python sig

2004-02-15 Thread Trey Sizemore
I have a python script that I use currently in my sig and wanted to add
a line to show the output of the 'uptime' command.

Would someone be able to tell me how to do this?  Such as add it as a
line under the current sig?  Here's the script I'm using:

 #!/usr/bin/python

# change this to point to your file of quotes
aff_file = /home/trey/quotes.txt

import string, random

# hack this at will
print -- br
print Cheers,br
print Treybr
print ---br
print br

# cryptic python stuff which pulls a line from a text file
# at random
affs = open(aff_file,r)
affs = affs.readlines()
aff = affs[int(random.random() * len(affs))].split(\n)[0]

# print the randomly selected line
print aff
-- 
Cheers,
Trey
---

Adversity is the trial of principle.
Without it, a man hardly knows whether he is honest or not.
--Henry Fielding


--
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] Adding output of 'uptime' to python sig

2004-02-15 Thread David Mallwitz
On Sunday 15 February 2004 11:13 am, Trey Sizemore wrote:
 I have a python script that I use currently in my sig and wanted to
 add a line to show the output of the 'uptime' command.

 Would someone be able to tell me how to do this?  Such as add it as a
 line under the current sig?  Here's the script I'm using:

Change your import line to read:

import string, random, os

add this to read your uptime:

uptime=string.strip(os.popen(/usr/bin/uptime).readline())

add this to wherever you want it printed:

print uptime


Dave


--
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] Adding output of 'uptime' to python sig

2004-02-15 Thread Trey Sizemore
On Sun, 2004-02-15 at 11:35, David Mallwitz wrote:
 Change your import line to read:
 
   import string, random, os
 
 add this to read your uptime:
 
   uptime=string.strip(os.popen(/usr/bin/uptime).readline())
 
 add this to wherever you want it printed:
   
   print uptime
 
 
 Dave

Thanks, Dave.  One last item if you have the patience.  What would I
need to add the output of 'uname -a'?

Thanks again.

-- 
Cheers,
Trey
---

In answer to the question of why it happened,
I offer the modest proposal that our Universe is simply
one of those things which happen from time to time.
--Edward P. Tryon 

11:58am up 3:21, 1 user, load average: 0.93, 0.51, 0.59


--
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] Adding output of 'uptime' to python sig

2004-02-15 Thread David Mallwitz
On Sunday 15 February 2004 12:00 pm, Trey Sizemore wrote:

 Thanks, Dave.  One last item if you have the patience.  What would I
 need to add the output of 'uname -a'?

 Thanks again.

uname=string.strip(os.popen(/bin/uname -a).readline())

print uname


--
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] Adding output of 'uptime' to python sig

2004-02-15 Thread Trey Sizemore
On Sun, 2004-02-15 at 17:44, David Mallwitz wrote:

 uname=string.strip(os.popen(/bin/uname -a).readline())
 
 print uname
 
Thanks for your help.
-- 
Cheers,
Trey
---

The beauty of the soul shines out when a man bears with
composure one heavy mischance after another, not because he
does not feel them, but because he is a man of high and heroic temper.
- Aristotle 

8:02pm up 11:25, 1 user, load average: 0.46, 0.53, 0.34 
Linux linux 2.4.21-144-default #1 Fri Nov 14 00:01:36 UTC 2003 i686 i686
i386 GNU/Linux


--
[EMAIL PROTECTED] mailing list