The whole try stement is as follows to have the compete idea: try: cur.execute( '''SELECT url, hits FROM counters ORDER BY hits DESC''' )
data = cur.fetchall() for row in data: (url, hits) = row print( "<tr><td><center><a href='http://superhost.gr/?show=log&htmlpage=%s'><font color=tomato size=5> %s </a></td>" ) % (url, url) print( "<td><center><font color=cyan size=5> %s </a></td></tr>" ) % (hits) except MySQLdb.Error, e: print( "Query Error: ", sys.exc_info()[1].excepinfo()[2] ) -- http://mail.python.org/mailman/listinfo/python-list