Hmmm... interesting. I just tried that same scenario and like you got the same error. It should be looking at the MOBI, not the LIT file based on those preferences but clearly something isn't working as it should.
@Kovid - my code is calling:
Code:
from calibre.gui2.convert.single import get_input_format_for_book
...
input_format, input_formats = get_input_format_for_book(self.db, book_id, None)
My preferred input order is set to: EPUB, ZIP, MOBI, PRC, LIT
However the result I get back from the function above seems to be an *alphabetical* sort, not a preference sort. As it will give me [ 'epub','lit','mobi','zip'] or ['lit','mobi','zip'] for a book with those formats respectively.
Clearly not what I wanted. Is the function in calibre not working right, am I using it wrong, or is it actually right but just not doing what I want? It has code in it saying "sort_formats_by_preference" which led me to believe it was the right thing but clearly not...