thesamet / webilder

Wallpaper downloader and rotator that uses Flickr and Webshots.
http://www.webilder.org/
Other
30 stars 12 forks source link

Error message downloading from flickr #44

Open susanLBcanada opened 10 years ago

susanLBcanada commented 10 years ago

tag: Easter sort: interesting 'ascii' codec can't encode character u'\xf3' in position 28: ordinal not in range(128) on the 7th image

tag: saint, patricks sort: interesting 'ascii' codec can't encode character u'\u2667' in position 21: ordinal not in range(128)

with the following from terminal ...Snip url = http://api.flickr.com/services/rest/?api_key=045379bc5368502f749af23d95a17c83&photo_id=13199372033&method=flickr.photos.getSizes Thread done Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner self.run() File "/usr/local/lib/python2.7/dist-packages/webilder/progress_dialog.py", line 48, in newfunc func(self, _args, *_kwargs) File "/usr/local/lib/python2.7/dist-packages/webilder/DownloadDialog.py", line 51, in run raise exc UnicodeEncodeError: 'ascii' codec can't encode character u'\u2667' in position 21: ordinal not in range(128)

made from source directions on your site on Debian: Jessy

Hopefully it isn't a problem to give you headaches! Susan

Corin-EU commented 10 years ago

This problem of not being able to encode Unicode characters in image file names is still present in the latest Webilder 0.7.3

Traceback (most recent call last): File "/usr/local/bin/webilder_downloader", line 9, in load_entry_point('Webilder==0.7.3', 'console_scripts', 'webilder_downloader')() File "/usr/local/lib/python2.7/dist-packages/webilder/downloader.py", line 195, in main download_all(notify) File "/usr/local/lib/python2.7/dist-packages/webilder/downloader.py", line 154, in download_all filter_photos(config, photos) File "/usr/local/lib/python2.7/dist-packages/webilder/downloader.py", line 66, in filterphotos print ("Skipping already existing photo '%s'") % photo['title'] UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 74: ordinal not in range(128)

If you do not intend to add Unicode support for file names, why not just convert any character which is out of range to a string of characters eg for u'\u2667', make it the six ASCII characters Xu266X and for u'\xfc' make it the six ASCII charactters XuxfcX where X could be X or underline or dash.

Although the filenames would look strange, at least it would not break the download.