After compiling my code with pyinstaller, I seem to no longer be able to reference my promoted widget, as the qobjectcreator
module lost track of where the header of the promoted widget is, presumably because pyinstaller moves the dependencies a bit and the code structure became messed up. Here is what my file structure looks like (before compilation):
application
├── app.py
├── folder1
│ ├── promotedWidget.py
│ └── dialog.py
├── uifolder
│ ├── app.ui
│ └── dialog.ui
└── app.spec
Note, the ui that contained the widget promotion is dialog.ui
, and it made a reference to promotedWidget.py
with the header folder1/promotedWidget
in Qt Designer. This worked when I run app.py
normally, the dialog opened with no issues but when I tried to run it after compilation the following error occured:
Traceback (most recent call last):
File "app.py", line 61, in createNewModel
File "folder1\dialog.py", line 25, in __init__
File "PyQt5\uic\__init__.py", line 238, in loadUi
File "PyQt5\uic\Loader\loader.py", line 66, in loadUi
File "PyQt5\uic\uiparser.py", line 1037, in parse
File "PyQt5\uic\uiparser.py", line 828, in createUserInterface
File "PyQt5\uic\uiparser.py", line 806, in traverseWidgetTree
File "PyQt5\uic\uiparser.py", line 503, in createLayout
File "PyQt5\uic\uiparser.py", line 806, in traverseWidgetTree
File "PyQt5\uic\uiparser.py", line 503, in createLayout
File "PyQt5\uic\uiparser.py", line 806, in traverseWidgetTree
File "PyQt5\uic\uiparser.py", line 546, in handleItem
File "PyQt5\uic\uiparser.py", line 806, in traverseWidgetTree
File "PyQt5\uic\uiparser.py", line 264, in createWidget
File "PyQt5\uic\uiparser.py", line 228, in setupObject
File "PyQt5\uic\objcreator.py", line 100, in createQObject
File "PyQt5\uic\objcreator.py", line 125, in findQObjectType
File "PyQt5\uic\Loader\qobjectcreator.py", line 113, in search
ModuleNotFoundError: No module named 'folder1\promotedWidget'
Has anyone encountered the same issue before, and if yes what was your solution?