View Single Post
Old 06-02-2019, 07:13 AM   #1
siebert
Developer
siebert has a complete set of Star Wars action figures.siebert has a complete set of Star Wars action figures.siebert has a complete set of Star Wars action figures.
 
Posts: 155
Karma: 280
Join Date: Nov 2010
Device: Kindle 3 (Keyboard) 3G / iPad 9 WiFi / Google Pixel 6a (Android)
Receipe with raw string literal fails in calibre 3.44

Hi,

after the update from 3.39.1 to 3.44 I noticed that one of my recipes failed to load.

The reason is that the recipe contains a windows path stored as a raw string literal, e.g. r"C:\Users\foo\Dropbox"

I can work around the bug by using "C:\\Users\\foo\\Dropbox" instead, but as this is a regression I think it should be fixed in Calibre instead.

Here is a small bogus recipe which shows this issue when loaded in Calibre 3.44 (32bit Windows version):

Code:
from calibre.web.feeds.news import AutomaticNewsRecipe


OUPUT_PATH = r"C:\Users\foo\Dropbox"

class BasicUserRecipe(AutomaticNewsRecipe):
    title = u'Test based on Planet Python'
    language = 'en'
    __author__ = 'Jelle van der Waa'
    oldest_article = 10
    max_articles_per_feed = 100
    feeds = [(u'Planet Python', u'http://planetpython.org/rss20.xml')]
The error reported by Calibre is:

Code:
calibre, version 3.44.0
ERROR: Invalid recipe: Failed to compile the recipe, with syntax error: (unicode error) 'rawunicodeescape' codec can't decode bytes in position 2-3: truncated \uXXXX (<string>, line 4)
siebert is offline   Reply With Quote