I faced the same issue, but with win10toast_click module.
I traced the following exception's call stack:
Traceback (most recent call last):
File "main.py", line 123, in <module>
File "main.py", line 116, in main
File "main.py", line 101, in check_query
File "main.py", line 84, in notify
File "win10toast_click\__init__.py", line 162, in show_toast
File "win10toast_click\__init__.py", line 127, in _show_toast
File "pkg_resources\__init__.py", line 1130, in resource_filename
File "pkg_resources\__init__.py", line 342, in get_provider
File "pkg_resources\__init__.py", line 886, in require
File "pkg_resources\__init__.py", line 772, in resolve
pkg_resources.DistributionNotFound: The 'win10toast_click' distribution was not found and is required by the application
And I found out that in file win10toast_click\__init__.py
, line 127, in _show_toast
function, it's failing to retrieve the icon or something (resource_filename
is failing at the 'else' clause):
# icon
if icon_path is not None:
icon_path = path.realpath(icon_path)
else:
icon_path = resource_filename(Requirement.parse("win10toast_click"), "win10toast_click/icon/notification.ico")
icon_flags = LR_LOADFROMFILE | LR_DEFAULTSIZE
So what I did is to copy the icon file from that path, and paste it into my project's main folder, then I specified the icon_path
to that new path when calling the show_toast
method, like this: toaster.show_toast(title, msg, icon_path='notification.ico')
On my machine, the icon's original path is: C:\Users\<USER>\AppData\Local\Programs\Python\Python39\Lib\site-packages\win10toast_click\icon\notification.ico