#124 unexpected error with multi-part upload

s3cmd (119)

Hi Michal

I got the following error while uploading the following file to our ATMOS platform via an S3 proxy:
-rw-r--r--@ 1 glyn staff 3515703296 17 Jul 17:37 Windows8-ReleasePreview-64bit-English.iso

though this file, that was not split, uploaded fine:
-rwx------ 1 glyn staff 649560 7 Jun 16:31 SslvpnClient_4.0.2138.rar


<---- begin error details ----------------------------------->
Problem: ParseError: XML or text declaration not at start of entity: line 1, column 38
S3cmd: 1.1.0-beta3

Traceback (most recent call last):
File "./s3cmd", line 1800, in <module>
File "./s3cmd", line 1741, in main
File "./s3cmd", line 299, in cmd_object_put
response = s3.object_put(full_name, uri_final, extra_headers, extra_label = seq_label)
File "/Users/glyn/Downloads/s3cmd-1.1.0-beta3/S3/S3.py", line 382, in object_put
return self.send_file_multipart(file, headers, uri, size)
File "/Users/glyn/Downloads/s3cmd-1.1.0-beta3/S3/S3.py", line 757, in send_file_multipart
response = upload.complete_multipart_upload()
File "/Users/glyn/Downloads/s3cmd-1.1.0-beta3/S3/MultiPart.py", line 99, in complete_multipart_upload
response = self.s3.send_request(request, body = body)
File "/Users/glyn/Downloads/s3cmd-1.1.0-beta3/S3/S3.py", line 624, in send_request
raise S3Error(response)
File "/Users/glyn/Downloads/s3cmd-1.1.0-beta3/S3/Exceptions.py", line 48, in __init__
tree = getTreeFromXml(response["data"])
File "/Users/glyn/Downloads/s3cmd-1.1.0-beta3/S3/Utils.py", line 69, in getTreeFromXml
tree = ET.fromstring(xml)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1282, in XML
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1624, in feed
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1488, in _raiseerror
ParseError: XML or text declaration not at start of entity: line 1, column 38

<---- end error details ----------------------------------->


  • Matt Domsch
    Matt Domsch

    • status: open --> closed-fixed
  • Matt Domsch
    Matt Domsch

    I believe this is fixed in upstream github.com/s3tools/s3cmd master branch now.

    commit dd58f170d01d302e19bc7ce23796f929ae8281dd
    Author: Oren Held <oren@held.org.il>
    Date:   Sat May 10 14:52:10 2014 +0300
        Tolerate non-XML errors, e.g. proxy-generated 403/502 HTML errors
        Code used to raise an unhandled exception if the resulting error is not an XML
        (ElementTree ParseError when creating S3Error object). In certain cases (e.g.
        5xx errors), this also disrupted the retry flow.
        Easily reproducible when running a simple 's3cmd ls' while s3cfg has an http
        proxy set up, and the proxy denies all requests - returns a non-XML 403 error.
        * Also extracted a method for the XML Error parsing to clean the code a little.