socket: Too many open files

jfine2358 at gmail.com jfine2358 at gmail.com
Sat Oct 13 11:49:35 EDT 2018


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





More information about the Python-list mailing list