1

My Python code

I am running python .py file from cmd.

This is what I am running:

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

Error

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.

What I have tried

I have tried re-installing win32api but warning shows up Skipping win32api as it is not installed.

Python Version

I am running on the latest Python version (as of 01/11/2019): 3.8.0

LearningDev.
  • 372
  • 2
  • 10

0 Answers0