View Single Post
Old 10-26-2011, 10:07 PM   #1
raijinfolly
Junior Member
raijinfolly began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Oct 2011
Device: Kindle
Issue with Recipe

This recipe was working a few weeks ago, but suddenly stopped. I thought I'd figured out the issue, but it still gives the same error every time I run it.

I know just enough Python to get myself in trouble, but I'm having issues debugging this issue deep enough to figure out what the issue is.

Code:
from calibre.web.feeds.recipes import BasicNewsRecipe
from calibre.web.feeds import Feed

import re

class PaizoWebFictionRecipe(BasicNewsRecipe):
  def get_feeds(self):
    feeds = []
    soup = self.index_to_soup('http://paizo.com/store/byCompany/p/paizoPublishingLLC/pathfinder/tales/serial')
    for alink in soup.findAll("span", {"class" : "productCategory"}):
      url = alink.a
      name = '{}'.format(url.string)
      if url.string != None:
        feeds.append((name, 'http://paizo.com' + url['href'] + '&xml=atom'))
    if not feeds:
      raise NotImplementedError
    return feeds
  
  title = u'Pathfinder Web Fiction v2.0.1'
  oldest_article = 1000000
  max_articles_per_feed = 10
  reverse_article_order = True
  cover_url = 'http://paizo.com/image/content/Logos/PathfinderTales_500.jpeg'
  remove_tags_after = [dict(name='a', text='Tags')]
  preprocess_regexps = [ (re.compile(r'src="', re.DOTALL|re.IGNORECASE), lambda match: 'src="http://www.paizo.com'), ]

Here's the error code:
Code:
calibre, version 0.8.23
ERROR: Conversion Error: <b>Failed</b>: Fetch news from Pathfinder Web Fiction v2.0.1

Fetch news from Pathfinder Web Fiction v2.0.1
Resolved conversion options
calibre version: 0.8.23
{'asciiize': False,
 'author_sort': None,
 'authors': None,
 'base_font_size': 0,
 'book_producer': None,
 'change_justification': 'original',
 'chapter': None,
 'chapter_mark': 'pagebreak',
 'comments': None,
 'cover': None,
 'debug_pipeline': None,
 'dehyphenate': True,
 'delete_blank_paragraphs': True,
 'disable_font_rescaling': False,
 'dont_compress': False,
 'dont_download_recipe': False,
 'duplicate_links_in_toc': False,
 'enable_heuristics': False,
 'extra_css': None,
 'extract_to': None,
 'fix_indents': True,
 'font_size_mapping': None,
 'format_scene_breaks': True,
 'html_unwrap_factor': 0.4,
 'input_encoding': None,
 'input_profile': <calibre.customize.profiles.InputProfile object at 0x0573C9F0>,
 'insert_blank_line': False,
 'insert_blank_line_size': 0.5,
 'insert_metadata': False,
 'isbn': None,
 'italicize_common_cases': True,
 'keep_ligatures': False,
 'language': None,
 'level1_toc': None,
 'level2_toc': None,
 'level3_toc': None,
 'line_height': 0,
 'linearize_tables': False,
 'lrf': False,
 'margin_bottom': 5.0,
 'margin_left': 5.0,
 'margin_right': 5.0,
 'margin_top': 5.0,
 'markup_chapter_headings': True,
 'max_toc_links': 50,
 'minimum_line_height': 120.0,
 'mobi_ignore_margins': False,
 'mobi_toc_at_start': False,
 'no_chapters_in_toc': False,
 'no_inline_navbars': True,
 'no_inline_toc': False,
 'output_profile': <calibre.customize.profiles.KindleOutput object at 0x0483B0D0>,
 'page_breaks_before': None,
 'password': None,
 'personal_doc': '[PDOC]',
 'prefer_author_sort': False,
 'prefer_metadata_cover': False,
 'pretty_print': False,
 'pubdate': None,
 'publisher': None,
 'rating': None,
 'read_metadata_from_opf': None,
 'remove_fake_margins': True,
 'remove_first_image': False,
 'remove_paragraph_spacing': False,
 'remove_paragraph_spacing_indent_size': 1.5,
 'renumber_headings': True,
 'replace_scene_breaks': '',
 'rescale_images': False,
 'series': None,
 'series_index': None,
 'share_not_sync': False,
 'smarten_punctuation': False,
 'sr1_replace': '',
 'sr1_search': '',
 'sr2_replace': '',
 'sr2_search': '',
 'sr3_replace': '',
 'sr3_search': '',
 'tags': None,
 'test': False,
 'timestamp': None,
 'title': None,
 'title_sort': None,
 'toc_filter': None,
 'toc_threshold': 6,
 'toc_title': None,
 'unsmarten_punctuation': False,
 'unwrap_lines': True,
 'use_auto_toc': False,
 'username': None,
 'verbose': 2}
InputFormatPlugin: Recipe Input running
Synthesizing mastheadImage
Python function terminated unexpectedly
  All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters (Error Code: 1)
Traceback (most recent call last):
  File "site.py", line 132, in main
  File "site.py", line 109, in run_entry_point
  File "site-packages\calibre\utils\ipc\worker.py", line 187, in main
  File "site-packages\calibre\gui2\convert\gui_conversion.py", line 25, in gui_convert
  File "site-packages\calibre\ebooks\conversion\plumber.py", line 949, in run
  File "site-packages\calibre\customize\conversion.py", line 204, in __call__
  File "site-packages\calibre\web\feeds\input.py", line 105, in convert
  File "site-packages\calibre\web\feeds\news.py", line 824, in download
  File "site-packages\calibre\web\feeds\news.py", line 1003, in build_index
  File "site-packages\calibre\web\feeds\news.py", line 852, in feeds2index
  File "site-packages\calibre\web\feeds\templates.py", line 40, in generate
  File "site-packages\calibre\web\feeds\templates.py", line 95, in _generate
  File "site-packages\lxml\builder.py", line 222, in __call__
  File "site-packages\lxml\builder.py", line 185, in add_text
  File "lxml.etree.pyx", line 916, in lxml.etree._Element.text.__set__ (src/lxml/lxml.etree.c:36134)
  File "apihelpers.pxi", line 721, in lxml.etree._setNodeText (src/lxml/lxml.etree.c:17141)
  File "apihelpers.pxi", line 1366, in lxml.etree._utf8 (src/lxml/lxml.etree.c:22211)
ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters

Last edited by raijinfolly; 10-26-2011 at 10:21 PM. Reason: typo
raijinfolly is offline   Reply With Quote