From 532820ad8f5cdac891a5486baa3e6877dc502afd Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 16 Jan 2009 10:08:52 -0800 Subject: [PATCH] IGN:Make job control a little more robust --- src/calibre/ebooks/epub/from_html.py | 2 ++ src/calibre/parallel.py | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/epub/from_html.py b/src/calibre/ebooks/epub/from_html.py index 9165e99313..413bea4801 100644 --- a/src/calibre/ebooks/epub/from_html.py +++ b/src/calibre/ebooks/epub/from_html.py @@ -77,6 +77,8 @@ def check_links(opf_path, pretty_print): html_files.append(os.path.abspath(content(f))) for path in html_files: + if not os.access(path, os.R_OK): + continue base = os.path.dirname(path) root = html.fromstring(open(content(path), 'rb').read(), parser=parser) for element, attribute, link, pos in list(root.iterlinks()): diff --git a/src/calibre/parallel.py b/src/calibre/parallel.py index 45ceff5132..6cbe1c96e4 100644 --- a/src/calibre/parallel.py +++ b/src/calibre/parallel.py @@ -286,7 +286,7 @@ def write(socket, msg, timeout=5): def read(socket, timeout=5): ''' Read a message from `socket`. The message must have been sent with the :function:`write` - function. Raises a `RuntimeError` if the message is corrpted. Can return an + function. Raises a `RuntimeError` if the message is corrupted. Can return an empty string. ''' if isworker: @@ -299,7 +299,12 @@ def read(socket, timeout=5): if not msg: break if length is None: - length, msg = int(msg[:12]), msg[12:] + try: + length, msg = int(msg[:12]), msg[12:] + except ValueError: + if DEBUG: + print >>sys.__stdout__, 'read(%s):'%('worker' if isworker else 'overseer'), 'no length in', msg + return '' buf.write(msg) if buf.tell() >= length: break