title: Watchdog getting events thrice in Python 3
body: <p>I'm creating a program in Python using <a href="https://pythonhosted.org/watchdog/index.html" rel="nofollow noreferrer">Watchdog</a> that watches a set of files and takes actions based on changes. I put <a href="https://pythonhosted.org/watchdog/quickstart.html#a-simple-example" rel="nofollow noreferrer">the exact example from their site</a> in a file:</p>
  
  <pre class="lang-python prettyprint-override"><code>import sys
  import time
  import logging
  from watchdog.observers import Observer
  from watchdog.events import LoggingEventHandler
  
  if __name__ == "__main__":
      logging.basicConfig(level=logging.INFO,
                          format='%(asctime)s - %(message)s',
                          datefmt='%Y-%m-%d %H:%M:%S')
      path = sys.argv[1] if len(sys.argv) &gt; 1 else '.'
      event_handler = LoggingEventHandler()
      observer = Observer()
      observer.schedule(event_handler, path, recursive=True)
      observer.start()
      try:
          while True:
              time.sleep(1)
      except KeyboardInterrupt:
          observer.stop()
      observer.join()
  </code></pre>
  
  <p>Then, I noticed something odd. I have installed watchdog for both Python 2 and Python 3, in the same way (using <code>pip2 install watchdog</code> and <code>pip3 install watchdog</code>), and at the same time. However, when I run the program in Python 2 and 3 and do the same modification <em>once</em> for each, this happens:</p>
  
  <pre class="lang-none prettyprint-override"><code>$ python2 watch_test.py
  2015-09-30 11:18:32 - Modified file: ./watch_test.py
  $ python3 watch_test.py
  2015-09-30 11:18:39 - Modified file: ./watch_test.py
  2015-09-30 11:18:39 - Modified file: ./watch_test.py
  2015-09-30 11:18:39 - Modified file: ./watch_test.py
  </code></pre>
  
  <p>What I'm wondering is what could cause this behavior and how could I fix it.</p>
  
  <p>This question <strong>is not</strong> a duplicate of:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/27640693/python-watchdog-runs-more-than-once">python watchdog runs more than once</a>; the events are all the same</li>
  <li><a href="https://stackoverflow.com/questions/23859931/python-watchdog-duplicate-events">Python watchdog duplicate events</a>; the error only happens on Python 3, not on Python 2.</li>
  </ul>