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=193290…
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 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=193290…