Bugs item #2853381, was opened at 2009-09-07 06:56 Message generated for change (Settings changed) made by filnik You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2853381...
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: xqt (xqt)
Assigned to: Filnik (filnik)
Summary: isbn.py: index error
Initial Comment: isbn.py r6798 2009-05-03
Working on http://tr.wikipedia.org/w/index.php?title=Ahmed_Alevi&oldid=5823201 the following error raises:
File "C:\Programme\Python25\pywikipedia\isbn.py", line 1357, in hyphenateIsbnNumbers text = isbnR.sub(_hyphenateIsbnNumber, text) File "C:\Programme\Python25\pywikipedia\isbn.py", line 1352, in _hyphenateIsbnNumber i.format() File "C:\Programme\Python25\pywikipedia\isbn.py", line 1228, in format result += rest[:-1] + '-' + rest[-1] IndexError: string index out of range
This error comes trying formatting 'ISBN 978-9799668806'
----------------------------------------------------------------------
Comment By: Filnik (filnik)
Date: 2009-09-07 09:23
Message: Fixed in revision: 7218. Patch applied
----------------------------------------------------------------------
Comment By: xqt (xqt) Date: 2009-09-07 07:37
Message: I found the reson for this stuff and added a patch file:
ISBN 9799799668806 starts with both prefixes but it should stop the loop if it the first one has been found.
A break in line 1208 would do the job:
# Determine the prefix (if any) for prefix in self.possiblePrefixes(): if rest.startswith(prefix): result += prefix + '-' rest = rest[len(prefix):] break
----------------------------------------------------------------------
Comment By: xqt (xqt) Date: 2009-09-07 07:02
Message: I found the result-variable is 'ISBN 978-979-966-8806-' just before trying to add the check digit. Since the ISBN code has 13 digits it could not add the 14th.
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2853381...