Thread: Pocket recipe
View Single Post
Old 04-21-2013, 10:16 AM   #7
belano
Junior Member
belano began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Apr 2013
Device: kindle dx
One last question, I haven't done much python so please bear with me.

In order to pass an addicional parameter to my custom module, what's the correct syntax for the fork_job call? I've tried the following but it keeps complaining

Code:
def get_obfuscated_article(self, url):
        br = self.browser
        result = fork_job(js_fetcher, 'grab', args=(url, br), module_is_source_code=True)
        html = result['result']
        if isinstance(html, type(u'')):
            html = html.encode('utf-8')
        pt = PersistentTemporaryFile('.html')
        pt.write(html)
        pt.close()
        return pt.name
Error trace

Code:
Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/utils/threadpool.py", line 95, in run
    (request, request.callable(*request.args, **request.kwds))
  File "/usr/lib/calibre/calibre/web/feeds/news.py", line 1063, in fetch_obfuscated_article
    path = os.path.abspath(self.get_obfuscated_article(url))
  File "<string>", line 197, in get_obfuscated_article
  File "/usr/lib/calibre/calibre/utils/ipc/simple_worker.py", line 160, in fork_job
    abort=abort)
  File "/usr/lib/calibre/calibre/utils/ipc/simple_worker.py", line 79, in communicate
    raise WorkerError('Failed to communicate with worker process')
WorkerError: Failed to communicate with worker process
Thanks
belano is offline   Reply With Quote