Skip to content

Instantly share code, notes, and snippets.

@code-shoily
Created January 4, 2014 17:20
Show Gist options
  • Save code-shoily/8257637 to your computer and use it in GitHub Desktop.
Save code-shoily/8257637 to your computer and use it in GitHub Desktop.
import sys
from twisted.internet import inotify, reactor
from twisted.python import filepath
def change_handler(watch, path, mask):
# Call re-compile cmds etc on the file according to mask value via subprocess, perhaps?
print "WATCH: {}, PATH: {}, MASK: {}".format(watch, path, mask)
def start_notifying(path):
notifier = inotify.INotify()
notifier.startReading()
notifier.watch(filepath.FilePath(path), callbacks=[change_handler])
if __name__ == "__main__":
start_notifying(sys.argv[1])
reactor.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment