DrTrigon has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/97356


Change subject: work-a-round; for "MaxTriesExceededError" in catimages.py 
during debug info/log output
......................................................................

work-a-round; for "MaxTriesExceededError" in catimages.py during debug info/log 
output

Change-Id: I8d2b5dee5ea1ef80cb87ad765f92c51e59240475
---
M catimages.py
1 file changed, 15 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/compat 
refs/changes/56/97356/1

diff --git a/catimages.py b/catimages.py
index c751df5..e91084f 100644
--- a/catimages.py
+++ b/catimages.py
@@ -4411,15 +4411,21 @@
         # "HTTPError: 504 Gateway Time-out" leading finally to 
"MaxTriesExceededError"
         # (why is that...?!?? FIX THIS in the framework core e.g. 'postForm'!)
         tmp = outresult
-        while tmp:
-            i = np.array([m.start() for m in re.finditer(u"\n\n==", tmp)] +
-                         [len(tmp)])
-            pos = i[np.where((i - 500 * 1024) <= 0)[0][-1]]
-            pywikibot.output(u"Size of bunch to write: %s byte(s)"
-                             % len(tmp[:pos]))
-            outpage.put(tmp[:pos], comment="bot writing log for last run")
-            tmp = tmp[pos:]
-        if pywikibot.simulate:
+        ### BUG 57495: "MaxTriesExceededError" in catimages.py during debug 
info/log output
+        ### ('try ... except' has to be considered just a work-a-round)
+        try:
+            while tmp:
+                i = np.array([m.start() for m in re.finditer(u"\n\n==", tmp)] +
+                             [len(tmp)])
+                pos = i[np.where((i - 500 * 1024) <= 0)[0][-1]]
+                pywikibot.output(u"Size of bunch to write: %s byte(s)"
+                                 % len(tmp[:pos]))
+                outpage.put(tmp[:pos], comment="bot writing log for last run")
+                tmp = tmp[pos:]
+        except pywikibot.MaxTriesExceededError:
+            pywikibot.exception()
+            pywikibot.output(u"Problem writing debug info to wiki, using file 
instead.")
+        if pywikibot.simulate or tmp:
             #print u"--- " * 20
             #print u"--- " * 20
             #print outresult

-- 
To view, visit https://gerrit.wikimedia.org/r/97356
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8d2b5dee5ea1ef80cb87ad765f92c51e59240475
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: DrTrigon <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to