First, as @ l33tnerd said, f.close should be outside the for loop.
Secondly, you only call readline once, before the loop. This is just reading the first line. The trick is that in Python, files act like iterators, so you can iterate over a file without having to call any methods on it, and this will give you one line per iteration:
if data.find('!masters') != -1: f = open('masters.txt') for line in f: print line, sck.send('PRIVMSG ' + chan + " " + line) f.close()
Finally, you referenced the lines variable inside the loop; I assume you meant the line link.
Edit: Oh, and you need to defer the contents of the if .
mgiuca
source share