Error using win10toast: pywintypes.error: (-2147467259, 'Shell_NotifyIcon', 'Unspecified error')

Error using win10toast: pywintypes.error: (-2147467259, 'Shell_NotifyIcon', 'Unspecified error')

我在任何地方都找不到关于此错误的任何信息,我正在尝试使用套接字进行简单的 TCP 聊天。我制作了一个功能,可以在用户屏幕上弹出通知。但是当我尝试 运行 它时,我得到这个错误:

Traceback (most recent call last): File "C:\Users\James\OneDrive\Documents\Projects\TCP chat\toas.py", line 4, in toaster.show_toast("Hello World!!!", File "C:\Users\James\AppData\Local\Programs\Python\Python39\lib\site-packages\win10toast_init_.py", line 127, in show_toast self.show_toast(title, msg, icon_path, duration) File "C:\Users\James\AppData\Local\Programs\Python\Python39\lib\site-packages\win10toast_init.py", line 106, in _show_toast Shell_NotifyIcon(NIM_ADD, nid) pywintypes.error: (-2147467259, 'Shell_NotifyIcon', 'Unspecified error')

我不知道它是什么,我所做的只是一个简单的“show_toast”:

mes = message[len(nickname)+9:]
msg = mes.split(": ")
print(f"{msg[0]}\n{msg[1]}")
t.show_toast(msg[0], msg[1])

有人可以帮忙吗?

编辑:

我的代码之前工作正常,只是突然停止工作了。我没有做任何事情或更改任何设置。

嘿,伙计,当你调用 t.show_toast() 函数时,你没有给它图标路径,该路径将在通知到来时显示,所以你可以添加 icon_path=None

所以你可以试试这个t.show_toast(msg[0], msg[1]), icon_path=None)

谢谢,希望对你有帮助, Jai hind jai bharat