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.
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)
以.ico格式下载图标,当我以.png格式下载然后将扩展名更改为.ico时遇到了同样的问题
Just name the icon file as "icon" only. it recognise it as icon.ico.
Your Location look like this - C:\Users\Santiago\Pictures\
Simply Change 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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.