本文整理汇总了Python中fsevents.Observer.run方法的典型用法代码示例。如果您正苦于以下问题:Python Observer.run方法的具体用法?Python Observer.run怎么用?Python Observer.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fsevents.Observer
的用法示例。
在下文中一共展示了Observer.run方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start_session
# 需要导入模块: from fsevents import Observer [as 别名]
# 或者: from fsevents.Observer import run [as 别名]
def start_session():
observer = Observer()
observer.start()
cb = create_cb()
stream = Stream(cb, os.getcwd(), file_events=True)
observer.schedule(stream)
observer.run()
示例2: start_watching
# 需要导入模块: from fsevents import Observer [as 别名]
# 或者: from fsevents.Observer import run [as 别名]
def start_watching(self):
""" Start watching our paths, and do the main work. """
# setup
observer = Observer()
stream = Stream(
self.capture_event,
self.settings['local']['watch_path'],
file_events=True
)
observer.schedule(stream)
# go go go
observer.run()
示例3: _loop_darwin
# 需要导入模块: from fsevents import Observer [as 别名]
# 或者: from fsevents.Observer import run [as 别名]
def _loop_darwin(self): # pragma: no cover
"""loop implementation for darwin platform"""
from fsevents import Observer #pylint: disable=F0401
from fsevents import Stream #pylint: disable=F0401
from fsevents import IN_MODIFY #pylint: disable=F0401
observer = Observer()
handler = self._handle
def fsevent_callback(event):
if event.mask == IN_MODIFY:
handler(event)
for watch_this in self.watch_dirs:
stream = Stream(fsevent_callback, watch_this, file_events=True)
observer.schedule(stream)
observer.daemon = True
observer.run()
示例4: len
# 需要导入模块: from fsevents import Observer [as 别名]
# 或者: from fsevents.Observer import run [as 别名]
#!/usr/bin/env python
import subprocess
import sys
from fsevents import Observer
from fsevents import Stream
if len(sys.argv) != 2:
print 'Usage: %s [absolute path to searchfe]' % sys.argv[0]
sys.exit(1)
observer = Observer()
def callback(args):
print args
subprocess.call([sys.argv[1] + '/bin/searchfe.sh', 'less'])
stream = Stream(callback, sys.argv[1] + '/al/marbury/less', file_events=True)
observer.schedule(stream)
observer.run()