# HG changeset patch # User drewp@bigasterisk.com # Date 1402855513 0 # Node ID f6c2da5657600f122beffdee999075198b1352b3 # Parent 92ffad96fd8a0570b5df8438b21df7be6bbf3b07 try re-watching files that disappeared during editing Ignore-this: 1d557e4a9322fdf2f8f80781f822f99e diff -r 92ffad96fd8a -r f6c2da565760 light9/rdfdb/graphfile.py --- a/light9/rdfdb/graphfile.py Sun Jun 15 18:04:55 2014 +0000 +++ b/light9/rdfdb/graphfile.py Sun Jun 15 18:05:13 2014 +0000 @@ -44,6 +44,11 @@ self.flushDelay = 2 # seconds until we have to call flush() when dirty self.writeCall = None # or DelayedCall + self.notifier = notifier + self.addWatch() + + def addWatch(self): + # emacs save comes in as IN_MOVE_SELF, maybe # I was hoping not to watch IN_CHANGED and get lots of @@ -55,8 +60,9 @@ from twisted.internet.inotify import IN_CLOSE_WRITE, IN_MOVED_FROM, IN_MODIFY, IN_DELETE, IN_DELETE_SELF, IN_CHANGED - notifier.watch(FilePath(path), callbacks=[self.notify]) - + log.info("add watch on %s", self.path) + self.notifier.watch(FilePath(self.path), callbacks=[self.notify]) + def notify(self, notifier, filepath, mask): try: maskNames = humanReadableMask(mask) @@ -82,6 +88,9 @@ return except OSError as e: log.error("%s: %r" % (filepath, e)) + # getting OSError no such file, followed by no future reads + reactor.callLater(.5, self.addWatch) # ? + return log.info("%s needs reread because of %s event", filepath, maskNames)