WinError 3 в библиотеке WatchDog
При запуске этого кода
from watchdog.observers import Observer
import os
import time
from watchdog.events import FileSystemEventHandler
folder_track = '/Users/Anton/Downloads'
folder_dest = '/users/Anton/Desktop/Music'
class Handler(FileSystemEventHandler):
def on_modified(self, event):
for filename in os.listdir(folder_track):
extension = filename.split(".")
if len(extension) > 1 and (extension[1].lower() == "mp3"):
file = folder_track + "/" + filename
new_path = folder_dest + "/" + filename
os.replace(folder_track + "/" + filename, new_path + "/" + filename)
handle = Handler()
observer = Observer()
observer.schedule(handle, folder_track, recursive=True)
observer.start()
try:
while(True):
time.sleep(10)
except KeyboardInterrupt:
observer.stop()
observer.join()
Выдаёт такой traceback
Traceback (most recent call last): File "G:/PyCharmProjects/main.py", line 23, in observer.start() File "C:\Users\anton\AppData\Local\Programs\Python\Python38-32\lib\site-packages\watchdog\observers\api.py", line 260, in start emitter.start() File "C:\Users\anton\AppData\Local\Programs\Python\Python38-32\lib\site-packages\watchdog\utils_init_.py", line 110, in start self.on_thread_start() File "C:\Users\anton\AppData\Local\Programs\Python\Python38-32\lib\site-packages\watchdog\observers\read_directory_changes.py", line 66, in on_thread_start self._handle = get_directory_handle(self.watch.path) File "C:\Users\anton\AppData\Local\Programs\Python\Python38-32\lib\site-packages\watchdog\observers\winapi.py", line 307, in get_directory_handle return CreateFileW(path, FILE_LIST_DIRECTORY, WATCHDOG_FILE_SHARE_FLAGS, File "C:\Users\anton\AppData\Local\Programs\Python\Python38-32\lib\site-packages\watchdog\observers\winapi.py", line 113, in _errcheck_handle raise ctypes.WinError() FileNotFoundError: [WinError 3] Системе не удается найти указанный путь.