Last modified: 2014-09-18 07:43:20 UTC
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
This ist still a fix-me of python release change r8814 which was done to fix another regex bug. mybe we had to create version dependant code :-\(