我的Python代码
我正在从cmd运行python .py
文件。
这是我正在运行的:
import os, time
from win10toast import ToastNotifier
path_to_watch = '//SERVER/shared_data/Technical/Label Sign Off Sheets/sign off project/To Sign'
before = dict ([(f, None) for f in os.listdir (path_to_watch)])
toaster = ToastNotifier()
while 1:
time.sleep (10)
after = dict ([(f, None) for f in os.listdir (path_to_watch)])
added = [f for f in after if not f in before]
removed = [f for f in before if not f in after]
if added: toaster.show_toast(str(added))
if removed: print("Removed: ", ", ".join (removed))
before = after
错误
Traceback (most recent call last):
File "C:\Users\label\Desktop\Sign off project\test2.py", line 2, in <module>
from win10toast import ToastNotifier
File "C:\Users\label\AppData\Local\Programs\Python\Python38-32\lib\site-packages\win10toast\__init__.py", line 19, in <module>
from win32api import GetModuleHandle
ImportError: DLL load failed while importing win32api: The specified module could not be found.
我尝试过的事情
我尝试重新安装win32api
,但警告显示Skipping win32api as it is not installed.
Python版本
我正在使用最新的Python版本(截至2019年11月11日):3.8.0