[Pywikipedia-l] [ pywikipediabot-Bugs-1908157 ] Cannot edit large page in Python 2.5

SourceForge.net noreply at sourceforge.net
Tue Apr 14 16:25:45 UTC 2009


Bugs item #1908157, was opened at 2008-03-05 18:08
Message generated for change (Comment added) made by nicdumz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1908157&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: Closed
>Resolution: Wont Fix
Priority: 7
Private: No
Submitted By: AndreasJS (andreasjs)
Assigned to: Nobody/Anonymous (nobody)
Summary: Cannot edit large page in Python 2.5

Initial Comment:
Cannot edit large page in Python 2.5.
A socket error 35 occurs.  It consistently occurs if the page is > about 30 kbyte. 

Woks OK in python 2.3.

andreas-schwabs-computer:~/Desktop/pywikipedia andreas$ python basic.py -family:wikipedia -lang:en -page:User:AndreasJS/test
Checked for running processes. 1 processes currently running, including the current process.
Getting 1 pages from wikipedia:en...


>>> User:AndreasJS/test <<<
- Test Test [[image:Wikipedia.png|thumb|This is the [[logo]] of Wikinews]]
+ Test Test Test [[image:Wikipedia.png|thumb|This is the [[logo]] of Wikinews]]

Do you want to accept these changes? ([y]es, [N]o) y
Sleeping for 5.6 seconds, 2008-03-05 11:57:19
Changing page [[en:User:AndreasJS/test]]
Traceback (most recent call last):
  File "/Users/andreas/Desktop/pywikipedia/wikipedia.py", line 1287, in _putPage
    response, data = self.site().postForm(address, predata, sysop)
  File "/Users/andreas/Desktop/pywikipedia/wikipedia.py", line 4014, in postForm
    raise ServerError(e)
ServerError: (35, 'Resource temporarily unavailable')

Got a server error when putting [[User:AndreasJS/test]]; will retry in 1 minute.
Changing page [[en:User:AndreasJS/test]]
Traceback (most recent call last):
  File "/Users/andreas/Desktop/pywikipedia/wikipedia.py", line 1287, in _putPage
    response, data = self.site().postForm(address, predata, sysop)
  File "/Users/andreas/Desktop/pywikipedia/wikipedia.py", line 4014, in postForm
    raise ServerError(e)
ServerError: (35, 'Resource temporarily unavailable')

Got a server error when putting [[User:AndreasJS/test]]; will retry in 2 minutes.
Changing page [[en:User:AndreasJS/test]]
Traceback (most recent call last):
  File "/Users/andreas/Desktop/pywikipedia/wikipedia.py", line 1287, in _putPage
    response, data = self.site().postForm(address, predata, sysop)
  File "/Users/andreas/Desktop/pywikipedia/wikipedia.py", line 4014, in postForm
    raise ServerError(e)
ServerError: (35, 'Resource temporarily unavailable')

Got a server error when putting [[User:AndreasJS/test]]; will retry in 4 minutes.

----------

andreas-schwabs-computer:~/Desktop/pywikipedia andreas$ python
Python 2.5 (r25:51918, Sep 19 2006, 08:49:13) 
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin


System Software Overview:

  System Version:	Mac OS X 10.4.11 (8S2167)
  Kernel Version:	Darwin 8.11.1
  Boot Volume:	Macintosh HD
  Computer Name:	Andreas Schwab’s Computer
  User Name:	Andreas Schwab (andreas)




----------------------------------------------------------------------

>Comment By: NicDumZ — Nicolas Dumazet (nicdumz)
Date: 2009-04-14 18:25

Message:
1) using socket_timeout = None in your user-config.py should "fix" the
issue on pywikipedia. 
") If you want to fix more durably the issue, please follow the
instructions on the last post of http://www.cherrypy.org/ticket/598
(bottom). It involves customizing the Python build under MacOS to avoid
defining the HAVE_POLL constant.
3) The fix applied by cherrypy here (
http://www.cherrypy.org/changeset/1915 ) is not applicable for pywikipedia:
they basically re-implement a complete new socket file descriptors to use
non-blocking socket calls, to avoid calling the broken poll() of MacOS.
Clearly, we're not going to do this here

I'm closing this as Wont Fix because it is a python+MacOS issue, and that
fixing the issue on the Python side is more relevant than implement complex
structures in pywikipedia to overcome that Python issue.

Comments are left open purposely.

----------------------------------------------------------------------

Comment By: Francesco Cosoleto (cosoleto)
Date: 2009-04-10 00:35

Message:
What about latest Python version (2.6.1)?

Doesn't look as reported to Python issue tracker, though.

----------------------------------------------------------------------

Comment By: Pietrodn (pietrodn)
Date: 2008-04-18 17:29

Message:
Logged In: YES 
user_id=1887175
Originator: NO

I have the same problem (and use Mac OS X 10.5.2).

----------------------------------------------------------------------

Comment By: AndreasJS (andreasjs)
Date: 2008-03-10 02:15

Message:
Logged In: YES 
user_id=1738850
Originator: YES

There is a much easier solution:
Add the following line to user-config.py:

socket_timeout = None

Note: Apparently, the socket timeout is broken in the combination python
2.5 and MacOS 10.4. If socket_timeout is set to any number, error 35 occurs
when putting pages larger than ca. 30 kb.

----------------------------------------------------------------------

Comment By: AndreasJS (andreasjs)
Date: 2008-03-10 00:27

Message:
Logged In: YES 
user_id=1738850
Originator: YES

After reading the following thread:

http://www.cherrypy.org/ticket/598

I came up with the following solution:

        conn.endheaders()
        if hasattr(conn.sock, 'setblocking'): #####
            conn.sock.setblocking(1) ######
        conn.send(data)

I am not 100% sure if this is safe, but maybe someone socket-savvy can
find out by reading the above thread.





----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2008-03-08 23:19

Message:
Logged In: NO 

Sitll doesn't work:

Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53) 
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin

----------------------------------------------------------------------

Comment By: Merlijn S. van Deen (valhallasw)
Date: 2008-03-08 21:53

Message:
Logged In: YES 
user_id=687283
Originator: NO

This probably is a bug in an updated version of urllib2 in python2.5+.
Could you try updating your python install and see if the problem remains?

----------------------------------------------------------------------

Comment By: Pietrodn (pietrodn)
Date: 2008-03-05 21:51

Message:
Logged In: YES 
user_id=1887175
Originator: NO

I also have Mac OS X 10.4.11 + Python 2.5 and have the same problem.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1908157&group_id=93107



More information about the Pywikipedia-l mailing list