title: Trouble getting Watchdog observer to stop/join (python)
body: <p>I'm using the watchdog python package to detect if a file has been downloaded (which I'm doing in selenium). This is the code I'm using and it successfully detects file creation, but my call to self.observer.stop() doesn't seem to work and the program stalls. Any thoughts?</p>
  
  <pre><code>class MyEventHandler(FileSystemEventHandler):
      def __init__(self, observer):
          self.observer = observer
      def on_created(self, event):
          print "file created"
          self.observer.stop()
  
  def check_download(download_folder):
      file_location = download_folder
      print(download_folder)
      observer = Observer()
      event_handler = MyEventHandler(observer)
      observer.schedule(event_handler, file_location)
      observer.start()
      observer.join()
      return 0
  </code></pre>