I am using Py2exe to create a Windows .exe from my Python script. I would like to have the copyright information as well as the product version, description, etc. I've been able to get everything to show (in the Properties > Details of the exe), except for the copyright information. I've tried the following with no success:
from distutils.core import setup
import py2exe
import sys
if len(sys.argv) == 1:
sys.argv.append("py2exe")
sys.argv.append("-q")
class Target:
def __init__(self, **kw):
self.__dict__.update(kw)
# for the versioninfo resources
self.version = "1.0.0.0"
self.company_name = "ACME."
self.copyright = "Copyright (c) 2014 ACME."
self.name = "My Program"
# create an instance of class Target
# and give it additional needed info
target = Target(
description = "Test Description",
# this is your code file
script = "Main.py",
# this will form TestProgram.exe
dest_base = "TestProgram")
setup(
options = {'py2exe': {'bundle_files': 1,
'compressed': 1}},
console = [{'script': "Main.py"}],
zipfile = None,
)
When using this method I get the File Description, Product Name, and Product version in the PROPERTIES > DETAILS of the .exe but I am missing the copyright.
I got the following to work. I realized I didn't set the target right. Fixed at the bottom where I did console = [target]
.
from distutils.core import setup
import py2exe
import sys
if len(sys.argv) == 1:
sys.argv.append("py2exe")
sys.argv.append("-q")
class Target:
def __init__(self, **kw):
self.__dict__.update(kw)
self.version = "1.0.0.0"
self.company_name = "ACME."
self.copyright = "Copyright (c) 2014 ACME."
self.name = "My Program"
target = Target(
description = "Test Description",
script = "Main.py",
dest_base = "TestProgram")
setup(
options = {'py2exe': {'bundle_files': 1,
'compressed': True}},
zipfile = None,
console = [target]
)
user2643864's answer is more complicated than it needs to be. jgritty's answer is nearly there, and only needs simple modification, adding a couple of entries in the dictionary assigned to console
:
from distutils.core import setup
import py2exe
setup(
options = {'py2exe': {'bundle_files': 1,
'compressed': 1}},
console = [{
'script': 'Main.py',
'copyright': 'Copyright (C) 2016 ACME Pty Ltd',
'company_name': 'ACME Pty Ltd',
}],
zipfile = None,
version = '1.0.0.0',
name = 'My Program',
description = 'Test Description',
)
I think there's something really wrong with your code, because it doesn't update the File Description, Product Name, and Product version in the exe. However, this code does:
from distutils.core import setup
import py2exe
setup(
options = {'py2exe': {'bundle_files': 1,
'compressed': 1}},
console = [{'script': "Main.py"}],
zipfile = None,
version = "1.0.0.0",
name = "My Program",
description = "Test Description",
)
To put the company name and copyright info into the executable is more challenging, and unfortunately, I don't know how to do that yet. This might be useful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With