Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 03-20-2016, 02:48 PM   #1
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 6,496
Karma: 84420419
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
Question about ConversionUserFeedBack

I am working on a calibre Conversion Output plugin and have come across something that I don't understand so I am asking about it here.

Unfortunately, the plugin is expected to fail to convert some books and I want to notify the user of the reason why when this occurs. To do this I am raising a ConversionUserFeedBack exception to provide the error message. I used this test code to always simulate a conversion error:

Code:
    def convert(self, oeb_book, output, input_plugin, opts, log):
        import calibre.ebooks.conversion
        raise calibre.ebooks.conversion.ConversionUserFeedBack("Conversion failed", "test", level="error")
When I start a conversion that uses this output plugin this works properly for most books and pops up a dialog box with a title of Conversion failed and a message of test. The end of the job log shows the exception I raised as expected:

Code:
Python function terminated unexpectedly
  {"title": "Conversion failed", "msg": "test", "det_msg": "", "level": "error"} (Error Code: 1)
Traceback (most recent call last):
  File "site.py", line 132, in main
  File "site.py", line 109, in run_entry_point
  File "site-packages\calibre\utils\ipc\worker.py", line 190, in main
  File "site-packages\calibre\gui2\convert\gui_conversion.py", line 31, in gui_convert_override
  File "site-packages\calibre\gui2\convert\gui_conversion.py", line 25, in gui_convert
  File "site-packages\calibre\ebooks\conversion\plumber.py", line 1219, in run
  File "calibre_plugins.kfx_output.__init__", line 49, in convert
calibre.ebooks.conversion.ConversionUserFeedBack: {"title": "Conversion failed", "msg": "test", "det_msg": "", "level": "error"}
However, this does not work for a small subset of books and I can't figure out why. For these books it consistently fails to give the expected error dialog. Instead it pops up a generic conversion error dialog. Looking at the end of the conversion job log for those book I see the following:

Code:
[Python function terminated unexpectedly
  {"title": "Conversion failed", "det_msg": "", "level": "error", "msg": "test"} (Error Code: 1)
Traceback (most recent call last):
  File "site.py", line 132, in main
  File "site.py", line 109, in run_entry_point
  File "site-packages\calibre\utils\ipc\worker.py", line 190, in main
  File "site-packages\calibre\gui2\convert\gui_conversion.py", line 31, in gui_convert_override
  File "site-packages\calibre\gui2\convert\gui_conversion.py", line 25, in gui_convert
  File "site-packages\calibre\ebooks\conversion\plumber.py", line 1219, in run
  File "calibre_plugins.kfx_output.__init__", line 49, in convert
ConversionUserFeedBack: {"title": "Conversion failed", "det_msg": "", "level": "error", "msg": "test"}
Note that the exception shows as ConversionUserFeedBack instead of calibre.ebooks.conversion.ConversionUserFeedBack. This causes the problem since the code in calibre/gui2/ui.py is looking for only the longer string.

I cannot figure out why the exception is sometimes reported differently in the log. Any help would be appreciated.
jhowell is offline   Reply With Quote
Old 03-21-2016, 12:01 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,856
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
https://github.com/kovidgoyal/calibr...2dfb6b7a720dd3
kovidgoyal is online now   Reply With Quote
Advert
Old 03-21-2016, 10:01 AM   #3
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 6,496
Karma: 84420419
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
That fixed it. Thanks!
jhowell is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about PW 3g mystika1 Amazon Kindle 6 07-11-2014 06:36 PM
Question about 0.7.9 - what does this mean? texasnightowl Calibre 8 07-19-2010 09:04 PM
Classic Few Nook Question and Question on Nook 3G vs WiFi blackonblack Barnes & Noble NOOK 4 07-02-2010 02:07 AM
Looking for another reader question and PRS-600 question lilpretender Which one should I buy? 9 10-24-2009 04:02 AM
Hello to everyone and then a question BuAba Which one should I buy? 8 03-26-2008 04:28 AM


All times are GMT -4. The time now is 02:21 PM.


MobileRead.com is a privately owned, operated and funded community.