this worked quote = random.choice( list( open( "/home/nikos/www/data/private/quotes.txt", 'rb') ) ) and also this f = open( "/home/nikos/www/" + page, 'rb' ) i dont know why python 3 needs 'rb' though. Now ima having problem with this: htmldata = htmldata % (quote, music) it says soemthign about wrong operand....