1

I'm new to python and have been playing around with it and have ran into a problem using PyQt5. Could someone please explain to me what this means:

ModuleNotFoundError: No module named 'PyQt5.QtWebKit'.

Actually, I think I understand WHAT it means, but how do i fix it? I found a solution in another forum but all it said was QtWebKit needed to be compiled in PyQt5. I don't understand what that means or how to do it.

I should clarify by saying I have installed PyQt5 and I have ran some example scripts with just simple windows with a few widgets. I started getting this error trying to use code from a tutorial on creating a web browser with PyQt5.

I really like the python language and I am wanting to convert a project from Access to python. In the Access project, I have a few WebBrowser controls and I was looking for a GUI toolkit that would allow me to do the same thing using python. I thought PyQt5 would work, but I keep getting the ModuleNotFoundError.

I am using Windows 8.1 if that makes a difference.

0m3r
  • 12,286
  • 15
  • 35
  • 71
sgldjj
  • 11
  • 1
  • 3
  • Possible duplicate of [Cannot import QtWebKitWidgets in PyQt5](https://stackoverflow.com/questions/37876987/cannot-import-qtwebkitwidgets-in-pyqt5) – eyllanesc Jun 08 '18 at 22:25
  • Use QtWebEngine, QtWebkit is deprecated. – eyllanesc Jun 08 '18 at 22:26
  • Compiling a QtWebKit for PyQt5 can be a complicated task because you will need to install other libraries such as SIP, Qt and WebKit, and as you comment or understand how to do it, you will lose your time, I recommend using QtWebEngine, it is the replacement of QtWebkit but which has many improvements. In the following link I show an example: https://gist.github.com/eyllanesc/07e60fa6d8b96b40cf1eaa270139d870 – eyllanesc Jun 08 '18 at 22:38
  • @eyllanesc, Thank you for the help. I tried the code sample from the link you posted and it works great. I have one other question, though. In my original script, I changed QtWebKit to QtWebEngine and the import no longer generated an error, but I started getting a different error: QWebView not defined. I found an article online that showed some of the changed from PyQt4 to PyQt5 (such as QtWebKit vs QtWebEngine) but it didn't mention QWebView. Any ideas? – sgldjj Jun 08 '18 at 23:07
  • Without your code I can not tell you anything. The translation of QtWebKit to QtWebEngine is not trivial. ;) – eyllanesc Jun 08 '18 at 23:08
  • you could create a new question showing your translation intent and I could help you to do it correctly :) – eyllanesc Jun 08 '18 at 23:09
  • I don't think I even kept the code snippet that was generating the error. I found it online and was just playing around with it, like I said I'm really new to python and was just exploring. thank you so much though for your help! I really appreciate it. - stephen – sgldjj Jun 09 '18 at 00:10

1 Answers1

-1

Try this link http://pyqt.sourceforge.net/Docs/PyQt4/qtwebkit.html

The error message is typical if the module has not been imported in the script, or if an error in finding the module has occurred.