pycodicefiscale icon indicating copy to clipboard operation
pycodicefiscale copied to clipboard

Error with apostrophes

Open fermo111 opened this issue 10 years ago • 1 comments

There is an error when the last name is 3 characters long and contains an apostrophe. E.g.: FO'

fermo111 avatar Sep 23 '15 14:09 fermo111

This is the error:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/codicefiscale.py", line 161, in build
    output = __surname_triplet(surname) + __name_triplet(name)
  File "/usr/lib/python2.7/dist-packages/codicefiscale.py", line 94, in __surnam
e_triplet
    return __common_triplet(input_string, consonants, vowels)
  File "/usr/lib/python2.7/dist-packages/codicefiscale.py", line 71, in __common
_triplet
    output += vowels.pop(0)
IndexError: pop from empty list

And also happens when the surname is just one character long.

(I will look into it more in detail in the next few days, and possibly propose a patch.)

valholl avatar Oct 22 '15 10:10 valholl