View Single Post
Old 03-18-2024, 02:07 PM   #3
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: 8,858
Karma: 6120478
Join Date: Nov 2009
Device: many
Okay, I just ran the following snippet inside my own testme3 plugin and it worked just fine:

Code:
    # examples for using the bs4/gumbo parser to process xhtml
    print("\nExercising: the gumbo bs4 adapter")
    import sigil_gumbo_bs4_adapter as gumbo_bs4
    samp = """
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml/" xml:lang="en" lang="en-US">
<head><title>testing & entities</title></head>
<body>
  <p class="first second">this&nbsp;is*the*<i><b>copyright</i></b> symbol "&copy;"</p>
  <p xmlns:xlink="http://www.w3.org/xlink" class="second" xlink:href="http://www.ggogle.com">this used to test atribute namespaces</p>
</body>
</html>
"""
    soup = gumbo_bs4.parse(samp)
    for node in soup.find_all(attrs={'class':'second'}):
        print(node)
and it produced the correct output:

Exercising: the gumbo bs4 adapter
<p class="first second">this is the <i><b>copyright</b></i> symbol "©"</p>
<p xmlns:xlink="http://www.w3.org/xlink" class="second" xlink:href="http://www.ggogle.com">this used to test atribute namespaces</p>

---

I would be careful importing that library as "gumbo" as google gumbo and sigil's gumbo are not identical in case of a collision.


The next place to look is to make sure the libsigilgumbo.dylib is in its proper place inside the app.

In Terminal.app (assuming you install Sigil in /Applications) try the following:

ls /Applications/Sigil.app/Contents/lib/

It should show as output: libhunspell.dylib libsigilgumbo.dylib


Are you by chance using an external 3.12 (or newer) Python3 version for your plugins instead of the internal embedded version in my Release builds? If so, drop back to Python 3.11.x as there are breaking changes in Python 3.12.x that may impact using cdll to load sigilgumbo.

Are you by chance building your own version of Sigil?

Last edited by KevinH; 03-18-2024 at 02:12 PM.
KevinH is offline   Reply With Quote