Unable to convert a C++ 'QWebEngineFindTextResult' instance to a Python object

Florian Bruhin me at the-compiler.org
Thu May 7 15:25:47 BST 2020


Hey,

I got a report from someone using:

- Qt 5.14.1 (both QT_VERSION_STR and qVersion())
- PyQt 5.14.1
- sip 4.19.21

- QtWebEngine 5.14.1
- PyQtWebEngine 5.14.0 (note the .0)

- Python 3.6.10
- Gentoo Linux

Where emitting the QWebEnginePage.findTextFinished signal (added in Qt 5.14)
results in:

  TypeError: unable to convert a C++ 'QWebEngineFindTextResult' instance to a
  Python object

In a similar vein, trying to import it via:

  python3 -c "from PyQt5.QtWebEngineCore import QWebEngineFindTextResult"

results in:

  ImportError: cannot import name 'QWebEngineFindTextResult'

Test script:

--------------------------------------------------

from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import QUrl, QTimer, pyqtSlot

app = QApplication([])

view = QWebEngineView()
view.load(QUrl('https://qutebrowser.org'))
view.show()

# @pyqtSlot('QWebEngineFindTextResult')
def slot(result):
    print(result.numberOfMatches())
    app.quit()

view.page().findTextFinished.connect(slot)
QTimer.singleShot(5000, lambda: view.findText("qutebrowser"))

app.exec_()

--------------------------------------------------

The crash happens after 5s, after findText got called. The pyqtSlot decorator
doesn't change anything.

I can't reproduce, and also don't know about any other people who have the same
issue...

Any idea what's going on there? Is their sip version too old or something?
Was there a bug in QtWebEngine 5.14.0 which was fixed in .1? I don't understand
what's happening, because both the findTextFinished signal and the
QWebEngineFindTextResult class is guarded by "%If (QtWebEngine_5_14_0 -)", so
surely both should be available?

Florian

-- 
me at the-compiler.org (Mail/XMPP) | https://www.qutebrowser.org 
       https://bruhin.software/ | https://github.com/sponsors/The-Compiler/
       GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
             I love long mails! | https://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20200507/270683cc/attachment.sig>


More information about the PyQt mailing list