Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 10-18-2019, 12:24 PM   #1
mastertea
Junior Member
mastertea began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Oct 2019
Device: Kobo Libra H2O
Importing QJSEngine from PyQt5.QtQml, not found

So I'm current writing a plugin and need a way to convert javascript code to python and came to a solution by using [QJSEngine] class, however after testing the code in calibre I found out that the module [PyQt5.QtQml] couldn't be found. I got the following error:
"ImportError: No module named QtQml"

I looked into calibre installed dir and within it I found that it did include [Qt5Qml.dll] lib however didn't include the python wrapper file.

My question are:
1. Is there a reason for not include the python wrapper file for [Qt5Qml.dll] or is [QJSEngine] class is located in a different module within calibre?

2. Is there another way of access javascript code from python using only calibre included libraries?

I'm using calibre on windows.

Edit: Testing on calibre 4.2

Last edited by mastertea; 10-18-2019 at 12:27 PM.
mastertea is offline   Reply With Quote
Old 10-18-2019, 09:04 PM   #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,826
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
QJSEngine is not used by calibre. So there is no reason to include the PyQt module, it just wastes space. If you want to run JS from python use QWebEnginePage, see rapyscript.py for an example of doing this. Note that you cannot use QWebEngine in the main calibre process because it needs to be imported before QApplication is constructed, so you will need to fork a worker process to do it.
kovidgoyal is offline   Reply With Quote
Advert
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Building from source - PyQt5 with Python 2.7 faredoon Development 8 02-06-2018 08:01 PM
Install Problems With PyQt5 (Win64) stanking Plugins 2 10-06-2014 03:28 AM
No module named PyQt5.Qt silentfuzzle Development 2 08-19-2014 12:31 PM
"Error importing EPUB. EOCD not found. Not a ZIP archive? (Error Code 1068)" oren ePub 8 02-20-2012 07:20 AM
"Error importing EPUB. EOCD not found. Not a ZIP archive? (Error Code 1068)" oren Android Devices 1 02-20-2012 04:10 AM


All times are GMT -4. The time now is 09:51 AM.


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