

Fwd: socket: Too many open files

>I?m running a script which basically does a traceroute to the list of
hosts provided, and then pulls up some info by logging in to gateways in
the path.
>I am running this script for a list of almost 40k hosts in our data
>Also, I am using commands module to get the traceroute output.

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

>However I observe that this particular line is failing with socket error
after I reach some 5k to 6k hosts.
>I know commands module is using pipes to execute the given command and
this is one reason for exhaustion of file descriptors.
>Any suggestions for improving this and getting a workaround?


I dont understand how I should close the socket created by commands module
after I do traceroute to one host.
Also, if I?m not wrong, isn?t commands module supposed to do that on its