FileNotFoundError on `os.getcwd()`
Opened this issue · 3 comments
Worker upload-search raised exception FileNotFoundError and will abort: [Errno 2] No such file or directory at worker.py:117->processor.py:168->helpers.py:148
Line 148 in 4e5ef88
This can occur if the working directory was previously changed to a directory that no longer exists at the time of the call. Are we setting the working directory to a temporary directory without changing it back anywhere?
Confusingly, all our os.chdir()
s are wrapped in try/catch blocks with a finally
statement that changes the working directory back to the original value...
Got rid of chdir, which isn't particularly thread-safe, in 9197c99 but the problem remains (FileNotFoundErrors start popping up in other places). To be continued...
I believe the errors related to the video hasher are unrelated and pushed a fix.
Not sure if you noted other errors as well, but the cwdir
seems like the culprit here since it seems to effect the main process and thus all threads owned by it. Not 100% sure why the finally block was not always called, but even without that we could get shutil errors while the directory was changed so it seems good to remove and avoid it in general.