My problem is the following, while i can set any icon i like on the executable itself, i cannot change this one
I have tried everything but when i select the exe file or when i create a shortcut this PyInstaller icon will come up!
Here is how the exe looks itself
Here is the tricky part, this DOES NOT happen if i set the option --onefile. If i generate the stand-alone exe, this "additional" unwanted icon goes away!
and here is the spec file in case you need it:
# -*- mode: python -*-
a = Analysis(['Backpack.py'],
pathex=['C:\\Users\\Angelo\\Desktop\\PyInstaller-2.1\\Backpack'],
hiddenimports=[],
hookspath=None,
runtime_hooks=None)
a.datas += [('back_ico_3.ico', 'C:\\Users\\Angelo\\Desktop\\PyInstaller-2.1\\back_ico_3.ico', 'DATA')]
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='Backpack.exe',
debug=False,
strip=None,
upx=True,
console=False , icon='back_ico_3.ico')
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=None,
upx=True,
name='Backpack')
Use the --icon argument to specify a custom icon for the application. It will be copied into the Resources folder. (If you do not specify an icon file, PyInstaller supplies a file icon-windowed. icns with the PyInstaller logo.)
Click the “Action” menu and then select “Replace Icon.” In the Replace Icon window, click the “Open file with new icon” button and browse to the location of the icon you want to use. The source can be an EXE, DLL, RES, or ICO file. After you've selected the icon, it's displayed in the Replace Icon window.
The most common reason a PyInstaller package fails is that PyInstaller failed to bundle a required file. Such missing files fall into a few categories: Hidden or missing imports: Sometimes PyInstaller can't detect the import of a package or library, typically because it is imported dynamically.
The spec file tells PyInstaller how to process your script. It encodes the script names and most of the options you give to the pyinstaller command. The spec file is actually executable Python code. PyInstaller builds the app by executing the contents of the spec file.
I had this same problem, even when using --onefile
. Cutting and pasting the .exe into a fresh directory worked.
Try deleting IconCache.db
and rebooting if it still doesn't display your custom icon. It's in %localappdata%
.
Enable Hidden Items
Go to C:\Users\User\AppData\Local\Microsoft\Windows\Explorer
. Select all files that begin with iconcache and thumbcache and delete all these files
Go to C:\Users\user\AppData\Local
and delete IconCache.db
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