我试图在Windows上为我的python程序使用看门狗模块,但它看起来效果不好......
我安装了看门狗模块,我检查了我在这里创建了watchdog-0.8.0-py3.4.egg:
C:\ Python34 \ LIB \站点包\看门狗0.8.0-py3.4.egg \看门狗
首先使用简单的代码:
import logging
import logging.handlers
import time
from watchdog.observers import Observer
print("hello")
但是,当我启动main.py程序时,我有这个导入错误:
Traceback <most recent call last>:
Dile "D:\Script\main.py" line 4, in <module>
import watchdog.observers
ImportError : No module named watchdog.observers
然后我把看门狗文件夹从C:\Python34\Lib\site-packages\watchdog-0.8.0-py3.4.egg\watchdog
放到与我的main.py文件相同的文件夹中,我还有一个错误:
Trancebok <most recent call last>:
File "D:\Script\main.py", line 4 in <module>
import watchdog.observers
File "D:\script\watchdog\observers\__init__.py", line 79, in <module>
from .polling import PollingObserver as Observer
File "D:\script\watchdog\observers\polling.py", line 50, in <module>
from watchdog.events import <
File "D:\script\watchdog\events.py", line 91, in <module>
drom pathtools.patterns import match_any_paths
importError: No module named pathtool.patters
有人可以帮我解决这个错误吗?
C:\Python34\Lib\site-packages\watchdog-0.8.0-py3.4.egg\watchdog
移动到与我的main.py文件相同的文件夹,这是正常的吗?