apprenticeharper / DeDRM_tools

DeDRM tools for ebooks
14.46k stars 1.49k forks source link

Exception: File dialog failed (return code -1073741819) #878

Open mikereape opened 5 years ago

mikereape commented 5 years ago

Hi

I get the error below even after installing your 6.6.3. I can see that it's there from the following in File Type Plug-ins in Preferences in calibre:

DeDRM (6.6.3) by Apprentice Alf, Aprentice Harper, The Dark Reverser and i♥cabbages Removes DRM from Amazon Kindle, Adobe Adept (including Kobo), Barnes & Noble, Mobipocket and eReader ebooks. Credit given to i♥cabbages and The Dark Reverser for the original stand-alone scripts.

Please see included text below from calibre

Thanks very much in advance Mike

calibre, version 3.46.0 ERROR: Conversion failed:

Failed to convert: B019G2NMJS EBOK

This is an Amazon KFX book. It cannot be processed. See here for information on how to handle KFX books.

Convert book 1 of 1 (B019G2NMJS EBOK) Initialized urlfixer Conversion options changed from defaults: output_profile: u'kindle' verbose: 2 read_metadata_from_opf: u'C:\Users\Mike\AppData\Local\Temp\calibre_udozq2\yfliiw.opf' Resolved conversion options calibre version: 3.46.0 {'asciiize': False, 'author_sort': None, 'authors': None, 'base_font_size': 0.0, 'book_producer': None, 'change_justification': u'original', 'chapter': u"//[((name()='h1' or name()='h2') and re:test(., '\s((chapter|book|section|part)\s+)|((prolog|prologue|epilogue)(\s+|$))', 'i')) or @class = 'chapter']", 'chapter_mark': u'pagebreak', 'comments': None, 'cover': None, 'debug_pipeline': None, 'dehyphenate': True, 'delete_blank_paragraphs': True, 'disable_font_rescaling': False, 'dont_compress': False, 'duplicate_links_in_toc': False, 'embed_all_fonts': False, 'embed_font_family': None, 'enable_heuristics': False, 'expand_css': False, 'extra_css': None, 'extract_to': None, 'filter_css': u'', 'fix_indents': True, 'font_size_mapping': None, 'format_scene_breaks': True, 'html_unwrap_factor': 0.4, 'input_encoding': None, 'input_profile': <calibre.customize.profiles.InputProfile object at 0x0000024B336D85F8>, 'insert_blank_line': False, 'insert_blank_line_size': 0.5, 'insert_metadata': False, 'isbn': None, 'italicize_common_cases': True, 'keep_ligatures': False, 'language': None, 'level1_toc': None, 'level2_toc': None, 'level3_toc': None, 'line_height': 0.0, 'linearize_tables': False, 'margin_bottom': 5.0, 'margin_left': 5.0, 'margin_right': 5.0, 'margin_top': 5.0, 'markup_chapter_headings': True, 'max_toc_links': 50, 'minimum_line_height': 120.0, 'mobi_file_type': u'old', 'mobi_ignore_margins': False, 'mobi_keep_original_images': False, 'mobi_toc_at_start': False, 'no_chapters_in_toc': False, 'no_inline_navbars': True, 'no_inline_toc': False, 'output_profile': <calibre.customize.profiles.KindleOutput object at 0x0000024B336D8BE0>, 'page_breaks_before': u"//*[name()='h1' or name()='h2']", 'personal_doc': u'[PDOC]', 'prefer_author_sort': False, 'prefer_metadata_cover': False, 'pretty_print': False, 'pubdate': None, 'publisher': None, 'rating': None, 'read_metadata_from_opf': u'C:\Users\Mike\AppData\Local\Temp\calibre_udozq2\yfliiw.opf', 'remove_fake_margins': True, 'remove_first_image': False, 'remove_paragraph_spacing': False, 'remove_paragraph_spacing_indent_size': 1.5, 'renumber_headings': True, 'replace_scene_breaks': u'', 'search_replace': '[]', 'series': None, 'series_index': None, 'share_not_sync': False, 'smarten_punctuation': False, 'sr1_replace': None, 'sr1_search': None, 'sr2_replace': None, 'sr2_search': None, 'sr3_replace': None, 'sr3_search': None, 'start_reading_at': None, 'subset_embedded_fonts': False, 'tags': None, 'timestamp': None, 'title': None, 'title_sort': None, 'toc_filter': None, 'toc_threshold': 6, 'toc_title': None, 'transform_css_rules': '[]', 'unsmarten_punctuation': False, 'unwrap_lines': True, 'use_auto_toc': False, 'verbose': 2} InputFormatPlugin: MOBI Input running on C:\Users\Mike\AppData\Local\Temp\calibre_udozq2\nvsr2p.azw Python function terminated unexpectedly This is an Amazon KFX book. It cannot be processed. See https://www.mobileread.com/forums/showthread.php?t=283371 for information on how to handle KFX books. (Error Code: 1) Traceback (most recent call last): File "site.py", line 101, in main File "site.py", line 78, in run_entry_point File "site-packages\calibre\utils\ipc\worker.py", line 200, in main File "site-packages\calibre\gui2\convert\gui_conversion.py", line 42, in gui_convert_override File "site-packages\calibre\gui2\convert\gui_conversion.py", line 27, in gui_convert File "site-packages\calibre\ebooks\conversion\plumber.py", line 1110, in run File "site-packages\calibre\customize\conversion.py", line 246, in call File "site-packages\calibre\ebooks\conversion\plugins\mobi_input.py", line 37, in convert File "site-packages\calibre\ebooks\mobi\reader\mobi6.py", line 85, in init calibre.ebooks.mobi.reader.mobi6.KFXError: This is an Amazon KFX book. It cannot be processed. See https://www.mobileread.com/forums/showthread.php?t=283371 for information on how to handle KFX books.

