title: Script is hanging during execution
body: <p>I wrote a python script in a Windows environment that goes through an list of IP addresses and connects to each IP one at a time using WMI to retrieve information. There is an issue where the connection with some of the IPs causes the script to hang (it just waits for a response from the server indefinitely and never timeout). </p>
  
  <pre><code>for ip in listofIPs: 
      performWork(ip) #hanging issue occurs within this function call
  </code></pre>
  
  <p>I've been trying to find a way to modify my code so that the function call is given exactly one minute to execute else terminate the function call and move on to the next IP in the list. </p>
  
  <p>I did stumble upon a way to implement function timeout in a Linux environment but this is a rather lengthy script and I don't have the time to convert it over to Linux. I also came across some proposed Windows environment solutions but I couldn't get them to work. I've tried the following:</p>
  
  <p><a href="https://stackoverflow.com/questions/21827874/timeout-a-python-function-in-windows">Timeout a python function in windows</a></p>
  
  <p>and</p>
  
  <p><a href="https://stackoverflow.com/questions/14920384/stop-code-after-time-period">Stop code after time period</a></p>
  
  <p>I was hoping someone can offer other suggestions/methods of resolving this issue. </p>
  
  <p>Thanks,</p>
  
  <p>J</p>