Python Forum
How would I use Watchdog to get triggered when DVD is inserted?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How would I use Watchdog to get triggered when DVD is inserted?
#1
I am making a DVD ripping script and I am trying to use the Watchdog Lib to trigger my main function. The problem is, I'm getting this error:
Error:
PermissionError: [WinError 21] The device is not ready.
Is there a way for Watchdog to wait till it's loaded?

This is my test code if that helps anyone and if anyone has any questions feel free to ask.
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler

event_handler = FileSystemEventHandler()

# calling test functions
event_handler.on_created = lambda : print("created")
event_handler.on_deleted = lambda : print("deleted")
event_handler.on_modified = lambda : print("modified")
event_handler.on_moved = lambda : print("moved")
	
path = "D://"
observer = Observer()
observer.schedule(event_handler, path, recursive=True)
observer.start()
try:
	print("Monitoring")
	while True:
		time.sleep(1)
except KeyboardInterrupt:
	observer.stop()
	print("Terminating")
observer.join()
Reply


Messages In This Thread
How would I use Watchdog to get triggered when DVD is inserted? - by Daring_T - Aug-14-2021, 12:09 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  watchdog on_modified CAD79 3 472 Apr-24-2024, 06:23 PM
Last Post: deanhystad
  [SOLVED] [BeautifulSoup] Why does it turn inserted string's brackets into </>? Winfried 0 1,630 Sep-03-2022, 11:21 PM
Last Post: Winfried
  Error when using Watchdog and Qt to keep open a Queue before and after sending first pyhill00 0 1,694 Oct-28-2021, 09:10 AM
Last Post: pyhill00
  Halting if command if gpio triggered event triggered knoxvilles_joker 7 3,428 Jun-21-2021, 01:27 AM
Last Post: knoxvilles_joker
  How to make input come after input if certain line inserted and if not runs OtherCode Adrian_L 6 3,455 Apr-04-2021, 06:10 PM
Last Post: Adrian_L
  Picture changing triggered by GPIO q_nerk 2 2,705 Dec-14-2020, 03:32 PM
Last Post: DeaD_EyE
  lxml - etree/lxml need help storing variable for most inserted element goeb 0 2,625 Apr-01-2019, 03:09 AM
Last Post: goeb

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020