j-howell commented 5 years ago

From the log:

This is an Amazon KFX book. It cannot be processed. See https://www.mobileread.com/forums/showthread.php?t=283371 for information on how to handle KFX books. (Error Code: 1)

mikereape commented 5 years ago

Hi

I'd already done Method 2 in the post you ref and downgraded to Kindle 1.24.3 and I still get that. I also have (FWIW) KFX Input (and Output) and Kindle Unpack installed and Kindle Unpack works on some books anyway so it seems to me like this should do it.

Apologies if just I'm missing the obvious but am I? Or is this just flat out impossible. I thought that with DeDRM 6.6.3 with KFX Input installed you could get what you're after. Please clarify. My interest in all this is just to study the internal format(s), etc. to develop tools.

Many thanks in advance

Mike

j-howell commented 5 years ago

It should be possible to convert using DeDRM along with that Kindle software and the KFX Input plugin. Make sure that you downloaded the book using that version of Kindle for PC/Mac. A copy left over from a prior install will not work. Also rented or borrowed books (such as from Kindle Unlimited) will not work with this method.

DRM removal happens on import of the book into calibre. You will need to post a log of the book being imported in order to diagnose this further. See the FAQ for info on how to obtain this log.

mikereape commented 5 years ago

Hi

So I removed the book from calibre and re-downloaded all the Kindle books that weren't included in Kindle 1.24.3 and imported the book into calibre again in debug mode. The log is attached.

If you check the log you can see it wants a key and/or voucher. It looks like I have an Amazon voucher file in the form of amzn1.drm-voucher.v1.29a80aae-6c9f-4bd6-a647-b54b050b6c19.voucher but I suppose that's no good.

Any thoughts?

Thanks Mike

tmpaft8rd.txt

j-howell commented 5 years ago

