2-JULY-2011 UPDATE
conkyForecast has quit working in UbuOO (29-Jun build) and (reportedly) Debian Sid. Here is the fix...
Ubuntu Oneiric 11.10 / Debian Sid / conkyForecast Hack
Modify your conkyForecast.py file (UTF-8 Compatible Text Editor)
Code:
$ sudo gedit ../../usr/share/conkyforecast/conkyForecast.py
* Use spaces for indentation! Read SOURCE #3 (above) if you're new to Python.
Apply the wnelson hack
Code:
change Line 16
add import urllib above import urllib2
change Line 793
usock = urllib2.urlopen(url)
to
usock = urllib.urlopen(url)
change Line 1624
usock = urllib2.urlopen(url)
to
usock = urllib.urlopen(url)
Afterward, it should look like this...
Line 16 Hack
Code:
from datetime import datetime, timedelta, tzinfo
from optparse import OptionParser
from xml.dom import minidom
import sys
import os
import socket
import urllib
import urllib2
import gettext
import locale
import re
import codecs
import traceback
import time
Line 793 Hack
Code:
# obtain current conditions data from xoap service
try:
#url = "http://xoap.weather.com/weather/local/" + location + "?cc=*&dayf=10&link=xoap&prod=xoap&par=" + str(self.config.XOAP_PARTNER_ID) + "&key=" + self.config.XOAP_LICENCE_KEY + "&unit=m"
#url = "http://xoap.weather.com/weather/local/" + location + "?cc=*&dayf=10&link=xoap&par=" + str(self.config.XOAP_PARTNER_ID) + "&key=" + self.config.XOAP_LICENCE_KEY + "&unit=m"
#url = "http://xml.weather.com/weather/local/" + location + "?cc=*&unit=m&dayf=10&link=xoap&prod=xoap&par=" + str(self.config.XOAP_PARTNER_ID) + "&key=" + self.config.XOAP_LICENCE_KEY + "&unit=m"
url = self.config.BASE_XOAP_URL.replace("<LOCATION>",location).replace("<XOAP_PARTNER_ID>",str(self.config.XOAP_PARTNER_ID)).replace("<XOAP_LICENCE_KEY>",self.config.XOAP_LICENCE_KEY)
self.logInfo("Fetching weather data from " + url)
usock = urllib.urlopen(url)
# usock = urllib2.urlopen(url)
xml = usock.read()
usock.close()
Line 1624 Hack
Code:
def getImageSrcForWeatherMap(self, location):
imagesrc = ""
imgfilepath = ""
try:
url = "http://www.weather.com/outlook/travel/businesstraveler/map/" + location
self.logInfo("Fetching satellite image page from " + url)
usock = urllib.urlopen(url)
# usock = urllib2.urlopen(url)
html = usock.read()
Compile conkyForecast.py using the sparker256 method
Code:
$ cd /usr/share/conkyforecast
$ sudo python
>>> import py_compile
>>> py_compile.compile('conkyForecast.py')
Ctrl-D to get you out of Python
That's it...
Special thanks to Walt, Bill, Mark, and Paul!
And, remember the golden rule: Do Not Mix Tabs and Spaces in Python!
Bookmarks