Patches item #2762697, was opened at 2009-04-14 20:14 Message generated for change (Comment added) made by drtrigon You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603140&aid=2762697...
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Dr. Trigon (drtrigon) Assigned to: Nobody/Anonymous (nobody) Summary: Stability in wikipedia.py
Initial Comment: Recently I've had some problems with the stability of 'wikipedia.put(...)' sometimes this method had some issues and that killed my bot. I was able to track the problem down to 'wikipedia._getEditPage(...)' and following code (in 'wikipedia.py' around line 725):
******************************** while not textareaFound: text = self.site().getUrl(path, sysop = sysop)
if text.find("<title>Wiki does not exist</title>") != -1: raise NoSuchSite(u'Wiki %s does not exist yet' % self.site()) ********************************
and I have changed it that way, to hold my bot/script running:
******************************** while not textareaFound: try: text = self.site().getUrl(path, sysop = sysop) except: time.sleep(1) continue
if text.find("<title>Wiki does not exist</title>") != -1: raise NoSuchSite(u'Wiki %s does not exist yet' % self.site()) ********************************
and I am "pretty" sure that this solved my problem. :)
Probably you are also intressted in this solution?! I would assume that the delay of 1sec is neither critical nor needed.
Greetings DrTrigon
----------------------------------------------------------------------
Comment By: Dr. Trigon (drtrigon) Date: 2009-04-16 20:46
Message: here is the error:
(<class 'socket.error'>, error(104, 'Connection reset by peer'), <traceback object at 0x3595248>)
hope this helps you...?!
greetings
----------------------------------------------------------------------
Comment By: Dr. Trigon (drtrigon) Date: 2009-04-15 11:21
Message: ...I could add some code to print the exception the next time, my bot is down...?!
----------------------------------------------------------------------
Comment By: Dr. Trigon (drtrigon) Date: 2009-04-15 11:19
Message: Hello back!
I have to apologize because I don't have the error message anymore (I had it once...) and the error is a bit hard to reproduce, since it is not thrown very often... :( You are right; my solution is a kind of "brute-force"... :) Yesterday, after my first postings, I had a look into 'getUrl', since I was remembering that it should catch (and did this in the past accordingly) such kind of problems. What was strange; the error I had occurred instantaneously after calling 'getUrl', without any time delay... And it was (most of the time) on the toolserver, which might have another kind of internet connection and therefore another failure behaviour (and throw other exceptions)...?!
----------------------------------------------------------------------
Comment By: NicDumZ — Nicolas Dumazet (nicdumz) Date: 2009-04-14 20:17
Message: Hello !
Are you able to elaborate on what error was raised? There is probably a nicer way to catch the error, at a lower level, instead of bluntly retrying on error =)
----------------------------------------------------------------------
Comment By: Dr. Trigon (drtrigon) Date: 2009-04-14 20:15
Message: Sorry was NOT 'wikipedia.put(...)' was 'wikipedia.get(...)' !
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603140&aid=2762697...