Python Forum
helping PyInstaller To Find files - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: helping PyInstaller To Find files (/thread-29367.html)



helping PyInstaller To Find files - Harshil - Aug-30-2020

Hey! I Have Problem I Am Using Pyinstaller To Make Exe But There Is Problem That I Have Some Ui files(because i am using pyqt5)
and i want to implement that if that files are not in folder that mainscript.py is then check it in Ui folder
Any Thoughts Plz?

Code I Thought:
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
        except Exception:
            base_path = os.path.abspath(".")

        return os.path.join(base_path, relative_path)