Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old Today, 06:06 AM   #1
KarlG
Enthusiast
KarlG began at the beginning.
 
Posts: 47
Karma: 10
Join Date: Mar 2024
Device: none
Borkify Plugin - Possible limitation?

Hello,

I have an epub which causes Sigil to crash when I attempt to restructure it to Sigil Norm.

Normally I would use the borkify plugin on the epub to allow me to post it for further investigation, however the borkify plugin crashes with the following error message

..converting: cover.xhtml with manifest id: cover
Traceback (most recent call last):
File "/usr/local/share/sigil/plugin_launchers/python/launcher.py", line 142, in launch
self.exitcode = target_script.run(container)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/karl/.local/share/sigil-ebook/sigil/plugins/Borkify/plugin.py", line 113, in run
with open(fpath, "wb") as f:
^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmphk94al94/OEBPS/cover.xhtml'
Error: [Errno 2] No such file or directory: '/tmp/tmphk94al94/OEBPS/cover.xhtml'

I've manually unpacked the epub and there isn't an OEBPS directory, so I'm assuming the borkify plugin will only work on standard epubs which already have the correct directory structure.

Any suggestions as to how I could get round this?

Thanks

Karl
KarlG is offline   Reply With Quote
Old Today, 06:27 AM   #2
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 718
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Various
Borkify plugin is 7 years old, actually only accepts the standard folder structure (Sigil Norm) inside the EPUB file.

The solutions are two:
1. restructure first, then Borkify.
2. improve the Borkify plugin to take into account a different folder structure.

Look at post 8.

Edit: Removed bad code.

Last edited by BeckyEbook; Today at 11:58 AM.
BeckyEbook is online now   Reply With Quote
Advert
Old Today, 07:03 AM   #3
KarlG
Enthusiast
KarlG began at the beginning.
 
Posts: 47
Karma: 10
Join Date: Mar 2024
Device: none
Hi Becky,

Thanks for the quick reply. Restructuring is not an option, as it's the restructuring that causes Sigil to crash! :-)

I replaced the code in plugin.py as you suggested. That certainly fixed the crash, but the output file isn't borkified at all.

Last time I had an issue with an epub, I shared it via Proton Drive. If you like I can do this again and then you can let me know after you've grabbed it and I can remove the share.
KarlG is offline   Reply With Quote
Old Today, 07:27 AM   #4
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,128
Karma: 18727091
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
I also get occasional failures of the restructuring algorithm but usually it’s due to malformed coding in the epub and is easily fixable. I would ignore the whole Borkify issue until you get it to pass the restructuring.

When you first open the epub in Sigil hit F7 to run a well-formed check. That should give you a list of problems to fix. When fixed you should be able to restructure, then Borkify (if you still need to).
Turtle91 is offline   Reply With Quote
Old Today, 07:33 AM   #5
KarlG
Enthusiast
KarlG began at the beginning.
 
Posts: 47
Karma: 10
Join Date: Mar 2024
Device: none
Hi Dion,

Already tried that. No problems found, but Sigil still crashes when I attempt a restructure.

Karl
KarlG is offline   Reply With Quote
Advert
Old Today, 09:07 AM   #6
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,865
Karma: 5449552
Join Date: Nov 2009
Device: many
You could just pm a private link to DiapDealer or myself here on MR. We can then use it to track down and fix the bug without you needing to make it publicly available.

BTW, Alternatively, try using Find and Replace to a selected body tag contents with the same a single paragraph of text. If Restructuring the that works, then you know the issue is with that file's content links of some sort. But depending on the number of files, this may take a long time.

Or try find and replace and turn on the Text Mode flag and replace all (ie outside tags) with nonsense text.

Or, make a Checkpoint, then run Mend on all HTML files and see if the restructure bug still happens. If not compare it to the Checkpoint to see what changed.

Or try running epubcheck to see if it detects anything unusual about that epub that could give us a hint about what is going on.

Please do let us know what you find, as Sigil should never crash.

Last edited by KevinH; Today at 09:21 AM.
KevinH is online now   Reply With Quote
Old Today, 09:45 AM   #7
KarlG
Enthusiast
KarlG began at the beginning.
 
Posts: 47
Karma: 10
Join Date: Mar 2024
Device: none
Just PM'd you the link Kevin. Don't see anything in my outbox, so please let me know if you got the message or not.
KarlG is offline   Reply With Quote
Old Today, 11:14 AM   #8
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 718
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Various
You are right. My proposal made no sense.
Other adjustments are needed.

Code:
        # write out modified file
        destdir = ""
        filename = ""
        if bk.launcher_version() >= 20190927:
            filename = bk.id_to_bookpath(mid)
            fpath = os.path.join(temp_dir, filename)
        else:
            if "/" in href:
                destdir, filename = unquote(filename).split("/")
            fpath = os.path.join(temp_dir, "OEBPS", destdir, filename)

Last edited by BeckyEbook; Today at 11:57 AM.
BeckyEbook is online now   Reply With Quote
Old Today, 11:38 AM   #9
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,865
Karma: 5449552
Join Date: Nov 2009
Device: many
@KarlG,

Well the problem is NOT in Sigil itself but in Qt. It seems that Qt has enabled the use of its JIT compiler in its version of PCRE2 that is used internally in QRegularExpression.

Unfortunately, by turning on the JIT for PCRE2 that makes any use of QRegularExpression in a multiple threaded environment (such as using QtConcurrent) can potentially cause a serious crash.

Really, in a multithreaded environment Qt should not be making code that is non-reentrant.

The only solution is either to patch Qt to not do that (but that leaves out our Linux users who do not build their own Qt), or force the use of the following environment variable which tells Qt to not use its internal Qt PCRE2 in JIT mode in its Regular Expression code:

QT_ENABLE_REGEXP_JIT=0


So try setting this environment variable before firing up Sigil and Restructure to Sigil Norm will no longer crash at all - but will take a really really long time to run in your test case so be very patient.

FWIW, the resulting renames for duplicates will work but will not make numeric sense. You would be much better off renaming those images making their parent folder become part of their name.

I will create a bug report on Qt about this but I would not hold my breath for a bug fix.

KevinH

Last edited by KevinH; Today at 12:10 PM.
KevinH is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
kepub limitation? CyberPaul Kobo Reader 16 06-08-2022 04:01 PM
Borkify ePUB Toxaris Plugins 18 01-26-2017 06:21 PM
Kepub limitation aluisscp Kobo Reader 7 06-29-2014 04:22 PM
Library Limitation Catlady General Discussions 11 04-21-2014 07:26 PM
Size limitation? Kumabjorn Calibre 2 02-19-2012 11:12 AM


All times are GMT -4. The time now is 12:16 PM.


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