diff options
| author | Michele Calgaro <michele.calgaro@yahoo.it> | 2023-01-14 16:34:44 +0900 | 
|---|---|---|
| committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2023-01-15 10:25:12 +0900 | 
| commit | 900386ad4615a3dbbc04501ef24c5a43385c6078 (patch) | |
| tree | e7c547f76f2100bd99be8962fe7a07c1a64d1c34 /knewsticker-scripts/sportscores.py | |
| parent | 8293cbe18989cabc30375754087091a53a78b3ee (diff) | |
| download | tdeaddons-900386ad.tar.gz tdeaddons-900386ad.zip | |
Drop python2 support.r14.1.0
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'knewsticker-scripts/sportscores.py')
| -rwxr-xr-x | knewsticker-scripts/sportscores.py | 34 | 
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) | 
