Jean-Frédéric has uploaded a new change for review.
https://gerrit.wikimedia.org/r/237966
Change subject: Catch pywikibot.exceptions.Error when looking for categories
......................................................................
Catch pywikibot.exceptions.Error when looking for categories
This is a bit heavy handed, but will allow the bot to keep going
when choking on an image instead of dying.
Bug: T111921
Change-Id: Idf4ddcefbfd6e72e805a39022e423a2434ca7872
---
M erfgoedbot/categorize_images.py
1 file changed, 6 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/labs/tools/heritage
refs/changes/66/237966/1
diff --git a/erfgoedbot/categorize_images.py b/erfgoedbot/categorize_images.py
index c6d4d13..467768c 100644
--- a/erfgoedbot/categorize_images.py
+++ b/erfgoedbot/categorize_images.py
@@ -294,6 +294,8 @@
(monumentArticle.title(),))
except pywikibot.exceptions.InvalidTitle:
pywikibot.output(u'Incorrect article title %s' %
(monumentArticleTitle,))
+ except pywikibot.exceptions.Error as e:
+ pywikibot.output(u'Error occured with monument %s: %s' %
(monumentId, str(e)))
# Option three is to see if the list contains Commonscat links (whole list)
if not newcats:
monumentList = getList(lang, monumentSource)
@@ -302,7 +304,10 @@
return False
if monumentList.isRedirectPage():
monumentList = monumentList.getRedirectTarget()
- newcats = getCategories(monumentList, commonsCatTemplates)
+ try:
+ newcats = getCategories(monumentList, commonsCatTemplates)
+ except pywikibot.exceptions.Error as e:
+ pywikibot.output(u'Error occured with monument %s: %s' %
(monumentId, str(e)))
return newcats
--
To view, visit https://gerrit.wikimedia.org/r/237966
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idf4ddcefbfd6e72e805a39022e423a2434ca7872
Gerrit-PatchSet: 1
Gerrit-Project: labs/tools/heritage
Gerrit-Branch: master
Gerrit-Owner: Jean-Frédéric <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits