小编Aar*_*ill的帖子

Python看门狗脚本无法正常运行

我正在尝试使用Python Watchdog来监视目录中的更改.但是,当我尝试运行Quickstart示例时:

import time
from watchdog.observers import Observer
from watchdog.events import LoggingEventHandler

if __name__ == "__main__":
    event_handler = LoggingEventHandler()
    observer = Observer()
    observer.schedule(event_handler, path='.', recursive=True)
    observer.start()
    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        observer.stop()
    observer.join()
Run Code Online (Sandbox Code Playgroud)

通过输入文件test.py,我运行它的终端窗口中没有显示任何内容.是什么导致这种情况发生,我该如何解决?

python

9
推荐指数
1
解决办法
6290
查看次数

标签 统计

python ×1