[Pywikipedia-l] [ pywikipediabot-Patches-2762697 ] Stability in wikipedia.py
SourceForge.net
noreply at sourceforge.net
Tue Apr 14 18:17:14 UTC 2009
Patches item #2762697, was opened at 2009-04-14 20:14
Message generated for change (Comment added) made by nicdumz
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=2762697&group_id=93107
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: 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&group_id=93107
More information about the Pywikipedia-l
mailing list