Skip to content

Commit

Permalink
Fix silently fails if path is file gorakhargosh#1034 (Windows only) i…
Browse files Browse the repository at this point in the history
…ssue by testing if it's a file.
  • Loading branch information
TobiasRzepka committed Jul 24, 2024
1 parent 6294daf commit 8a8c4d2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/watchdog/observers/read_directory_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ def __init__(self, event_queue, watch, timeout=DEFAULT_EMITTER_TIMEOUT, event_fi
self._handle = None

def on_thread_start(self):
self._handle = get_directory_handle(self.watch.path)
watch_path = self.watch.path
if os.path.isfile(watch_path):
watch_path = os.path.dirname(watch_path)
self._handle = get_directory_handle(watch_path)

if platform.python_implementation() == "PyPy":

Expand Down

0 comments on commit 8a8c4d2

Please sign in to comment.