Python Forum
Cannot Change Python script to exe using Pyinstaller - 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: Cannot Change Python script to exe using Pyinstaller (/thread-23275.html)



Cannot Change Python script to exe using Pyinstaller - omar_mohsen - Dec-19-2019

I have done a code with python 3.5.4 version and I try to change the script to execution file using pyinstaller 3.5 and after changing the code to exe. this message appears
Quote:pkg_resources.DistributionNotFound: The 'Adafruit_IO' distribution was not found and is required by the application
I tried this piece of code in order to find Adafruit_IO in my script
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)
I point at the file location at site-packages still I get the same error any help would be appreciated


RE: Cannot Change Python script to exe using Pyinstaller - Larz60+ - Dec-19-2019

install adafruit-io (from command line)
pip3 install adafruit-io



RE: Cannot Change Python script to exe using Pyinstaller - omar_mohsen - Dec-19-2019

Thank you, sir, but I have already done this step I have built a code that works as a script


RE: Cannot Change Python script to exe using Pyinstaller - buran - Dec-19-2019

read carefully https://pyinstaller.readthedocs.io/en/stable/runtime-information.html

there is nice example script that would help you to see what you should use
https://pyinstaller.readthedocs.io/en/stable/runtime-information.html#using-sys-executable-and-sys-argv-0