ThePornDatabase/namer

Throws FileNotFoundError after calculating phash begins

Closed this issue · 3 comments

It moves the file from watch dir to work dir and then starts calculating phash and throws this:

Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.10/dist-packages/namer/main.py", line 87, in
main()
File "/usr/local/lib/python3.10/dist-packages/namer/main.py", line 74, in main
namer.watchdog.create_watcher(config).run()
File "/usr/local/lib/python3.10/dist-packages/namer/watchdog.py", line 177, in run
self.start()
File "/usr/local/lib/python3.10/dist-packages/namer/watchdog.py", line 242, in start
for file in self.__namer_config.watch_dir.rglob("**/."):
File "/usr/lib/python3.10/pathlib.py", line 1047, in rglob
for p in selector.select_from(self):
File "/usr/lib/python3.10/pathlib.py", line 493, in _select_from
for p in successor_select(starting_point, is_dir, exists, scandir):
File "/usr/lib/python3.10/pathlib.py", line 492, in _select_from
for starting_point in self._iterate_directories(parent_path, is_dir, scandir):
File "/usr/lib/python3.10/pathlib.py", line 482, in _iterate_directories
for p in self._iterate_directories(path, is_dir, scandir):
File "/usr/lib/python3.10/pathlib.py", line 471, in _iterate_directories
with scandir(parent_path) as scandir_it:
FileNotFoundError: [Errno 2] No such file or directory: 'XXX'

Weirdly enough, XXX is the scene folder inside the "watch" dir. And as it has already moved the file to work dir, it won't be there.

Installed today on Ubuntu using pip command. Files are mp4.

I have a very similar issue with exactly the same error message. It seems to get this on the same (sub)folder + file every time. I then deleted that one and it complained about another one. The folders & files are definitely there and permissions are okay. Running on unraid with the PUID and PGID properly set. To test it, I ran it on a folder with only a few (sub)folders & files first and that went without issue. Then I ran it against a large media folder with exactly the same settings and folder structure, just another root /media folder, and it started throwing FIleNotFoundException

It moves over a bunch of files to the work folder and then throws an error on a folder + file in the watch folder. So while it always complains about the same folder, unless I delete it, a bunch of other files have already been moved over so it's not like it doesn't find the media folder or doesn't have permissions to move files there

[edit]
After digging into it some more, I have determined that it has no issue moving files that are located directly in the root /media/watch folder, but that it indeed crashes right after the first subfolder of the /media/watch folder it moves. So, "/media/watch/somemovie.mp4" is no problem and will be moved to "/media/work/somemovie.mp4" after which the script just continues moving over all the files that are not in a subfolder. Then for the subfolders, for instance "/media/watch/subfolder/somemovie.mp4" it will actually correctly and fully perform the move of the first one to "/media/work/subfolder/somemovie.mp4" but then it complains that it can't find that subfolder in "/media/watch/subfolder" anymore and it crashes. Which is weird because of course it isn't there anymore, it just moved it to "/media/work"

Here is my exception

Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.10/dist-packages/namer/main.py", line 87, in
main()
File "/usr/local/lib/python3.10/dist-packages/namer/main.py", line 74, in main
namer.watchdog.create_watcher(config).run()
File "/usr/local/lib/python3.10/dist-packages/namer/watchdog.py", line 177, in run
self.start()
File "/usr/local/lib/python3.10/dist-packages/namer/watchdog.py", line 242, in start
for file in self.__namer_config.watch_dir.rglob("**/."):
File "/usr/lib/python3.10/pathlib.py", line 1047, in rglob
for p in selector.select_from(self):
File "/usr/lib/python3.10/pathlib.py", line 493, in _select_from
for p in successor_select(starting_point, is_dir, exists, scandir):
File "/usr/lib/python3.10/pathlib.py", line 492, in _select_from
for starting_point in self._iterate_directories(parent_path, is_dir, scandir):
File "/usr/lib/python3.10/pathlib.py", line 482, in _iterate_directories
for p in self._iterate_directories(path, is_dir, scandir):
File "/usr/lib/python3.10/pathlib.py", line 471, in _iterate_directories
with scandir(parent_path) as scandir_it:
FileNotFoundError: [Errno 2] No such file or directory: '/media/watch/XXX_FOLDERNAME'

it's probably not error, might be fixed in 1.14.3

it's probably not error, might be fixed in 1.14.3

Yup, that solves it. At least for me it does. It's now running through the files correctly. Thanks!