异步看门狗

wcpan.watchdog的Python项目详细描述


在wcpan.watchdog在

使用asyncio构建的异步看门狗实用程序。在

安装

pip install wcpan.watchdog

命令行用法

您可以简单地使用主模块,如下所示:

^{pr2}$

它将为每个更改的文件重新启动命令(如果它仍在运行)。在

库的使用

也可以在代码中使用:

importasyncioimportsignalfromwcpan.watchdog.watcherimportWatcherasyncdefauto_rerun():path='the path you want to observe'# Setup how to stop the watcher.# In this example I use SIGINT to set the Event.loop=asyncio.get_running_loop()stop_event=asyncio.Event()loop.add_signal_handler(signal.SIGINT,lambda:stop_event.set())asyncwithWatcher()aswatcher:# This will not stop until stop_event is set.asyncforchangesinwatcher(path,stop_event=stop_event):# Changes contains changed information.

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何在XML文件中自动检测XSD模式文件?   java Netbeans禁用水平滚动   java提取数字列并排序   java从对象返回嵌套集合的正确方法是什么?   java从源代码获取项目,无需配置构建路径   如何使用JavaAPI获得AKKA for MySQL的持久性?   java如何打印2d数组时间表?   spring restful webservice中的java返回JsonObject   java在当前“while(iterator.hasNext())”循环中添加到迭代器   无法在同一包的不同类中访问具有默认access关键字的java变量   用字符串Java搜索数据   JPA存储库中的java双向关联不工作   java Junit使用者编译错误   java可以同时生成多个RDD   java如何使用WebDriver接受/解除未处理的警报?