Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: <class 'AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren' #1210

Closed
safor opened this issue Sep 17, 2021 · 4 comments

Comments

@safor
Copy link

safor commented Sep 17, 2021

Invoked as: /usr/bin/s3cmd sync /s3/my-files/ s3://my-files --no-guess-mime-type --delete-removed --delete-after --check-md5 --preserve --dry-run
Problem: <class 'AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'
S3cmd:   2.1.0
python:   3.9.5 (default, May 12 2021, 20:44:22)
[GCC 10.3.1 20210424]
Traceback (most recent call last):
  File "/usr/bin/s3cmd", line 3121, in <module>
    rc = main()
  File "/usr/bin/s3cmd", line 3030, in main
    rc = cmd_func(args)
  File "/usr/bin/s3cmd", line 1898, in cmd_sync
    return cmd_sync_local2remote(args)
  File "/usr/bin/s3cmd", line 1871, in cmd_sync_local2remote
    ret = _single_process(args[:-1])
  File "/usr/bin/s3cmd", line 1625, in _single_process
    return _child(destination_base, source_args)
  File "/usr/bin/s3cmd", line 1729, in _child
    remote_list, dst_exclude_list, remote_total_size = fetch_remote_list(destbase_with_source_list, recursive = True, require_attribs = True)
  File "/usr/lib/python3.9/site-packages/S3/FileLists.py", line 471, in fetch_remote_list
    objectlist, tmp_total_size = _get_filelist_remote(uri, recursive = True)
  File "/usr/lib/python3.9/site-packages/S3/FileLists.py", line 407, in _get_filelist_remote
    response = s3.bucket_list(remote_uri.bucket(), prefix = remote_uri.object(),
  File "/usr/lib/python3.9/site-packages/S3/S3.py", line 321, in bucket_list
    for truncated, dirs, objects in self.bucket_list_streaming(bucket, prefix, recursive, uri_params, limit):
  File "/usr/lib/python3.9/site-packages/S3/S3.py", line 356, in bucket_list_streaming
    current_list = _get_contents(response["data"])
  File "/usr/lib/python3.9/site-packages/S3/S3.py", line 339, in _get_contents
    return getListFromXml(data, "Contents")
  File "/usr/lib/python3.9/site-packages/S3/Utils.py", line 120, in getListFromXml
    return parseNodes(nodes)
  File "/usr/lib/python3.9/site-packages/S3/Utils.py", line 67, in parseNodes
    for child in node.getchildren():
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/s3cmd", line 3201, in <module>
    report_exception(e)
  File "/usr/bin/s3cmd", line 3076, in report_exception
    sys.stderr.write(u"environment LANG=%s\n" % unicodise_s(os.getenv("LANG"), 'ascii'))
  File "/usr/lib/python3.9/site-packages/S3/Utils.py", line 321, in unicodise_s
    return unicodise(string, encoding, errors, True)
  File "/usr/lib/python3.9/site-packages/S3/Utils.py", line 312, in unicodise
    return unicode(string, encoding, errors)
TypeError: decoding to str: need a bytes-like object, NoneType found
@safor
Copy link
Author

safor commented Sep 17, 2021

The same issue like #1157

Related issues: https://github.com/s3tools/s3cmd/search?q=getchildren&type=issues

@safor
Copy link
Author

safor commented Sep 17, 2021

Environment:

  • Apline Linux 3.14.2
  • python3-3.9.5-r1
  • python-dateutil 2.8.2
  • python-magic 0.4.24
  • s3cmd 2.1.0

@safor
Copy link
Author

safor commented Sep 17, 2021

The issue disappears, if python3 is downgraded from 3.9.5-r1 to 3.8.10-r0

Probably the root cause: ocrmypdf/OCRmyPDF#583 (comment)

@safor
Copy link
Author

safor commented Sep 17, 2021

Sorry for opening a duplicated issue. This one should be closed, because the issue was fixed and merged into master in #1137

Unfortunately, the fixed version has not been released yet. (latest release: v2.1.0)

@fviard fviard closed this as completed Sep 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants