Koushik Deb
Koushik Deb

Reputation: 330

No error while adding icon to EXE file with Pyinstaller Spec,still icon is not showing

I am new to pyinstaller. While I was compiling my exe file I got no error. Output at compilation time

I have added logo path to spec file.

exe = EXE(pyz,
      a.scripts,
      a.binaries,
      Tree('exp','exp'),
      a.zipfiles,
      a.datas,
      name='Screen2text',
      debug=False,
      bootloader_ignore_signals=False,
      strip=False,
      upx=True,
      upx_exclude=[],
      runtime_tmpdir=None,
      console=False,
      icon=r'D:\backup\logo.ico')

But after compiling,I can't see that logo on my exe file.Size of my logo file is 423KB. Am I missing something?

Upvotes: 4

Views: 4569

Answers (2)

Peyman Majidi
Peyman Majidi

Reputation: 1985

Actually the icon has changed, but the Windows File Explorer cached the old icon and does not display the new one.
Things to do: Just rename the file, File explorer will update the icon and you will sure the new icon has set or not.

screenshot

Upvotes: 12

mecaloza
mecaloza

Reputation: 31

Try this, in the console oin the path o your project:

if you want the executable in one file(slower start): pyinstaller.exe --onefile --windowed --icon="your_icon_file".ico "your_python_script".py

if you want the executable in one folder(faster start): pyinstaller.exe --onedir --windowed --icon="your_icon_file".ico "your_python_script".py

this wil create a folder call "dist" where your .exe will be,

pd: whith the --onedir command you will see all your dependencies in that folder, if you have a simple script you can use the first option.

Upvotes: 2

Related Questions