title: Catch errors in pyinotify ProcessEvent
body: <p>I have problems to catch errors inside an event handler from pyinotify.
  I am trying to do some processing on files that have just been closed after being written to.</p>
  
  <p>Here is a simplified version of my script:</p>
  
  <pre><code>import pyinotify
  import asyncore
  
  mask = pyinotify.IN_CLOSE_WRITE
  
  class EventHandler(pyinotify.ProcessEvent):
  
      def process_IN_CLOSE_WRITE(self, event):
          try:
              do_stuff()
          except BaseException as e:
              print "Exception:" + str(e)
              pass
  
  if __name__ == "__main__":
          try:
                  wm = pyinotify.WatchManager()
  
                  notifier = pyinotify.AsyncNotifier(wm, EventHandler())
                  wdd = wm.add_watch('/dir-to-watch/', mask, rec=True)
                  asyncore.loop()
          except:
                  print "Unhandled error!"
                  print "Details:" + str(e)
                  print "Continuing anyway..."
                  pass
  </code></pre>
  
  <p>It seems that when I get an error or an exception neither my <em>except</em> in the main loop or my <em>except BaseException</em> in the event handler are catching the error or exceptions.</p>
  
  <p>I get messages beginning like this:</p>
  
  <blockquote>
    <p>error: uncaptured python exception, closing channel
     (:[Errno 2] No such file or directory:</p>
  </blockquote>
  
  <p>So my question is: how could catch those exceptions?</p>