Bugs item #1672346, was opened at 2007-03-02 03:33 Message generated for change (Comment added) made by nobody You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1672346...
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: Closed Resolution: Fixed Priority: 5 Private: No Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: uncaught socket.error exception
Initial Comment: I got an uncaught socket error in one of my scripts today:
Traceback (most recent call last): File "./replace-link.py", line 256, in ? page.put(changedict[title], summ) File "wikipedia.py", line 981, in put return self.putPage(newtext, comment, watchArticle, minorEdit, newPage, self.site().getToken(sysop = sysop), sysop = sysop) File "wikipedia.py", line 1049, in putPage response, data = self.site().postForm(address, predata, sysop = sysop) File "wikipedia.py", line 2673, in postForm return self.postData(address, data, sysop = sysop) File "wikipedia.py", line 2696, in postData conn.endheaders() File "/usr/lib/python2.4/httplib.py", line 798, in endheaders self._send_output() File "/usr/lib/python2.4/httplib.py", line 679, in _send_output self.send(msg) File "/usr/lib/python2.4/httplib.py", line 646, in send self.connect() File "/usr/lib/python2.4/httplib.py", line 630, in connect raise socket.error, msg socket.error: (110, 'Connection timed out')
Since all that socket juggling is private to wikipedia.py, I suggest that this exception be caught and re-raised as a wikipedia.Error.
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody) Date: 2007-08-24 01:08
Message: Logged In: NO
Thank you very much! Sorry I was so disgruntled in my last post. I really appreciate all the hard work you put into making this flexible framework.
----------------------------------------------------------------------
Comment By: Merlijn S. van Deen (valhallasw) Date: 2007-08-23 09:01
Message: Logged In: YES user_id=687283 Originator: NO
Fixed in r4099 (socked.error is caught in postForm)
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody) Date: 2007-08-23 07:44
Message: Logged In: NO
As of SVN revision 4096, socket errors from wikipedia.py:3174-3176 are not caught (the comment just before these lines even makes note of this fact).
I suggest
response = conn.getresponse() data = response.read().decode(self.encoding()) conn.close()
be changed to
try: response = conn.getresponse() data = response.read().decode(self.encoding()) conn.close() except socket.error, errmsg: raise ServerError(errmsg)
It's really annoying to have a longer bot job that is aware of wikipedia.Error crash because of an intermittent "Connection reset by peer".
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1672346...
pywikipedia-l@lists.wikimedia.org