The error is most likely in the part of your code where you compute the whole sync. I had the same issue as well but then I realized I had written a condition wrong and that I left some random numbers in it.
I'd suggest you to check:
- if you opened your file in the right encoding, "encoding = utf - 8"
- if you added all the cba / cab values correctly
- if you considered all the conditions possible while you search for the preceding accents ( this is what used to give me error)