diff options
author | ssstvinc2 <sstvinc2@gmail.com> | 2017-02-12 11:24:31 -0500 |
---|---|---|
committer | ssstvinc2 <sstvinc2@gmail.com> | 2017-02-12 11:24:31 -0500 |
commit | 4dbd1edf115b04a9b149d46595753543ef7d6e23 (patch) | |
tree | daa71fd8483c6f7223d224845166c024688d2a8a | |
parent | a39b48265eb4d241c6c920a10661efeb9830db39 (diff) |
Bug fix for try/except error catching
-rw-r--r-- | unbiasedFunctions.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/unbiasedFunctions.py b/unbiasedFunctions.py index 8caa919..e7ba4b4 100644 --- a/unbiasedFunctions.py +++ b/unbiasedFunctions.py @@ -184,7 +184,9 @@ def printOutputHTML(outputHTML, outFile): def buildNewsSourceArr(sourceList):
#build the data structure
- for i in range(len(sourceList)):
+ i=0
+ listLen=len(sourceList)
+ while i < listLen:
source=sourceList[i]
url=source.url
@@ -213,9 +215,12 @@ def buildNewsSourceArr(sourceList): for url in h3s:
article=buildArticle(url, source.name)
sourceList[i].h3Arr.append(article)
+ i+=1
else:
sourceList.remove(source)
-
+ listLen-=1
+
+
#return the original sourceList,
#since everything should have been modified in place
return sourceList
|