The creation of a kfx-zip archive is supposed to happen automatically in the Gather KFX-ZIP plugin, which is part of the KFX Input plugin. For some reason that did not run when you imported your book. I can't explain why, since it does get initialized. There is something odd that I do not understand about your calibre installation.

mikereape commented 5 years ago

Hi

On the back of your last comment I uninstalled KFX Input and re-installed (from the Net assume as I didn't navigate to a file), deleted the book, re-started and tried to convert again. Same thing.

Mike xo

ElleKayEm commented 5 years ago

You mention doing Method 2 which involves disabling Kindle for PC from downloading KFX. But you're still getting a KFX file. You should still be ok, as long as calibre with DeDRM and Kindle for PC (which was used to download the book) are on the same machine and user. You also need to add the book to calibre from the folder it originally downloaded to. That way KFX Input can find the other files it needs.

mikereape commented 5 years ago

Also re-downloaded calibre from site and re-installed re-imported book and still no change. You did notice that it's an azw book, right? I first downloaded it/got it on 31 July 2019.

Thanks Mike

ElleKayEm commented 5 years ago

AZW can be any Amazon format. In the attached log, there's an error because it isn't getting the related files it needs to decrypt the KFX format.

Failed to decrypt with error: The .kfx DRMION file cannot be decrypted by itself. A .kfx-zip archive containing a DRM voucher is required.

ElleKayEm commented 5 years ago

You re-downloaded the book with the current installation of Kindle for PC?

mikereape commented 5 years ago

Hi ElleKayEm

You were right. I checked and Method 2 still applied (renderer-text.exe was renamed with file ext .xxx) and there was no KFX Input plugin. Then, I tried renaming it back with file extension .exe to get KFX Input back and did and it still didn't work and now have renderer with file ext .xxx and with KFX Input still there (according to calibre and it's all the same).

Yes, I re-downloaded the book after I un-installed Kindle v1.25=/+ and re-installed v1.24.3.

I think that's everything.

Mike

mikereape commented 5 years ago

Hi

I forgot to mention. I did make sure that I was importing the book from the folder it was downloaded into. I can tell I got the book re-downloaded today after the Kindle re-install by file mod times.

Best Mike

ElleKayEm commented 5 years ago

Is Kindle for PC still on version 1.24?

mikereape commented 5 years ago

Yes it is

Mike

ElleKayEm commented 5 years ago

I don't know what's wrong then. You shouldn't be getting KFX format with Method 2. But even if disabling downloads of KFX doesn't work for some reason, you should still be getting KFX that you can DeDRM from K4PC 1.24. (Method 4)

mikereape commented 5 years ago

It's definitely v1.24.3. KFX Input is there and currently I've got renderer-test.xxx and it still won't convert. In fact, it won't let me disable KFX Input so it's there alright.

Do you have any idea what I've have to do was go back to zero and start all over again. My very dim memory tells me that calibre used to work like a dream till I started trying to get Kindle Unpack and KFX Input and DeDRM working but that was a good few months ago.

I'm quite happy to start from scratch if I could just figure out how to.

Thanks in advance for any advice

Best Mike

ElleKayEm commented 5 years ago

It seems like we must have some miscommunication going on here. Since you're still downloading KFX books (at least that's what it looked like in the log), in spite of changing renderer-test.exe to renderer-test.xxx, then you need both the KFX Input plugin and the DeDRM plugin enabled in calibre to remove the DRM. The other problem I saw was that the plugins were only finding one of the multiple files that make up a KFX book. That usually means it's been moved out of its original folder structure. So I don't know what is happening in your situation.

If you want to try from scratch with Kindle for PC, there are instructions in this section of the FAQs:

https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md#i-have-installed-the-calibre-plugin-and-the-book-is-not-already-in-calibre-but-the-drm-does-not-get-removed-it-is-a-kindle-book

You might look around to see if Kindle for PC has put anything in a location other than the ones listed in step 3. And you're fine using version 1.24 or earlier for step 4.