osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

socket: Too many open files


Hi Shakti

You wrote:

> out = commands.getstatusoutput('traceroute ' + ip)

The page

https://docs.python.org/3/library/subprocess.html#legacy-shell-invocation-functions

describes subprocess.getstatusoutput as one of the "legacy functions from the 2.x commands module. These operations implicitly invoke the system shell and none of the guarantees described above regarding security and exception handling consistency are valid for these functions."

I suggest you use subprocess.run or Popen.communicate instead. Once you've done that, perhaps your problem will go away.

And even if it does not, I think you're better placed for getting support, when you're not using legacy commands.

I hope this helps, and good luck.

-- 
Jonathan