使用 win10toast 时出错:pywintypes.error: (-2147467259, 'Shell_NotifyIcon', 'Unspecified error') [英] Error using win10toast: pywintypes.error: (-2147467259, 'Shell_NotifyIcon', 'Unspecified error')
问题描述
我在任何地方都找不到有关此错误的任何信息,我正在尝试与套接字进行简单的 TCP 聊天.我制作了一个功能,可以在用户屏幕上弹出通知.但是当我尝试运行它时,出现此错误:
I couldn't find anything anywhere about this error, I am trying to make a simple TCP chat with socket. I have made a function that makes a notification pop up on a users screen. But when I try to run it, I get this error:
回溯(最近一次调用最后一次):文件C:\Users\James\OneDrive\Documents\Projects\TCP chat\toas.py",第 4 行,在toaster.show_toast("Hello World!!!",文件C:\Users\James\AppData\Local\Programs\Python\Python39\lib\site-packages\win10toast_init_.py",第 127 行,在 show_toastself.show_toast(title, msg, icon_path, duration)文件C:\Users\James\AppData\Local\Programs\Python\Python39\lib\site-packages\win10toast_init.py",第 106 行,在 _show_toastShell_NotifyIcon(NIM_ADD,nid)pywintypes.error: (-2147467259, 'Shell_NotifyIcon', 'Unspecified error')
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":
I don't know what it is, all I'm doing is a simple "show_toast":
mes = message[len(nickname)+9:]
msg = mes.split(": ")
print(f"{msg[0]}\n{msg[1]}")
t.show_toast(msg[0], msg[1])
有人可以帮忙吗?
我的代码之前运行良好,但突然停止工作.我没有做任何事情或更改任何设置.
My code was working fine before, it just suddenly stopped working. I didn't do anything or change any settings.
推荐答案
嘿,伙计,当你调用 t.show_toast()
函数时,你没有给它提供通知时将显示的图标路径来所以你可以添加 icon_path=None
Hey buddy when you are calling t.show_toast()
function you are not giving it the icon path which will be shown when notification comes so you can just add icon_path=None
所以你可以试试这个 t.show_toast(msg[0], msg[1]), icon_path=None)
谢谢我希望它有所帮助,Jai 后 jai bharat
Thanks I hope it helped, Jai hind jai bharat
这篇关于使用 win10toast 时出错:pywintypes.error: (-2147467259, 'Shell_NotifyIcon', 'Unspecified error')的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!