Either always consider the unicode
content or remove the unicode
content entirely. The error is occurring because you (or some library methods you're using) are trying to convert utf-8
content into ascii without ignoring the errors.
# Ignore unicode content
content_string = content_string.encode('ascii', 'ignore')
# Or make sure you handle unicode content as such. It would have been
# easier if you're using Python3x.
The purpose of # -- coding: utf-8 --
is to allow explicitly adding Unicode content into a python code file, and not to set the default encoding.
# -- coding: utf-8 --
book_name = 'Les Misérables'