LucasThePatator / FaceDetectCrop

1 stars 0 forks source link

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process #13

Open m-btt opened 1 year ago

m-btt commented 1 year ago

Error message thrown when the file was not indeed being used by any other processes - it seemed like the application fought itself to manage the file that was rejected for sorting. Error message persists on the same file when trying to do a new run from scratch.

logs up to failure:

D:\Firefox Downloads\poop main\input\desktopfolders\75430324_108061520580747_4481597291835550237_n.jpg rejected with distance 1.1162590980529785 unsorted D:\Firefox Downloads\poop main\input\desktopfolders\7c1142e29bcab9dd38f93f20a3606222.jpg rejected with distance 1.0329796075820923 unsorted

command line extract:

`Folders: 100%|████████████████████████████████████████████████████████████████████████████████████████████| 59/59 [11:52<00:00, 12.08s/it] 7c1142e29bcab9dd38f93f20a3606222.jpg: 1%|▍ | 36/3292 [00:45<1:07:54, 1.25s/it] Traceback (most recent call last): File "C:\Python310\lib\shutil.py", line 805, in move os.rename(src, real_dst) PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'D:\Firefox Downloads\poop main\input\desktopfolders\7c1142e29bcab9dd38f93f20a3606222.jpg' -> 'D:\Firefox Downloads\poop main\output\desktop\unsorted\7c1142e29bcab9dd38f93f20a3606222.jpg'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "D:\Firefox Downloads\poop main\main.py", line 292, in main() File "D:\Firefox Downloads\poop main\main.py", line 287, in main sort(args, classifier) File "D:\Firefox Downloads\poop main\main.py", line 254, in sort shutil.move(input_folder / file, output_file_name) File "C:\Python310\lib\shutil.py", line 826, in move os.unlink(src) PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'D:\Firefox Downloads\poop main\input\desktopfolders\7c1142e29bcab9dd38f93f20a3606222.jpg' `

Problem file: 7c1142e29bcab9dd38f93f20a3606222

m-btt commented 1 year ago

I just noticed the file is saved as .jpg but opening it on web... as above... shows it's a gif. ??

m-btt commented 1 year ago

Another occurrence with another file for contrasting:

$ python main.py -r reference -i "D:\Firefox Downloads\poop main\input\desktopfolders" -o "D:\Firefox Downloads\poop main\output\desktop" -m sort Processing reference database... Loading existing db ezgif.com-gif-maker_1.png: 13%|██████▉ | 364/2707 [01:54<12:18, 3.17it/s] Traceback (most recent call last): File "C:\Python310\lib\shutil.py", line 805, in move os.rename(src, real_dst) PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'D:\Firefox Downloads\poop main\input\desktopfolders\ezgif.com-gif-maker_1.png' -> 'D:\Firefox Downloads\poop main\output\desktop\Kpop GG SNSD 1 Taeyeon\ezgif.com-gif-maker_1.png'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "D:\Firefox Downloads\poop main\main.py", line 292, in main() File "D:\Firefox Downloads\poop main\main.py", line 287, in main sort(args, classifier) File "D:\Firefox Downloads\poop main\main.py", line 254, in sort shutil.move(input_folder / file, output_file_name) File "C:\Python310\lib\shutil.py", line 826, in move os.unlink(src) PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'D:\Firefox Downloads\poop main\input\desktopfolders\ezgif.com-gif-maker_1.png'

Problem file is a transparency-containing .png:

ezgif com-gif-maker_1

Edit: no, it's an animated .png...

LucasThePatator commented 1 year ago

No planned support for those images because they're an edge case and I can't be bothered. Gotta make it fail gracefully when they arrive tho