Python Forum
PyQt5 Error - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: PyQt5 Error (/thread-29147.html)



PyQt5 Error - Harshil - Aug-20-2020

This Is Code I AM Runing
from PyQt5.Widgets import *
Error:
Error:
Traceback (most recent call last): File "C:\Users\DELL\Desktop\Python_Projects\Learning PyQt5\PyQt5.py", line 1, in <module> from PyQt5.Widgets import * File "C:\Users\DELL\Desktop\Python_Projects\Learning PyQt5\PyQt5.py", line 1, in <module> from PyQt5.Widgets import * ModuleNotFoundError: No module named 'PyQt5.Widgets'; 'PyQt5' is not a package
Problem: How to solve this?


RE: PyQt5 Error - buran - Aug-20-2020

your file is named PyQt5.py - that's mistake because it override the package you want to use. Rename your file


RE: PyQt5 Error - Harshil - Aug-20-2020

(Aug-20-2020, 09:58 AM)buran Wrote: your file is named PyQt5.py - that's mistake because it override the package you want to use. Rename your file

Ok I Try It.

I got Problem file name is PyQt5.py I renamed to lol.py
But Another Problem Stand is
Error:

I got Problem file name is PyQt5.py I renamed to lol.py
But Another Problem Stand is
Error:
Traceback (most recent call last): File "c:\Users\DELL\Desktop\Python_Projects\Learning PyQt5\lol.py", line 1, in <module> from PyQt5.Widgets import * ModuleNotFoundError: No module named 'PyQt5.Widgets'



RE: PyQt5 Error - deanhystad - Aug-20-2020

QtWidgets, not Widgets.

And from XXX import * is a really bad practice.


RE: PyQt5 Error - Axel_Erfurt - Aug-20-2020

must be

from PyQt5.QtWidgets import *