https://bugzilla.wikimedia.org/show_bug.cgi?id=55170
Web browser: --- Bug ID: 55170 Summary: trunk 10450 not py2.6 compatible Product: Pywikibot Version: unspecified Hardware: All OS: All Status: NEW Severity: normal Priority: Unprioritized Component: General Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: legoktm.wikipedia@gmail.com Classification: Unclassified Mobile Platform: ---
Originally from: http://sourceforge.net/p/pywikipediabot/bugs/1519/ Reported by: drtrigon Created on: 2012-10-09 15:08:56 Subject: trunk 10450 not py2.6 compatible Original description: Hello all!
As Merlijn suggested at [1] I should also report this here too. I would solve it myself but a quick shot does not seam appropriate.
[1] https://jira.toolserver.org/browse/TS-1466
Python code using: >>> import re >>> re.sub(..., flags=...)
does not work in python 2.6 because the optional parameter 'flags' was introduced in python 2.7. As Merlijn noted, this should be replaced by >>> re.compile(..., flags=...).sub(...)
A fast 'grep "flags" *' in my pywikipedia directory of revision 10450, yields at least following matches:
imagecopy_self.py: match = re.search(regex, text, flags=re.IGNORECASE) imagecopy_self.py: contents[u'permission'] = re.sub(regex, u'', contents[u'permission'], flags=re.IGNORECASE) imagecopy_self.py: text = re.sub(toRemove, u'', text, flags=re.IGNORECASE) imagecopy_self.py: text = re.sub(regex, u'', text, flags=re.IGNORECASE) imagecopy_self.py: match = re.search(regex, text, flags=re.IGNORECASE) imagecopy_self.py: result = re.sub(regex, replacement, match.group(0), flags=re.IGNORECASE)
...so there are at least 4 problematic cases which should be changed. I am not aware if a similar issues exists with 're.search'.
Thanks and greetings