I'm trying to make a toast notification on win 10 with python. However, every time I try, I got an error that involves something called "shell notify icon". And when I mean every time... I tried with every library I could find ! Notifypy, pynotifier, win10toast, plyer, etc... Every time, the same or approximatively same error involving shell notify icon...
Here is one of those errors :
>>> Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Users\Elève\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 926, in _bootstrap_inner
self.run()
File "C:\Users\Elève\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Elève\AppData\Local\Programs\Python\Python37-32\lib\site-packages\plyer\platforms\win\libs\balloontip.py", line 206, in balloon_tip
WindowsBalloonTip(**kwargs)
File "C:\Users\Elève\AppData\Local\Programs\Python\Python37-32\lib\site-packages\plyer\platforms\win\libs\balloontip.py", line 139, in __init__
self.notify(title, message, app_name)
File "C:\Users\Elève\AppData\Local\Programs\Python\Python37-32\lib\site-packages\plyer\platforms\win\libs\balloontip.py", line 188, in notify
raise Exception('Shell_NotifyIconW failed.')
Exception: Shell_NotifyIconW failed.
Now look at the first line, it says something about Threads ! That's because I played with threads for my application, do you think that's why it's messed up ? How could I see and clean all my threads ?
Some people already asked this question, here :
pywintypes.error: (-2147467259, 'Shell_NotifyIcon', 'Unspecified error') win10toast python
But nobody answered, and here is another one where the creator of the library answered but didn't help :
Why is this simple python toast notification not working?
On this last link, the solution says :
I discovered the solution to my question.
The toast notifications have been suppressed by Windows 10 Action Center.
At the bottom right corner, click the Action Center icon.
For my PC, the "Quiet Hours" setting was turned on. After I disable "Quiet Hours",
toast notifications can appear.
The python library win10toast works perfectly fine after Action Center settings are correctly set
But my code was working a bit before all those errors started appearing, and I could show some toasts, so that's not the point... Here's my code by the way :
from pynotifier import Notification
Notification(title='HEAD', description="BODY", duration=3, urgency=Notification.URGENCY_CRITICAL).send()
It was working fine, as I said... Until I started touching to the icon_path argument, because I wanted to add an icon. Since then, errors... Is "shell notify icon" related to the icon I tried to change ? I don't even know really what it is !
So, if you could help me get a stable and working code, that would be awesome ! Thanks by advance.
EDIT : Ok now real wtf... I restarted my computer, it worked perfectly, and later on the day, stoped working... The worked again... And so on ! @.@