2016-07-25, 14:21
I think I have pretty much worked out where things are happening.
In default.py at lines 491-526 this happens:
491 log("Download the radar loop")
492 image = urllib.URLopener()
493 files = []
494
495 log("Log in to BOM FTP")
496 ftp = ftplib.FTP("ftp.bom.gov.au")
497 ftp.login("anonymous", "anonymous@anonymous.org")
498 ftp.cwd("/anon/gen/radar/")
499
500 log("Get files list")
501 #connected, so let's get the list
502 try:
503 files = ftp.nlst()
504 except ftplib.error_perm, resp:
505 if str(resp) == "550 No files found":
506 log("No files in BOM ftp directory!")
507 else:
508 log("Something wrong in the ftp bit of radar images")
509
510 log("Download the files...")
511 #ok now we need just the matching radar files...
512 loopPicNames = []
513 for f in files:
514 if radarCode in f:
515 loopPicNames.append(f)
516
517 #download the actual images, might as well get the longest loop they have
518 for f in loopPicNames:
519 #ignore the composite gif...
520 if f[-3:] == "png":
521 imageToRetrieve = "ftp://anonymous:someone%[email protected]//anon/gen/radar/" + f
522 log("Retrieving radar image: " + imageToRetrieve)
523 try:
524 image.retrieve(imageToRetrieve, LOOP_IMAGES_PATH + "/" + f )
525 except Exception as inst:
526 log("Failed to retrieve radar image: " + imageToRetrieve + ", oh well never mind!", inst )
except that it looks as if the loop 518-526 is only happening once because only one file (the oldest) is retrieved.
I've tried a wget to simulate 500-508 and I get a full list of files, and there are 11 that are relevant to my particular radar
OK, progress.
I turned on logging and lo behold:
22:05:30 T:140010405742336 DEBUG: ### Oz Weather - 0.8.1 ### Download the files...
22:05:30 T:140010405742336 DEBUG: ### Oz Weather - 0.8.1 ### Retrieving radar image: ftp://anonymous:someone%[email protected]//anon/g
en/radar/IDR492.T.201607251000.png
22:05:30 T:140010405742336 DEBUG: ### Oz Weather - 0.8.1 ### Retrieving radar image: ftp://anonymous:someone%[email protected]//anon/g
en/radar/IDR492.T.201607251010.png
22:05:30 T:140010405742336 DEBUG: ### Oz Weather - 0.8.1 ### Failed to retrieve radar image: ftp://anonymous:someone%[email protected]
//anon/gen/radar/IDR492.T.201607251010.png, oh well never mind!
22:05:30 T:140010405742336 DEBUG: ### Oz Weather-0.8.1 ### Exception:Traceback (most recent call last):
File "/home/howard/.kodi/addons/weather.ozweather/default.py", line 524, in buildImages
image.retrieve(imageToRetrieve, LOOP_IMAGES_PATH + "/" + f )
File "/usr/lib/python2.7/urllib.py", line 245, in retrieve
fp = self.open(url, data)
File "/usr/lib/python2.7/urllib.py", line 213, in open
return getattr(self, name)(url)
File "/usr/lib/python2.7/urllib.py", line 558, in open_ftp
(fp, retrlen) = self.ftpcache[key].retrfile(file, type)
File "/usr/lib/python2.7/urllib.py", line 906, in retrfile
conn, retrlen = self.ftp.ntransfercmd(cmd)
File "/usr/lib/python2.7/ftplib.py", line 334, in ntransfercmd
host, port = self.makepasv()
File "/usr/lib/python2.7/ftplib.py", line 312, in makepasv
host, port = parse227(self.sendcmd('PASV'))
File "/usr/lib/python2.7/ftplib.py", line 830, in parse227
raise error_reply, resp
IOError: [Errno ftp error] 200 Switching to Binary mode.
22:05:30 T:140010405742336 DEBUG: ### Oz Weather - 0.8.1 ### Retrieving radar image: ftp://anonymous:someone%[email protected]//anon/g
en/radar/IDR492.T.201607251020.png
22:05:31 T:140010405742336 DEBUG: ### Oz Weather - 0.8.1 ### Failed to retrieve radar image: ftp://anonymous:someone%[email protected]
//anon/gen/radar/IDR492.T.201607251020.png, oh well never mind!
It's getting the first image and then barfing on the subsequent images.
I'll keep digging unless others can provide pointers
TIA
In default.py at lines 491-526 this happens:
491 log("Download the radar loop")
492 image = urllib.URLopener()
493 files = []
494
495 log("Log in to BOM FTP")
496 ftp = ftplib.FTP("ftp.bom.gov.au")
497 ftp.login("anonymous", "anonymous@anonymous.org")
498 ftp.cwd("/anon/gen/radar/")
499
500 log("Get files list")
501 #connected, so let's get the list
502 try:
503 files = ftp.nlst()
504 except ftplib.error_perm, resp:
505 if str(resp) == "550 No files found":
506 log("No files in BOM ftp directory!")
507 else:
508 log("Something wrong in the ftp bit of radar images")
509
510 log("Download the files...")
511 #ok now we need just the matching radar files...
512 loopPicNames = []
513 for f in files:
514 if radarCode in f:
515 loopPicNames.append(f)
516
517 #download the actual images, might as well get the longest loop they have
518 for f in loopPicNames:
519 #ignore the composite gif...
520 if f[-3:] == "png":
521 imageToRetrieve = "ftp://anonymous:someone%[email protected]//anon/gen/radar/" + f
522 log("Retrieving radar image: " + imageToRetrieve)
523 try:
524 image.retrieve(imageToRetrieve, LOOP_IMAGES_PATH + "/" + f )
525 except Exception as inst:
526 log("Failed to retrieve radar image: " + imageToRetrieve + ", oh well never mind!", inst )
except that it looks as if the loop 518-526 is only happening once because only one file (the oldest) is retrieved.
I've tried a wget to simulate 500-508 and I get a full list of files, and there are 11 that are relevant to my particular radar
OK, progress.
I turned on logging and lo behold:
22:05:30 T:140010405742336 DEBUG: ### Oz Weather - 0.8.1 ### Download the files...
22:05:30 T:140010405742336 DEBUG: ### Oz Weather - 0.8.1 ### Retrieving radar image: ftp://anonymous:someone%[email protected]//anon/g
en/radar/IDR492.T.201607251000.png
22:05:30 T:140010405742336 DEBUG: ### Oz Weather - 0.8.1 ### Retrieving radar image: ftp://anonymous:someone%[email protected]//anon/g
en/radar/IDR492.T.201607251010.png
22:05:30 T:140010405742336 DEBUG: ### Oz Weather - 0.8.1 ### Failed to retrieve radar image: ftp://anonymous:someone%[email protected]
//anon/gen/radar/IDR492.T.201607251010.png, oh well never mind!
22:05:30 T:140010405742336 DEBUG: ### Oz Weather-0.8.1 ### Exception:Traceback (most recent call last):
File "/home/howard/.kodi/addons/weather.ozweather/default.py", line 524, in buildImages
image.retrieve(imageToRetrieve, LOOP_IMAGES_PATH + "/" + f )
File "/usr/lib/python2.7/urllib.py", line 245, in retrieve
fp = self.open(url, data)
File "/usr/lib/python2.7/urllib.py", line 213, in open
return getattr(self, name)(url)
File "/usr/lib/python2.7/urllib.py", line 558, in open_ftp
(fp, retrlen) = self.ftpcache[key].retrfile(file, type)
File "/usr/lib/python2.7/urllib.py", line 906, in retrfile
conn, retrlen = self.ftp.ntransfercmd(cmd)
File "/usr/lib/python2.7/ftplib.py", line 334, in ntransfercmd
host, port = self.makepasv()
File "/usr/lib/python2.7/ftplib.py", line 312, in makepasv
host, port = parse227(self.sendcmd('PASV'))
File "/usr/lib/python2.7/ftplib.py", line 830, in parse227
raise error_reply, resp
IOError: [Errno ftp error] 200 Switching to Binary mode.
22:05:30 T:140010405742336 DEBUG: ### Oz Weather - 0.8.1 ### Retrieving radar image: ftp://anonymous:someone%[email protected]//anon/g
en/radar/IDR492.T.201607251020.png
22:05:31 T:140010405742336 DEBUG: ### Oz Weather - 0.8.1 ### Failed to retrieve radar image: ftp://anonymous:someone%[email protected]
//anon/gen/radar/IDR492.T.201607251020.png, oh well never mind!
It's getting the first image and then barfing on the subsequent images.
I'll keep digging unless others can provide pointers
TIA