That's a great idea, and hopefully helps Chris.

2012/3/19 <xqt@svn.wikimedia.org>
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10028

Revision: 10028
Author:   xqt
Date:     2012-03-19 12:15:04 +0000 (Mon, 19 Mar 2012)
Log Message:
-----------
Debugging information for IndexError

Modified Paths:
--------------
   trunk/pywikipedia/pywikibot/textlib.py

Modified: trunk/pywikipedia/pywikibot/textlib.py
===================================================================
--- trunk/pywikipedia/pywikibot/textlib.py      2012-03-18 18:05:09 UTC (rev 10027)
+++ trunk/pywikipedia/pywikibot/textlib.py      2012-03-19 12:15:04 UTC (rev 10028)
@@ -172,9 +172,14 @@
                        break
                    groupID = groupMatch.group('name') or \
                              int(groupMatch.group('number'))
-                    replacement = replacement[:groupMatch.start()] + \
-                                  match.group(groupID) + \
-                                  replacement[groupMatch.end():]
+                    try:
+                        replacement = replacement[:groupMatch.start()] + \
+                                      match.group(groupID) + \
+                                      replacement[groupMatch.end():]
+                    except IndexError:
+                        print '\nInvalid group reference:', groupID
+                        print 'Groups found:\n' match.groups()
+                        raise IndexError
            text = text[:match.start()] + replacement + text[match.end():]

            # continue the search on the remaining text


_______________________________________________
Pywikipedia-svn mailing list
Pywikipedia-svn@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-svn



--
Bináris