Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No longer limit an icon to 10 images #9

Merged
merged 1 commit into from
May 22, 2019
Merged

No longer limit an icon to 10 images #9

merged 1 commit into from
May 22, 2019

Conversation

LeonarddeR
Copy link
Contributor

See also nvaccess/nvda#8375 (comment)

I'm getting the following error from py2exe when trying to integrate our ico file into the executables:
Traceback (most recent call last): File "setup.py", line 225, in + getRecursiveDataFiles('documentation', '../user_docs', excludes=('*.t2t', '*.t2tconf', '*/developerGuide.*')) File "c:\python37\lib\distutils\core.py", line 148, in setup dist.run_commands() File "c:\python37\lib\distutils\dist.py", line 966, in run_commands self.run_command(cmd) File "c:\python37\lib\distutils\dist.py", line 985, in run_command cmd_obj.run() File "setup.py", line 97, in run super(py2exe, self).run() File "c:\python37\lib\site-packages\py2exe\distutils_buildexe.py", line 192, in run self._run() File "c:\python37\lib\site-packages\py2exe\distutils_buildexe.py", line 273, in _run builder.build() File "c:\python37\lib\site-packages\py2exe\runtime.py", line 235, in build self.build_exe(target, exe_path, options.libname) File "c:\python37\lib\site-packages\py2exe\runtime.py", line 377, in build_exe for res_type, res_name, res_data in BuildIcons(getattr(target, "icon_resources", ())): File "c:\python37\lib\site-packages\py2exe\icons.py", line 124, in BuildIcons grp_header = CreateGrpIconDirHeader(header, id_generator) File "c:\python37\lib\site-packages\py2exe\icons.py", line 90, in CreateGrpIconDirHeader raise ValueError("too many images for this icon: %d" % iconheader.idCount) ValueError: too many images for this icon: 11

It turns out that the current py2exe somehow limits the number of images to 10, without giving a proper rationale for it. This code was introduced in bc4c86f, which is a really huge commit.

With this pr, the error during build does no longer occur. Our ico contains 11 images, starting at resource id 10 and ranging up to and including 20. Inspection of the Python2 based executables reveals that the first image is saved with resource id 11, ranging up to and including 21. I'm reporting it just in case it would make a difference, which I think it doesn't.

@albertosottile
Copy link
Member

Your patch seems fine, yet I wonder why this limit was introduced in the first place. Having worked only with single-image .ico files, I honestly have no idea. For now, I am going to pull this, hoping that it does not cause other bugs in the future.

Thank you very much for addressing and solving this so quickly!

@albertosottile albertosottile merged commit 786c4d3 into py2exe:master May 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants