|
|
#1 |
|
Member
![]() Posts: 15
Karma: 10
Join Date: Jan 2010
Location: Stockholm, Sweden
Device: Kobo Glo, PocketBook Touch 622
|
Fetching Lenta.ru from python script
Hi,
I have a setup where I fetch news from a python script on my Linux server using cron. It works well apart from Lenta.ru for which the description string contains non-ascii characters. I get the "Failed to find builtin recipe: " error. I'm running Python 2.7.1. I copied the description string from the builtin_recipes.xml file. Script: Code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os, subprocess, tempfile
os.environ['DISPLAY'] = ':1'
recipes = [u'Lenta.ru: Новости' 'Dagens Nyheter', \
'Svenska Dagbladet', 'BBC News', 'La Repubblica']
tmp_dir = tempfile.mkdtemp()
out_file = tmp_dir + "/news.epub"
for recipe in recipes:
subprocess.call(["ebook-convert", recipe + ".recipe", out_file])
subprocess.call(["calibredb", "add", out_file])
os.remove(out_file)
os.removedirs(tmp_dir)
|
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to use python script with windows xp | tuufbiz1 | Other formats | 12 | 01-08-2011 09:22 AM |
| Import ebook conversion in python script | erollisi | Calibre | 1 | 08-19-2010 10:43 PM |
| How do I get a shortcut for a Python script onto the taskbar in W7? | Sydney's Mom | Workshop | 6 | 03-28-2010 09:11 PM |
| Nedd a little help with a python script | gandor62 | Calibre | 1 | 08-07-2008 10:59 PM |
| Python script to create collections | gwynevans | Sony Reader Dev Corner | 2 | 03-13-2008 01:29 PM |