I have been playing with Python and geektools and I had the script working before I tided up the code and used loops.
Now it will not display anything past the lalala method.
I am working on mac 10.8.1 with geektools 3.0.2.
#!/usr/bin/python
#Simple script that downloads runescape adventures log
#and outputs it to console
# Ashley Hughes 16/SEP/2012
import sys
import urllib2 #For HTTP access
from time import localtime, strftime #Time data functions
from xml.dom.minidom import parseString #XML parser
def lalala(n):
i = 0
while(i <= n):
xmlTag = dom.getElementsByTagName('description')[i].toxml()
xmlData = xmlTag.replace('<description>','').replace('</description>','').replace('\t','').replace('\n','')
#print (str(i) + ": " + xmlData)
print(xmlData)
i = i + 1
try:
f = urllib2.urlopen("http://services.runescape.com/m=adventurers-log/rssfeed?searchName=SIG%A0ZerO")
#f = urllib.urlopen("http://www.runescape.com/")
except Exception, e:
print "Could not connect"
sys.exit(1)
s = f.read()
f.close()
dom = parseString(s)
print strftime("%a, %d %b %Y %H:%M:%S", localtime())
print "Working"
lalala(6)
print "Still working"
sys.exit(0)
You have an unicode-ascii problem when your code is ‘printing’ to GeekTool. Change:
to this:
this is fine for me in mac 10.8.1 with GeekTool 3.0.3
Look at http://docs.python.org/howto/unicode.html