1

Our Programs is not always a Python source file !. The Python may be associated with a file or an image, that is located inside the source of the application to the file path inside the package. For example, when setting the application icon in Tkinter Or Include image for app background


    root.iconbitmap('favicon.ico')
    PhotoImage(file = 'python_logo.gif')

In Pyinstaller only the source file expires in the exe format. If the program contains a file or image path inside the source, then the program will not be executed , In that event,The source of the application and files are in a package (on a route).

Please provide a solution to this problem, So as possible convert a package containing source and file into exe

Jason
  • 11
  • 5

2 Answers2

0

1-Install cx_Freeze, (open your command prompt and type pip install cx_Freeze

2-Install idna, (open your command prompt and type pip install idna.

3-Write a .py program named myprogram.py

4-Create a new python file named setup.py on the current directory of your script.

5-In the setup.py, code below and save it.

6-With shift pressed right click on the same directory, so you are able to open a command prompt window.

7-In the prompt, type python setup.py build

8-If your script is error free, then there will be no problem on creating application.

9-Check the newly created folder build. It has another folder in it. Within that folder you can find your application. Run it. Make yourself happy.

this works on python 3.5 and above!

Add heres the open source project to convert to exe https://github.com/brentvollebregt/auto-py-to-exe

Jose Antonio
  • 840
  • 14
  • 25
  • 1
    thanks for the reply. in the cx_freeze: I did these steps, and the conversion was done, But the program is not running, If the code is healthy, It runs as a Python source, But it does not work after the conversion. – Jason Sep 25 '18 at 15:22
0

I have not used Pyinstaller myself but in cx_Freeze I know you can include none project files like images in the setup file. With Pyinstaller you want to look into the spec file. Here is a link to the docs where it talks about added files to project. https://pythonhosted.org/PyInstaller/spec-files.html#adding-files-to-the-bundle I hope thisis of some help.

Boomatang
  • 59
  • 8
  • It does not matter which module is used, It is important that there be a way to this format conversion – Jason Sep 25 '18 at 15:41