summaryrefslogtreecommitdiffstats
path: root/knewsticker-scripts/sportscores.py
diff options
context:
space:
mode:
Diffstat (limited to 'knewsticker-scripts/sportscores.py')
-rwxr-xr-xknewsticker-scripts/sportscores.py34
1 files changed, 17 insertions, 17 deletions
diff --git a/knewsticker-scripts/sportscores.py b/knewsticker-scripts/sportscores.py
index ce9d04d..e9a33aa 100755
--- a/knewsticker-scripts/sportscores.py
+++ b/knewsticker-scripts/sportscores.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-import string, urllib, sys
+import string, urllib.request, urllib.parse, urllib.error, sys
if len(sys.argv) > 1:
sport = sys.argv[1]
@@ -8,21 +8,21 @@ else:
class SportsParser:
def __init__(self):
- print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>"
- print "<rdf:RDF"
- print "xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\""
- print "xmlns=\"http://my.netscape.com/rdf/simple/0.9/\">"
- print "<channel>"
- print "<title>%s</title>" %self.title()
- print "<description>%s</description>" %self.description()
- print "<link>%s</link>" %self.link()
- print "</channel>"
+ print("<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>")
+ print("<rdf:RDF")
+ print("xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"")
+ print("xmlns=\"http://my.netscape.com/rdf/simple/0.9/\">")
+ print("<channel>")
+ print("<title>%s</title>" %self.title())
+ print("<description>%s</description>" %self.description())
+ print("<link>%s</link>" %self.link())
+ print("</channel>")
self.processScores(self.inputFile())
- print "</rdf:RDF>"
+ print("</rdf:RDF>")
def processScores(self, inputFile):
try:
- input = urllib.urlopen(self.inputFile())
+ input = urllib.request.urlopen(self.inputFile())
lines = input.readlines()
except:
sys.exit(5)
@@ -32,10 +32,10 @@ class SportsParser:
self.handleScoreLine(line)
def handleGame(self, headline, link):
- print "<item>"
- print "<title>%s</title>" %headline
- print "<link>%s</link>" %link
- print "</item>"
+ print("<item>")
+ print("<title>%s</title>" %headline)
+ print("<link>%s</link>" %link)
+ print("</item>")
class NHLParser(SportsParser):
def isScoreLine(self, line):
@@ -235,7 +235,7 @@ try:
parser = globals()["%sParser" %(sport)]()
except:
- print "Invalid sport type '%s' selected." %sport
+ print("Invalid sport type '%s' selected." %sport)
sys.exit(2)
sys.exit(0)