Apr-24-2024, 06:23 PM
Quote:Also, I cannot use the path 'E:/DataLogging/test.xlsx' but I can use 'E:/DataLogging/', which is the directory, and not the specific file. I'm sure there is an easy fix for this, but I cannot find the fix yet.watchdogs looks for changes to the file system, not to files. If you want to ignore modification events for other files in E:\Datalogging, you'll have to write that into your event callback.
def callback(event): """Print message if test.txt is modified.""" if Path(event.src_path).name == "test.txt": print("File changed!!!") event_handler = LoggingEventHandler() event_handler.on_modified = callback observer = Observer() observer.schedule(event_handler, ".") observer.start()