title: Boto file upload to S3 failing on Windows [errno: 10054]
body: <p>I'm trying to upload a file to S3 using boto on a windows 7 machine, but i keep getting an error
  <code>[Errno 10054] An existing connection was forcibly closed by the remote host</code></p>
  
  <p>My code to interact with S3 looks like this</p>
  
  <pre><code>from boto.s3.connection import S3Connection
  from boto.s3.key import Key
  
  conn = S3Connection(Access_Key_ID, Secret_Key)
  bucket = conn.lookup(bucket_name)
  
  k = Key(bucket)
  k.key = 'akeynameformyfile'
  k.set_contents_from_filename(source_path_of_file_to_upload)
  </code></pre>
  
  <p>The upload works fine on the same machine using the AWS CLI with the following command</p>
  
  <pre><code>aws s3 cp filename.exe s3://bucketname/ttt
  </code></pre>
  
  <p>The file is about 200MB</p>
  
  <p>My OS is Windows 7, python is running through anaconda with all packages up to date. Boto is version 2.25</p>
  
  <p>This code all runs fine from a CentOS box on the same network. So is this a windows issue?</p>
  
  <p>Any help would be much appreciated
  thanks!
  c</p>
  
  <p><strong>Debug Output Below</strong></p>
  
  <blockquote>
    <p>send: 'HEAD / HTTP/1.1\r\nHost:
    ACCESS_KEY_ID.test7.s3.amazonaws.com\r\nAccept-Encoding:
    identity\r\nDate: Wed, 14 May 2014  22:44:31 GMT\r\nContent-Length:
    0\r\nAuthorization: AWS ACCESS_KEY_ID:SOME_STUFF=\r\nUser-Agent:
    Boto/2.25. 0 Python/2.7.5 Windows/7\r\n\r\n'<br>
    reply: 'HTTP/1.1 307 Temporary Redirect\r\n'<br>
    header: x-amz-request-id: 8A3D34FB0E0FD8E4<br>
    header: x-amz-id-2:
    PwG9yzOVwxy21LmcpQ0jAaMchG0baCrfEhAU9fstlPUI307Qxth32uNAOVv72B2L<br>
    header: Location:
    <a href="https://ACCESS_KEY_ID.test7.s3-ap-southeast-2.amazonaws.com/" rel="nofollow">https://ACCESS_KEY_ID.test7.s3-ap-southeast-2.amazonaws.com/</a><br>
    header: Content-Type: application/xml<br>
    header: Transfer-Encoding: chunked<br>
    header: Date: Wed, 14 May 2014 22:44:31 GMT<br>
    header: Server: AmazonS3<br>
    send: 'HEAD / HTTP/1.1\r\nHost:
    ACCESS_KEY_ID.test7.s3-ap-southeast-2.amazonaws.com\r\nAccept-Encoding:
    identity\r\nDate: We d, 14 May 2014 22:44:31 GMT\r\nContent-Length:
    0\r\nAuthorization: AWS ACCESS_KEY_ID:SOME_STUFF=\r\nUser-Ag ent:
    Boto/2.25.0 Python/2.7.5 Windows/7\r\n\r\n'<br>
    reply: 'HTTP/1.1 200 OK\r\n'<br>
    header: x-amz-id-2:
    erataRIpbOrEwOU72VUAqU9AGJ4/kX5z1/UD7rJQy9laKDgOyTyVKABMab8f6wGN<br>
    header: x-amz-request-id: 2A7BECC45C9BAE7A<br>
    header: Date: Wed, 14 May 2014 22:44:33 GMT<br>
    header: Content-Type: application/xml<br>
    header: Transfer-Encoding: chunked<br>
    header: Server: AmazonS3<br>
    send: 'PUT /akeynameformyfile HTTP/1.1\r\nHost:
    ACCESS_KEY_ID.test7.s3.amazonaws.com\r\nAccept-Encoding:
    identity\r\nContent
    -Length: 242642944\r\nContent-MD5: xYOiNcyFKGY1Y/HsYwHQeg==\r\nExpect: 100-Continue\r\nDate: Wed, 14 May 2014 22:44:33 GMT\r\nUser- Agent:
    Boto/2.25.0 Python/2.7.5 Windows/7\r\nContent-Type:
    application/octet-stream\r\nAuthorization: AWS
    ACCESS_KEY_ID:pWs3KwRv9Q5wDnz4dHD3JwvCy/w=\r\n\r\n'                   </p>
    
    <p>---------------------------------------------------------------------------                                                         error                                     Traceback (most recent call
    last)<br>
     in ()                         </p>
  
  <pre><code> 12 k = Key(bucket)                                                                                                            
   13 k.key = 'akeynameformyfile'                                                                                                
  </code></pre>
    
    <p>---> 14 k.set_contents_from_filename(full_path_of_file_to_upload)<br>
                                                                                                                                        C:\Users\username\AppData\Local\Continuum\Anaconda\lib\site-packages\boto\s3\key.pyc
    in set_contents_from_filename(sel f, filename, headers, replace, cb,
    num_cb, policy, md5, reduced_redundancy, encrypt_key)<br>
    1313                                                num_cb, policy,
    md5,                                                            1314<br>
    reduced_redundancy,                                                   </p>
    
    <p>-> 1315                                                encrypt_key=encrypt_key)<br>
    1316<br>
    1317     def set_contents_from_string(self, string_data, headers=None,
    replace=True,<br>
                                                                                                                                        C:\Users\username\AppData\Local\Continuum\Anaconda\lib\site-packages\boto\s3\key.pyc
    in set_contents_from_file(self, f p, headers, replace, cb, num_cb,
    policy, md5, reduced_redundancy, query_args, encrypt_key, size,
    rewind)                               1244<br>
    self.send_file(fp, headers=headers, cb=cb, num_cb=num_cb,<br>
    1245                            query_args=query_args,                </p>
    
    <p>-> 1246                            chunked_transfer=chunked_transfer, size=size)                                                       1247 </p>
    
    <h1>return number of bytes written.                                                                                  1248             return self.size</h1>
  
  <pre><code>                                                                                                                                C:\Users\username\AppData\Local\Continuum\Anaconda\lib\site-packages\boto\s3\key.pyc
  </code></pre>
    
    <p>in send_file(self, fp, headers, c b, num_cb, query_args,
    chunked_transfer, size)                                               </p>
  
  <pre><code>723         self._send_file_internal(fp, headers=headers, cb=cb, num_cb=num_cb,                                                
  724                                  query_args=query_args,                                                                    
  </code></pre>
    
    <p>--> 725                                  chunked_transfer=chunked_transfer, size=size)                         </p>
  
  <pre><code>726                                                                                                                            
  727     def _send_file_internal(self, fp, headers=None, cb=None, num_cb=10,                                                    
                                                                                                                                  C:\Users\username\AppData\Local\Continuum\Anaconda\lib\site-packages\boto\s3\key.pyc
  </code></pre>
    
    <p>in _send_file_internal(self, fp,  headers, cb, num_cb, query_args,
    chunked_transfer, size, hash_algs)                                    </p>
  
  <pre><code>912             headers,                                                                                                       
  913             sender=sender,                                                                                                 
  </code></pre>
    
    <p>--> 914             query_args=query_args<br>
        915         )<br>
        916         self.handle_version_headers(resp, force=True)<br>
                                                                                                                                        C:\Users\username\AppData\Local\Continuum\Anaconda\lib\site-packages\boto\s3\connection.pyc
    in make_request(self, meth od, bucket, key, headers, data, query_args,
    sender, override_num_retries, retry_handler)                          </p>
  
  <pre><code>631             data, host, auth_path, sender,                                                                                 
  632             override_num_retries=override_num_retries,                                                                     
  </code></pre>
    
    <p>--> 633             retry_handler=retry_handler<br>
        634         )<br>
                                                                                                                                        C:\Users\username\AppData\Local\Continuum\Anaconda\lib\site-packages\boto\connection.pyc
    in make_request(self, method,  path, headers, data, host, auth_path,
    sender, override_num_retries, params, retry_handler)<br>
    1028                                                     params,
    headers, data, host)<br>
    1029         return self._mexe(http_request, sender,
    override_num_retries,                                                 </p>
    
    <p>-> 1030                           retry_handler=retry_handler)                                                                         1031<br>
    1032     def close(self):                                             </p>
  
  <pre><code>                                                                                                                                C:\Users\username\AppData\Local\Continuum\Anaconda\lib\site-packages\boto\connection.pyc
  </code></pre>
    
    <p>in _mexe(self, request, sende r, override_num_retries, retry_handler) </p>
  
  <pre><code>905                 if callable(sender):                                                                                       
  906                     response = sender(connection, request.method, request.path,                                         
  </code></pre>
    
    <p>--> 907                                       request.body, request.headers)                                                      </p>
  
  <pre><code>908                 else:                                                                                                      
  909                     connection.request(request.method, request.path,                                                       
                                                                                                                                  C:\Users\username\AppData\Local\Continuum\Anaconda\lib\site-packages\boto\s3\key.pyc
  </code></pre>
    
    <p>in sender(http_conn, method, path , data, headers)                    </p>
  
  <pre><code>813                     http_conn.send('\r\n')                                                                                 
  814                 else:                                                                                                      
  </code></pre>
    
    <p>--> 815                     http_conn.send(chunk)<br>
        816                 for alg in digesters:<br>
        817                     digesters[alg].update(chunk)<br>
                                                                                                                                        C:\Users\username\AppData\Local\Continuum\Anaconda\lib\httplib.pyc in
    send(self, data)<br>
        803                 datablock = data.read(blocksize)<br>
        804         else:<br>
    --> 805             self.sock.sendall(data)<br>
        806<br>
        807     def _output(self, s):<br>
                                                                                                                                        C:\Users\username\AppData\Local\Continuum\Anaconda\lib\ssl.pyc in
    sendall(self, data, flags)<br>
        227             count = 0<br>
        228             while (count &lt; amount):<br>
    --> 229                 v = self.send(data[count:])<br>
        230                 count += v<br>
        231             return amount<br>
                                                                                                                                        C:\Users\username\AppData\Local\Continuum\Anaconda\lib\ssl.pyc in
    send(self, data, flags)<br>
        196             while True:<br>
        197                 try:<br>
    --> 198                     v = self._sslobj.write(data)<br>
        199                 except SSLError, x:<br>
        200                     if x.args[0] == SSL_ERROR_WANT_READ:<br>
                                                                                                                                        error: [Errno 10054] An existing connection was forcibly closed by the
    remote host</p>
  </blockquote>