[Python] OSError: [Errno 24] Too many open files when unzipping with py7zr

Discussão em 'Python' iniciado por Stack, Janeiro 22, 2025.

  1. Stack

    Stack Membro Participativo

    I have large .7z files with multiple folder in them. I have python code using py7zr to identify and extract only those folders that I need from every .7z file (and I'm doing all of that within a with clause, so it should close the files afterwards by default). So far it had worked great. Then (probably due to running too many different things in parallel) python (or rather, vscode, where I was calling the python script in the terminal) crashed. That happened twice in a row, on the same .7z file. I tried calling the unzipping script again in the terminal after rebooting the computer and now when it reaches the first file, it already exits with error OSError: [Errno 24] Too many open files: 'the_one_file.7z'

    I killed all vscode processes manually afterwards, and the ulimit -n shows a very large number as it is. But the problem persists anyway. I just can't unzip with python anymore. Rebooting doesn't help, as mentioned. And I can't find any processes within top that I could identify as problematic. Is there any way to find out what processes are holding on to the files and kill them? Setting an even higher ulimit is not an option.

    Continue reading...

Compartilhe esta Página