View Single Post
Old 11-25-2012, 04:43 PM   #1
Junior Member
anthonyliu began at the beginning.
Posts: 5
Karma: 10
Join Date: Oct 2012
Device: Kindle
Error when adding date to titles in recipes

Hi! I am a complete newbie, so please bear with me if I am making any silly mistakes.

I am trying to customize the built-in recipes by adding the date to the title. By following the instructions in the Calibre manual, I added "import time" and put " + time.strftime('%d %b %Y')" in the title line (these are the only changes I made to the recipe).

So the recipe looks something like this:
#!/usr/bin/env  python

__license__   = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at>'
from import BasicNewsRecipe
from calibre.ebooks.BeautifulSoup import Tag, NavigableString
from collections import OrderedDict

import time, re

class Economist(BasicNewsRecipe):

    title = 'The Economist' + time.strftime('%d %b %Y')
But when I hit the Add/Update Recipe botton, I got the following error message:
calibre, version 0.9.7
ERROR: Unhandled exception: <b>UnicodeDecodeError</b>:'utf8' codec can't decode byte 0xd4 in position 20: invalid continuation byte

Traceback (most recent call last):
File "site-packages\calibre\gui2\dialogs\", line 268, in add_profile
File "site-packages\calibre\gui2\dialogs\", line 64, in add
File "site-packages\calibre\web\feeds\recipes\", line 175, in add_custom_recipe
File "site-packages\calibre\web\feeds\recipes\", line 155, in add_custom_recipe
File "site-packages\calibre\utils\", line 388, in __setitem__
File "site-packages\calibre\utils\", line 333, in commit
File "site-packages\calibre\utils\", line 372, in to_raw
File "json\", line 238, in dumps
File "json\", line 203, in encode
File "json\", line 428, in _iterencode
File "json\", line 402, in _iterencode_dict
File "json\", line 307, in _iterencode_list
UnicodeDecodeError: 'utf8' codec can't decode byte 0xd4 in position 20: invalid continuation byte
I've been having this problem for months, and all your input and assistance will be very appreciated! Thank you!
anthonyliu is offline   Reply With Quote