Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

py2exe change application name output

Tags:

python

py2exe

I am working on my first Python project and I need compile with py2exe. I wrote this setup.py code :

from distutils.core import setup
import py2exe
import sys
import os 

if len(sys.argv) == 1:
    sys.argv.append("py2exe")

setup( options = {"py2exe": {"compressed": 1, "optimize": 2,"dll_excludes": "w9xpopen.exe",'dist_dir': "myproject", "ascii": 0, "bundle_files": 1}},
       zipfile = None,

       console = [
        {
            "script": "myapplication.py",                    ### Main Python script    
            "icon_resources": [(0, "favicon.ico")]     ### Icon to embed into the PE file.
        }
    ],)

os.system('upx -9 dist/*.exe')
os.system("rmdir /s /q build")
os.system("del /q *.pyc")

The setup code is working, but I need to change the name of the compiled application from myapplication to project.exe. What options for py2exe change the name of output application?

like image 251
kingcope Avatar asked Mar 31 '14 15:03

kingcope


1 Answers

Add "dest_base" : "app_name" to your console dict as such:

   console = [
    {
        "script": "myapplication.py",                    ### Main Python script    
        "icon_resources": [(0, "favicon.ico")], ### Icon to embed into the PE file.
        "dest_base" : "app_name"
    }]
like image 176
Chengy Avatar answered Oct 22 '22 12:10

Chengy