title: Python 2.7 Script works with breakpoint in Debug mode but not when Run
body: <pre><code>def mp_worker(row):
      ip = row[0]
      ip_address = ip
      tcp_port = 2112
      buffer_size = 1024
  
      # Read the reset message sent from the sign when a new connection is established
      s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      try:
          print('Connecting to terminal: {0}'.format(ip_address))
          s.connect((ip_address, tcp_port))
  
          #Putting a breakpoint on this call in debug makes the script work
          s.send(":08a8RV;")
  
          #data = recv_timeout(s)
          data = s.recv(buffer_size)
  
          strip = data.split("$", 1)[-1].rstrip()
          strip = strip[:-1]
          print(strip)
          termStat = [ip_address, strip]
  
          terminals.append(termStat)
  
      except Exception as exc:
          print("Exception connecting to: " + ip_address)
          print(exc)
  </code></pre>
  
  <p>The above code is the section of the script that is causing the problem. It's a pretty simple function that connects to a socket based on a passed in IP from a DB query and receives a response that indicates the hardware's firmware version.</p>
  
  <p>Now, the issue is that when I run it in debug with a breakpoint on the socket I get the entire expected response from the hardware, but if I don't have a breakpoint in there or I full on Run the script it only responds with part of the expected message. I tried both putting a time.sleep() in after the send to see if it would get the entire response and I tried using the commented out recv_timeout() method in there which uses a non-blocking socket and timeout to try to get an entire response, both with the exact same results. </p>
  
  <p>As another note,  this works in a script with everything in one main code block, but I need this part separated into a function so I can use it with the multiprocessing library. I've tried running it on both my local Windows 7 machine and on a Unix server with the same results.</p>