Sagteware besonderhede:
Weergawe: 0.6.0
Upload datum: 14 Apr 15
Lisensie: Gratis
Populariteit: 65
Waghond is 'n Python API lêerstelsel gebeure te monitor.
Waghond laat jou Python programme monitor lêerstelsel gebeure as portably as moontlik te gebruik:
* Inotify op Linux
* FSEvents op Mac OS X
* Windows API op Windows
* Stemdag as 'n terugval meganisme
Voorbeeld gebruik:
invoer sys
invoer tyd
uit waghond invoer Observer, FileSystemEventHandler
invoer meld
logging.basicConfig (vlak = logging.DEBUG)
klas MyEventHandler (FileSystemEventHandler):
& Nbsp; & nbsp; & nbsp; def catch_all_handler (self, gebeurtenis):
& Nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; logging.debug (event)
& Nbsp; & nbsp; & nbsp; def on_moved (self, gebeurtenis):
& Nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; self.catch_all_handler (event)
& Nbsp; & nbsp; & nbsp; def on_created (self, gebeurtenis):
& Nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; self.catch_all_handler (event)
& Nbsp; & nbsp; & nbsp; def on_deleted (self, gebeurtenis):
& Nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; self.catch_all_handler (event)
& Nbsp; & nbsp; & nbsp; def on_modified (self, gebeurtenis):
& Nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; self.catch_all_handler (event)
event_handler = MyEventHandler ()
waarnemer = Observer ()
observer.schedule ('n unieke naam ", event_handler, * sys.argv [1:])
observer.start ()
probeer:
& Nbsp; & nbsp; & nbsp; terwyl Ware:
& Nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; time.sleep (1)
behalwe KeyboardInterrupt:
& Nbsp; & nbsp; & nbsp; observer.unschedule ('n unieke naam ")
& Nbsp; & nbsp; & nbsp; observer.stop ()
observer.join ()
Vereistes :
- Python
- pyinotify
Kommentaar nie gevind