View Single Post
Old 04-28-2009, 01:11 PM   #497
rc006
Junior Member
rc006 began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Apr 2009
Device: prs-505
hello,

It seems there a unicode problem when running feeds2disk on MacOs.
With python 2.3 or 2.6, i have :
Quote:
Traceback (most recent call last):
File "/Applications/calibre.app/Contents/Resources/loaders/feeds2disk.py", line 9, in <module>
main()
File "/Applications/calibre.app/Contents/Resources/lib/python2.6/site-packages.zip/calibre/web/feeds/main.py", line 164, in main
File "/Applications/calibre.app/Contents/Resources/lib/python2.6/site-packages.zip/calibre/web/feeds/main.py", line 152, in run_recipe
File "calibre/web/feeds/news.pyo", line 567, in download
File "calibre/web/feeds/news.pyo", line 689, in build_index
File "calibre/utils/terminfo.pyo", line 191, in update
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 88: ordinal not in range(128)
and python 3.0 do not work anymore :
Quote:
File "/usr/bin/feeds2disk", line 24
os.chmod(loader_path, 0700)
^
SyntaxError: invalid token
So i am obliged tu run windows emulator...

Otherwise, i am working on a recipe for the site http://www.lefigaro.fr/rss/
and i have a question.

The links provided in the rss in the different categories are like:
http://site.article.php so i used the followings code with success
Quote:
def print_version(self, url):
return url.replace('.php', '.php?mode=imprimer')
But i have a problem with the headline category "Actualites" which contain fresh news.
the links are : http://site.AZEEarticle.htm with a redirection to the real link
http://site.article.php
So, feeds2disk grab the second link, but the "return url.replace('.php', '.php?mode=imprimer')" does not work because it is applied on the first htm link

Any idea to apply a replacement on the second url?

Thanks
rc006 is offline