Wanderson-Magalhaes / Simple_PySide_Base

MIT License
752 stars 183 forks source link

This is the possible issue that can occur when using PyQT5 with pyside [issue:resolved] #2

Closed erprashantkumar85 closed 4 years ago

erprashantkumar85 commented 4 years ago

If you are using PyQT5 with Pyside2 then following issue is raised:

qt.qpa.plugin: Could not load the Qt platform plugin "windows" in "" even though it was found. This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. Available platform plugins are: direct2d, minimal, offscreen, windows.

The Solution is to add the following lines in the beginning of the main.py

-------------------------------------------------------------

import os import PySide2

dirname = os.path.dirname(PySide2.file) plugin_path = os.path.join(dirname, 'plugins', 'platforms') os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = plugin_path

-------------------------------------------------------------

Wanderson-Magalhaes commented 4 years ago

I think it is not recommended to use PyQt5 and PySide2 together for several reasons, mainly because they are not 100% compatible and if you want to generate an executable you can go over 200mb because both PySide2 and PyQt5 have about 100mb, together 200mb. It is not a design error in this case!