pythonpyinstallerexeexecutableico

'win32ctypes.pywin32.pywintypes.error: (87, 'UpdateResource', 'The parameter is incorrect')' error when assigning icon with pyinstaller


I am using pyinstaller to create an executable from a .py file type and attaching an icon to it using the command

pyinstaller.exe --onefile --windowed --icon="test.ico" test.py

The '.ico' is 500px by 500px and 24bit depth and was created with Photoshop and exported as a '.bmp' and then manually changed to a '.ico' and worked fine when assigned to a folder but when trying to assign it to the pyinstaller executable I keep getting the error:

raise error(exception.winerror, exception.function, exception.strerror)
win32ctypes.pywin32.pywintypes.error: (87, 'UpdateResource', 'The parameter is incorrect')

How to fix this?


Solution

  • After further investigation it appears that the icon file was not generated correctly. If anyone is having this issue use: icoconverter.com to convert your image properly