[ale] Python help for sig generator

Trey Sizemore treysizemore at bigfoot.com
Sat Mar 15 21:20:01 EST 2003


I saw a post where someone had given a sample Python script to randomly
generate sigs pulled from a text file.  I copied the script and made it
executable, but the actual pulling of lines from the text file doesn't
seem to work (see below).  I am using Evolution for email.  Here is the
script (in my /home/trey
directory):

#!/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 "Trey<br>"
print "---<br>"
print "<br>"
print "Today's Affirmation (selected automatically just for you):<br>"
print "<br>"

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

# print the randomly selected line
print aff

The text file referenced is also in my /home/trey directory and looks
like this:
 
This is a test.
Another test line.
This is a sample line.

One quote per line as recommended.

What did I do wrong?


---
Cheers,
Trey
---

Today's Affirmation (selected automatically just for you):

_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale






More information about the Ale mailing list