View Single Post
Old 11-25-2012, 04:43 PM   #1
anthonyliu
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:
Code:
#!/usr/bin/env  python

__license__   = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
'''
economist.com
'''
from calibre.web.feeds.news 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:
Quote:
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\user_profiles.py", line 268, in add_profile
File "site-packages\calibre\gui2\dialogs\user_profiles.py", line 64, in add
File "site-packages\calibre\web\feeds\recipes\model.py", line 175, in add_custom_recipe
File "site-packages\calibre\web\feeds\recipes\collection.py", line 155, in add_custom_recipe
File "site-packages\calibre\utils\config.py", line 388, in __setitem__
File "site-packages\calibre\utils\config.py", line 333, in commit
File "site-packages\calibre\utils\config.py", line 372, in to_raw
File "json\__init__.py", line 238, in dumps
File "json\encoder.py", line 203, in encode
File "json\encoder.py", line 428, in _iterencode
File "json\encoder.py", line 402, in _iterencode_dict
File "json\encoder.py", 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