Could not load icon plyer library

Viewed 1986

I have a little problem with Plyer library, I'm trying to custom a notification's appereance but evrything is okay until I try to replace the default icon of the notification, here's my code:

from plyer import notification
notification.notify(title='Managen', message='Notification',app_icon = r'C:\Users\Santiago\Pictures\icon.ico',timeout = 10)

This is the output:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "C:\Users\Santiago\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "C:\Users\Santiago\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\Santiago\AppData\Local\Programs\Python\Python38-32\lib\site-packages\plyer\platforms\win\libs\balloontip.py", line 208, in balloon_tip
    WindowsBalloonTip(**kwargs)
  File "C:\Users\Santiago\AppData\Local\Programs\Python\Python38-32\lib\site-packages\plyer\platforms\win\libs\balloontip.py", line 132, in __init__
    raise Exception('Could not load icon {}'.format(app_icon))
Exception: Could not load icon C:\Users\Santiago\Pictures\icon.ico

I don't know what is exactly happening, if you could help me it'd be great, beforehand thanks.

5 Answers

Looks like your icon is not in the path:

C:\Users\Santiago\Pictures\

or its name is different. Just double check.

I get the same Exception if I move the file or rename it, but the notification icon shows when I have icon.ico in the same dir as the .py file and I use your code like that:

notification.notify(title='Managen', message='Notification', app_icon = r'icon.ico', timeout = 10)

Download the icon in .ico format, I was having the same problem when I downloaded in the .png format and then changed extension to .ico

Just name the icon file as "icon" only. it recognise it as icon.ico.

Your location looks like this: C:\Users\Santiago\Pictures\

Simply change it to this: C:/Users/Santiago/Pictures/

I was getting the same error, but I resolved it.

If you have changed a png file to icon file manually, please try the below solution

Solution:
Just convert your png file to an icon file using an online ping to icon converter and use it.

Problem:
I am not sure, but it may happen because of the size of the original ping and its original file format.

I hope you've solved it

Happy coding <3

Related