当前位置: 首页>>代码示例>>Python>>正文


Python ThreadedNotifier.name方法代码示例

本文整理汇总了Python中pyinotify.ThreadedNotifier.name方法的典型用法代码示例。如果您正苦于以下问题:Python ThreadedNotifier.name方法的具体用法?Python ThreadedNotifier.name怎么用?Python ThreadedNotifier.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyinotify.ThreadedNotifier的用法示例。


在下文中一共展示了ThreadedNotifier.name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: monitor

# 需要导入模块: from pyinotify import ThreadedNotifier [as 别名]
# 或者: from pyinotify.ThreadedNotifier import name [as 别名]
def monitor(filename, server):
    """Monitor the config file for changes and update the server's values when they do.

    Using pyinotify, it checks the config file for changes and tells the
    server to make changes when they occur. Starts and returns the
    ThreadedNotifier that is created.

    Keyword arguments:
    filename -- the name of the file you want to monitor. Note that it won't actually monitor this file, but the directory it resides in.
    server -- the EmailServer currently running, to pass the new values to when they're changed.

    """
    logging.info('Monitoring {0} for changes'.format(filename))

    wm = WatchManager()
    notifier = ThreadedNotifier(wm, PClose(server, filename))
    notifier.name = 'MonitorThread'
    # we actually watch the folder to the file, otherwise the handle is lost every time the file is modified.
    wm.add_watch(os.path.split(filename)[0], IN_CLOSE_WRITE, rec=True)

    notifier.start()
    return notifier
开发者ID:nathan-hoad,项目名称:makeme,代码行数:24,代码来源:functions.py


注:本文中的pyinotify.ThreadedNotifier.name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。