0

I am using pycharm and python3.10 and I have installed PyQt5 When using this snippet

import sys
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import QUrl
from PyQt5.QtWebEngineWidgets import QWebPage

I got an error: from PyQt5.QtWebEngineWidgets what should I do now and tried uninstalling it and reinstalling option but it didn't work so if I could have some help then it will be grateful to me, please.

1
  • Your question title doesn't match a valid import statement or error based on the code you are showing. Please provide the actual traceback. Besides, QWebPage has been deprecated for years, since the release of the QtWebEngine module for Qt 5.4 (using QWebEnginePage since then), which happened 8 (eight!) years ago. Commented Oct 16, 2022 at 19:08

1 Answer 1

1

The problem is in from PyQt5.QtWebEngineWidgets import QWebPage. QWebPage does not exist in the QtWebEngineWidgets module. Here are the classes that do exist:

    > CLASSES
    >     PyQt5.QtCore.QObject(sip.wrapper)
    >         QWebEngineDownloadItem
    >         QWebEnginePage
    >         QWebEngineProfile
    >     PyQt5.QtWidgets.QWidget(PyQt5.QtCore.QObject, PyQt5.QtGui.QPaintDevice)
    >         QWebEngineView
    >     sip.simplewrapper(builtins.object)
    >         QWebEngineCertificateError
    >         QWebEngineContextMenuData
    >         QWebEngineFullScreenRequest
    >         QWebEngineHistory
    >         QWebEngineHistoryItem
    >         QWebEngineScript
    >         QWebEngineScriptCollection
    >         QWebEngineSettings

Perhaps you intended to use QWebEnginePage? from PyQt5.QtWebEngineWidgets import QWebEnginePage does work.

Sign up to request clarification or add additional context in comments.

5 Comments

While the observation about QWebEnginePage instead of QWebPage is correct, that's not the actual issue. If that was the case, the error would have been cannot import name 'QWebPage'. The issue is before that, since it says that the module cannot be found.
@musicamante, when I ran the code in the post from PyQt5.QtWebEngineWidgets import QWebPage I get the error cannot import name 'QWebPage'. The post may have been edited, but I'm not seeing the module cannot be found issue at this time.
The point is not what you got, but what the OP did. The (original and unedited) title is clear: "Module Not Found Error: No module named 'PyQt5.QtWebEngineWidgets'"
Good call, @musicamante. I missed that. Not sure about that since I'm not able to replicate the error. I suspect that the error message being reported in the title is not the error message obtained from running the code shared in the post. Some other code must have been executed to get the error in the title.
I don't know if the behavior has changed in versions of Python than the (quite old) one I'm using right now, but the No module named error is normally returned when the base module is not found. So, either the OP didn't properly write the question (as the issue would be about PyQt5, not PyQt5.QtWebEngineWidgets), or the issue is somewhere else. I'm voting to close this post as unreproducible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.