I am running a Python source node that uses Watchdog to verify that a file has been added to my downloads folder.
My code works fine in Jupyter Notebook but it seems that the Watchdog part of my code is just getting skipped entirely in the Python Source node.
Is there a known issue with Watchdog and watching a directory from inside of KNIME?
Thanks!
Code Snippet:
from watchdog.observers import Observer
from watchdog.events import RegexMatchingEventHandler
class ExampleHandler(RegexMatchingEventHandler):
def on_modified(self, event):
downloads = event.src_path
if len(downloads) >= 1:
observer.stop()
browser.quit()if name == “main”:
pattern = ‘.311_4_..zip’
event_handler = ExampleHandler(regexes=[pattern], ignore_directories=True)
observer = Observer()
path = r"C:\Users\Downloads"
observer.schedule(event_handler, path, recursive=True)
observer.start()
observer.join()