0

First, I am a Korean Student. So I'm not good at English. Sorry, Please excuse me.

I'm Using PyQt5 and pyinstaller. I made exe file using this code: pyinstaller --noconfirm --onefile --console --paths "C:/Users/jun/Desktop/lee/Programing/python/dll" --hidden-import "nbt.world" "C:/Users/jun/Desktop/lee/Programing/python/Auto_Submit_dev1.py"

but I can't execute the exe file with this error.

I checked many similar questions and answers like this, It doesn't work tho.

Below is part of my code:

def resource_path(relative_path):
    """ Get absolute path to resource, works for dev and for PyInstaller """
    try:
        # PyInstaller creates a temp folder and stores path in _MEIPASS
        base_path = sys._MEIPASS
        print(base_path)
    except Exception:
        base_path = os.path.abspath(".")
        


    return os.path.join(base_path, relative_path)

macUI = resource_path("autosubmit.ui")

Ui_MainWindow = uic.loadUiType(macUI)[0]

class MainDialog(QMainWindow, Ui_MainWindow):
    def __init__(self):
        super().__init__()
        self.setupUi(self)

How can I execute the exe file? (.py is working and .UI file and .py file is in the same folder)

1 Answers1

0

Your exe file does not find autosubmit.ui file add this --> --add-data="autosubmit.ui;."

pyinstaller --noconfirm --onefile --console --add-data="autosubmit.ui;." --paths "C:/Users/jun/Desktop/lee/Programing/python/dll" --hidden-import "nbt.world"  "C:/Users/jun/Desktop/lee/Programing/python/Auto_Submit_dev1.py"
virxen
  • 408
  • 4
  • 12