Bugs item #1932907, was opened at 2008-04-03 06:16 Message generated for change (Comment added) made by nicdumz You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1932907...
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: General Group: None Status: Closed Resolution: Fixed Priority: 5 Private: No Submitted By: Mikko Silvonen (silvonen) Assigned to: Nobody/Anonymous (nobody) Summary: sre_constants.error in wikipedia.py called from interwiki.py
Initial Comment: I got this error when running interwiki.py r5177 in autonomous mode. I use Python 2.5.
======Post-processing [[fi:Yorkshirenterrieri]]====== Updating links on page [[lt:Jorkšyro terjeras]]. Changes to be made: Pridedama: [[ko:??????]] + [[ko:??????]]
NOTE: Performing a recursive query first to save time.... NOTE: Nothing left to do 2 NOTE: Updating live wiki... Sleeping for 26.7 seconds, 2008-04-03 06:57:31 Changing page [[lt:Jorkšyro terjeras]] Dump fi (wikipedia) saved Traceback (most recent call last): File "C:\svn\pywikipedia\interwiki.py", line 1645, in <module> bot.run() File "C:\svn\pywikipedia\interwiki.py", line 1409, in run self.queryStep() File "C:\svn\pywikipedia\interwiki.py", line 1388, in queryStep subj.finish(self) File "C:\svn\pywikipedia\interwiki.py", line 976, in finish if self.replaceLinks(page, new, bot): File "C:\svn\pywikipedia\interwiki.py", line 1127, in replaceLinks status, reason, data = page.put(newtext, comment = wikipedia.translate(page.site().lang, msg)[0] + mods) File "C:\svn\pywikipedia\wikipedia.py", line 1210, in put return self._putPage(newtext, comment, watchArticle, minorEdit, newPage, self.site().getToken(sysop = sysop), sysop = sysop) File "C:\svn\pywikipedia\wikipedia.py", line 1366, in _putPage ).replace("$1", "(?P<length>[\d,. ]+)").replace("$2", "(?P<limit>[\d,. ]+)") File "C:\Python25\lib\re.py", line 180, in compile return _compile(pattern, flags) File "C:\Python25\lib\re.py", line 233, in _compile raise error, v # invalid expression sre_constants.error: redefinition of group name u'length' as group 2; was group 1
----------------------------------------------------------------------
Comment By: NicDumZ — Nicolas Dumazet (nicdumz) Date: 2008-04-05 23:52
Message: Logged In: YES user_id=1963242 Originator: NO
I still see some problems. If the message only contains $1 or $2 in {{plural}}, the information is lost.
But actually, is there is a valid reason to spend so much time trying to figure out what are the values of 'length' and 'limit' ? Does the user need it ?
----------------------------------------------------------------------
Comment By: Francesco Cosoleto (cosoleto) Date: 2008-04-05 23:10
Message: Logged In: YES user_id=181280 Originator: NO
Well... The sre_constants.error fixed in r5180 and in r5181. The long page error detection wasn't still working with Lithuanian Wikipedia until it's improved in r5182.
----------------------------------------------------------------------
Comment By: NicDumZ — Nicolas Dumazet (nicdumz) Date: 2008-04-05 17:12
Message: Logged In: YES user_id=1963242 Originator: NO
Well, siebrand reported the error from [[sq:]] where the message is "<strong>GABIM: Tesksti që ju po e redaktoni është $1 kilobytes i gjatë dhe është më i gjatë se maksimumi i lejuar prej $1 kilobytes. Ndryshimet nuk mund të ruhen.</strong>"
It might be a localization error, and will be fixed soon, but still, we need to prevent this on our side too :)
----------------------------------------------------------------------
Comment By: Francesco Cosoleto (cosoleto) Date: 2008-04-05 16:51
Message: Logged In: YES user_id=181280 Originator: NO
Yes, thank you. I have seen the problem, soon fixed. Please, let me know others wiki sites where error occurs.
----------------------------------------------------------------------
Comment By: NicDumZ — Nicolas Dumazet (nicdumz) Date: 2008-04-05 16:34
Message: Logged In: YES user_id=1963242 Originator: NO
Siebrand reported on IRC the same error in r5179, that's why I asked for r5180 to be committed.
I really don't see how r5179 could have fixed the bug, cosoleto. The error explains that the RE group 'length' was being there twice, which means that $1 was present in the error messages several times.
1) About our bug, aren't replace(" $1", "(?P<length>[\d,. ]+)") and replace("$1", "(?P<length>[\d,. ]+)") the same ? Spaces are being captured inside the length group, so replacing "$1" by " $1" is the same for the debugging part: But actually, I see some problems with this fix because you assume that every $1 is being preceded by a space, which is wrong. Some wikis could use {{longpageerror|$1}} for instance, and your r5179 fix would break the detection. 2) When several $1 are being here, your r5181 fix is also wrong. Sure, adding the count parameter prevents a RE error, but it will let the second "$1" unchanged. Meaning that the regex will be "(?P<length>[\d,. ]+)Kb blablah Too big :$1/(?P<limit>[\d,. ]+)" it won't match the error message "2000Kb blablah Too big :2000/1500". That's why I changed it to be "(?P<length>[\d,. ]+)Kb blablah Too big :.*/(?P<limit>[\d,. ]+)" 3) And now that I think of this, we need to re.escape() the message. A longpage message including regex special chars could be harmful.
----------------------------------------------------------------------
Comment By: Francesco Cosoleto (cosoleto) Date: 2008-04-03 14:51
Message: Logged In: YES user_id=181280 Originator: NO
For a strange reason lt.wiki use {{plural}} in [[MediaWiki:longpageerror]], so new long page error detection fail. Fixed in r5179.
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1932907...
pywikipedia-l@lists.wikimedia.org