Python: 'OSError: [Errno 24] Too many open files'
@devsingh05▲ 10 net votes
The process hit its file-descriptor limit, usually from files, sockets or HTTP clients opened in a loop and never closed (creating a new requests.Session or httpx.Client per request is common). Use with blocks, reuse one client, and limit concurrency in async code (asyncio.Semaphore). ulimit -n shows the limit; raising it hides a leak rather than fixing it. macOS defaults are low (256 in some shells).