Mainwindow.ui Error in fbs freeze

Created a UI using QT Designer, and copied it over to src/main/resources/base/mainwindow.ui

Getting this error:
Traceback (most recent call last):
File "", line 15, in <module>
File "PyQt5/uic/ **init** .py", line 199, in loadUiType
File "PyQt5/uic/Compiler/", line 111, in compileUi
File "PyQt5/uic/", line 1013, in parse
File "xml/etree/", line 1197, in parse
File "xml/etree/", line 587, in parse
FileNotFoundError: [Errno 2] No such file or directory: 'mainwindow.ui'
[61742] Failed to execute script main

Forgot to mention, fbs run works fine, but fbs freeze causes that traceback.

I load the ui into the app like this:

qtCreatorFile = "mainwindow.ui" # UI file here (has to be in same directory).
Ui_MainWindow, QtBaseClass = uic.loadUiType(qtCreatorFile)

And this is also included at the bottom:

if  __name__  == '__main__':
    appctxt = AppContext()
    stylesheet = appctxt.get_resource('mainwindow.ui')
    exit_code =

Since fbs is a wrapper around pyinstaller I would assume that pyinstaller is not able to locate that dependency. If using raw pyinstaller then you usually need to specify file & module dependencies if they are not included with an ‘import’ statement. Not sure about fbs, but this is my experience with pyinstaller

i think this is due to the relative path issue try this it works for me with fbs and freeze installers and running

qtCreatorFile = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), "mainwindow.ui")  # Type your file path
Ui_MainWindow, QtBaseClass = uic.loadUiType(qtCreatorFile)

Also can use the same approach for any other stuff you don’t want to use the application context for cached property thing for so when frozen the resources are still work