Bugs item #2792959, was opened at 2009-05-17 15:00 Message generated for change (Comment added) made by chtitdraco You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2792959...
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: None Group: None Status: Closed Resolution: Fixed Priority: 5 Private: No Submitted By: Matthieu (chtitdraco) Assigned to: Nobody/Anonymous (nobody) Summary: IndexError: string index out of range
Initial Comment: Running interwiki.py on fr.wikiquote (possibly others too), I get this :
1 matth@matth-laptop:~/Programmes/pywikipedia$ python interwiki.py -start:! 2 NOTE: Number of pages queued is 0, trying to add 60 more. 3 TitleTranslate: 1984 was recognized as YearAD with value 1984 4 Skipping: Accueil is in the skip list 5 Getting 60 pages from wikiquote:fr... 6 Dump fr (wikiquote) saved 7 Traceback (most recent call last): 8 File "interwiki.py", line 2145, in <module> 9 bot.run() 10 File "interwiki.py", line 1865, in run 11 self.queryStep() 12 File "interwiki.py", line 1838, in queryStep 13 self.oneQuery() 14 File "interwiki.py", line 1834, in oneQuery 15 subject.batchLoaded(self) 16 File "interwiki.py", line 1120, in batchLoaded 17 (skip, alternativePage) = self.disambigMismatch(page, counter) 18 File "interwiki.py", line 965, in disambigMismatch 19 if self.originPage.isDisambig() and not page.isDisambig(): 20 File "/home/matth/Programmes/pywikipedia/wikipedia.py", line 1146, in isDisambig 21 for t in distl 22 File "/home/matth/Programmes/pywikipedia/wikipedia.py", line 1146, in <genexpr> 23 for t in distl 24 IndexError: string index out of range
Mmenal corrected it, it is due to the absence of a disambiguation template in the family file (families/wikiquote_family.py). The patch is attached.
----------------------------------------------------------------------
Comment By: Matthieu (chtitdraco) Date: 2009-05-17 18:10
Message: It is fixed since 6894, yes. :-)
Thanks for your help!
----------------------------------------------------------------------
Comment By: NicDumZ — Nicolas Dumazet (nicdumz) Date: 2009-05-17 18:08
Message: Hello, thanks for the report!
This was caused by the "t[0:].upper() + t[:1]" operation. This will crash if len(t) = 0 (but is okay for len(t) = 1, Python allows 'a'[1:]).
The patch surely "fixes" the issue by checking the length of the string, but it is better to check that no such invalid strings reach isDisambig in the first place: here, it was caused by the default wikiquote disambig template, which was set to '' (empty string). I removed it in r6894, issue should be fixed.
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2792959...