Windows-10-Toast-Notifications
Windows-10-Toast-Notifications copied to clipboard
ClassAtom missing
'ToastNotifier' object has no attribute 'classAtom'
Try to close and open python
At least one other person has had this problem: https://stackoverflow.com/questions/50741455/toastnotifier-object-has-no-attribute-classatom
This appears to occur when the initial assignment of classAtom
fails at https://github.com/jithurjacob/Windows-10-Toast-Notifications/blob/master/win10toast/init.py#L78. Since the except block does nothing but pass, we don't know any details about the error that RegisterClass is throwing. It might be nice to remove the try and except. It wouldn't solve the underlying problem, but it would make it easier to diagnose.
Run into the same promlem. Here's the detailed exception:
Exception in thread Thread-2:
Traceback (most recent call last):
File "C:\Users\username\AppData\Local\Programs\Python\Python37\lib\threading.py", line 917, in _bootstrap_inner
self.run()
File "C:\Users\username\AppData\Local\Programs\Python\Python37\lib\threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\username\AppData\Local\Programs\Python\Python37\lib\site-packages\win10toast\__init__.py", line 83, in _show_toast
self.hwnd = CreateWindow(self.classAtom, "Taskbar", style,
AttributeError: 'ToastNotifier' object has no attribute 'classAtom'
In my case I lazily was creating a ToastNotifier
instance for each notification. Then RegisterClass
tells me that the registration has already been done, so it can't register again. So just make sure you create only a single instance of ToastNotifier
.
Thanks @akeeman, I was also doing that! Maybe changing the modus operandi to something like a singleton might protect other people from making the same mistake