python-inotify 0.9.0 causes an exception when a file is not found

- Causes Favorites list to be blank if python-inotify is install in Fedora
This commit is contained in:
William Witt 2010-09-22 22:30:57 -05:00
parent 16671a2e3e
commit a8112d8ecf

View File

@ -23,11 +23,13 @@ if hasInotify:
def addMonitor( self, filename, callback, args = None ): def addMonitor( self, filename, callback, args = None ):
mask = pyinotify.IN_DELETE | pyinotify.IN_CREATE | pyinotify.IN_MODIFY try:
mId = self.wm.add_watch( filename, mask, rec = True)[filename] mask = pyinotify.IN_DELETE | pyinotify.IN_CREATE | pyinotify.IN_MODIFY
if mId >= 0: mId = self.wm.add_watch( filename, mask, rec = True)[filename]
self.callbacks[mId] = ( callback, args ) if mId >= 0:
self.callbacks[mId] = ( callback, args )
except Exception, e:
mId=0
return mId return mId
def removeMonitor( self, monitorId ): def removeMonitor( self, monitorId ):