View Single Post
Old 12-17-2010, 04:33 AM   #14
mornington
Connoisseur
mornington will become famous soon enoughmornington will become famous soon enoughmornington will become famous soon enoughmornington will become famous soon enoughmornington will become famous soon enoughmornington will become famous soon enoughmornington will become famous soon enough
 
Posts: 63
Karma: 732
Join Date: Nov 2010
Device: Sony PRS-650
Quote:
Originally Posted by ch4os View Post
Your app looks great, but there is a problem with non-ascii characters (for example polish), when i'm running CallibreKindeCollections withous any option i've got something like this:

Code:
ADDED 2 items to collection "- Fandorin - Boris Akunin"
ADDED 10 items to collection "- Steven Erikson"
ADDED 4 items to collection "- Unknown"
ADDED 16 items to collection "- Orson Scott Card"
Traceback (most recent call last):
  File "CalibreKindleCollections.py", line 902, in <module>
    createCollectionsFromCalibre()
  File "CalibreKindleCollections.py", line 354, in createCollectionsFromCalibre
    endAddBooks()
  File "CalibreKindleCollections.py", line 466, in endAddBooks
    print collDesc.encode('utf-8')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 38: ordinal not in range(128)
I've attached my metadata.calibre file (just change extension from txt)

I've no idea how to fix this one, I'm afraid - it's clearly a character set encoding issue but I just don't know Python (as I mentioned, this script is the first time I've ever seen Python code, much less written any), so I don't know why it can't convert your unicode symbols to utf-8.

Maybe someone who knows Python can address this one?

Quote:
Originally Posted by ch4os View Post

And second error when i'm trying to cleanup collections

Code:
python CalibreKindleCollections.py --noupdatecollections --nomiscellanycollection --sortcollections
Code:
Retrieving list of all books on kindle. This may take a little while.

Checking for any books which are in collections but are no longer on the kindle.

Traceback (most recent call last):
  File "CalibreKindleCollections.py", line 910, in <module>
    cleanupCollections()
  File "CalibreKindleCollections.py", line 533, in cleanupCollections
    if asin != UserGuideAsin:
NameError: global name 'UserGuideAsin' is not defined
This is an easy one to resolve: Just add the line:

Code:
UserGuideAsin = ""
Somewhere near the top of the file (and outside any function definitions). The problem is that it's not found a Kindle user guide and there's no blank default set in the script for that value. My bad. But that'll fix it.


As a complete aside: I had a glance at your metadata file and noticed that you have a lot of azw files. As you're doubtless aware from the notes accompanying the script, it can't automatically put those files into collections for you.

At the very least, you should run the script with the "--nocleanupdeadfiles" command-line option, as otherwise it will remove any unidentified files from collections, which includes azw files (note - the books themselves will not be removed from the kindle, they just will not appear in collections).
mornington is offline   Reply With Quote