Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QWidget: Must construct a QApplication before a QWidget #8

Open
aboharbf opened this issue Mar 7, 2024 · 3 comments
Open

QWidget: Must construct a QApplication before a QWidget #8

aboharbf opened this issue Mar 7, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@aboharbf
Copy link

aboharbf commented Mar 7, 2024

Initialized a Conda environment with Python 3.11 (you should put the req'd version somewhere, I ran into a bunch of issues doing 3.10). Installed the reqs, opened the folder in vs code. Either hitting play on the main.py or putting python main.py triggers

'QWidget: Must construct a QApplication before a QWidget'.

Doing the recommended python -m main.py gets me:
C:\Users\XXX\anaconda3\envs\yt\python.exe: Error while finding module specification for 'main.py' (ModuleNotFoundError: __path__ attribute not found on 'main' while trying to find 'main.py'). Try using 'main' instead of 'main.py' as the module name.

Doing as recommended (python -m main) gets me the same as the first error.

@douglaskdonaldson
Copy link

Same issue installing in a fresh 3.10 pyenv virtualenv. I pulled today's change to requirements.txt and experienced exactly the same error from a fresh install.

I tried in VS Code and via python -m main after a successful installation.

@rohankishore
Copy link
Owner

Damn this's happening to a lot of users huh. I think it might be the import statements:

from downloader import YoutubeVideo
from settings import SettingsPage
from playlist import YoutubePlaylist
from get_captions import CaptionWidget

since I'm directly importing the QWidgets. I'll update the code to not directly import the QWidgets (although it's running just fine in my PC)

rohankishore added a commit that referenced this issue Mar 7, 2024
Possible fix for #8. 

```QWidget: Must construct a QApplication before a QWidget```
@rohankishore rohankishore added the bug Something isn't working label Mar 7, 2024
@aboharbf
Copy link
Author

aboharbf commented Mar 7, 2024

Continuing here from the comment on the latest push.
Commenting out the 'super().init()' gets me 'super-class init() of type Window was never called' on the fxn call right after (self.setTitleBar(CustomTitleBar(self))).
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants