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

fix compatibility with Python 3.9 #1137

Merged
merged 1 commit into from Oct 12, 2020
Merged

Conversation

ondrejbudai
Copy link
Contributor

getchildren() method was removed from the ElementTree and Element classes in Python 3.9. This PR uses built-in iter() and list() methods instead of the removed one. This fix was suggested in the Python 3.9 release notes:

https://docs.python.org/3.9/whatsnew/3.9.html#removed

I verified this fix on Fedora 33 with Python 3.9.0rc2 by:

s3cmd --acl-public sync . s3://...

S3/Exceptions.py Outdated Show resolved Hide resolved
@fviard
Copy link
Contributor

fviard commented Oct 11, 2020

Hi,
Thank you very much for your contribution.
I did not notice this change in python 3.9 and so this PR is very valuable.
If it is possible for you to fix your PR with the change that I suggested in my previous comment, it would be great and then I would be able to merge it.

@ondrejbudai
Copy link
Contributor Author

I force-pushed a fix - I incorporated your suggestion and I also used len(child) > 0 instead of list(child) - I think that is more readable.

@fviard
Copy link
Contributor

fviard commented Oct 12, 2020

Thank you for you read reactivity!
Good idea the 'if len(child) > 0' but can you just use 'if len(child)' instead please?
It is explicit enough and otherwise pylint might complain.

getchildren() method was removed from the ElementTree and Element classes in
Python 3.9. See the release notes:

https://docs.python.org/3.9/whatsnew/3.9.html#removed
@ondrejbudai
Copy link
Contributor Author

Sure thing, done!

@fviard fviard merged commit b409c1d into s3tools:master Oct 12, 2020
@fviard
Copy link
Contributor

fviard commented Oct 12, 2020

Merged thanks!

ondrejbudai added a commit to ondrejbudai/osbuild-composer that referenced this pull request Oct 14, 2020
s3cmd from pip doesn't work with Python 3.9. Fortunately, s3cmd in Fedora has
a downstream patch to fix it.

See rhbz#1884607 and s3tools/s3cmd#1137
msehnout pushed a commit to osbuild/osbuild-composer that referenced this pull request Oct 14, 2020
s3cmd from pip doesn't work with Python 3.9. Fortunately, s3cmd in Fedora has
a downstream patch to fix it.

See rhbz#1884607 and s3tools/s3cmd#1137
@ThiefMaster
Copy link

Could this please be released as 2.1.1?

gicmo added a commit to gicmo/osbuild that referenced this pull request Oct 22, 2020
s3cmd does not work properly with python 3.9 (used on Fedora 33):
  Problem: <class 'AttributeError: 'xml.etree.ElementTree.Element'
            object has no attribute 'getchildren'
  S3cmd:   2.1.0
  python:  3.9.0rc1 (default, Aug 12 2020, 00:00:00)

Use the one from the official repositories, which in case of F33
has a downstream fix for the error.

See rhbz#1884607 and s3tools/s3cmd#1137

Patch based on osbuild-composer commit 1a69a891 by Ondřej Budai.
larskarlitski pushed a commit to osbuild/osbuild that referenced this pull request Oct 22, 2020
s3cmd does not work properly with python 3.9 (used on Fedora 33):
  Problem: <class 'AttributeError: 'xml.etree.ElementTree.Element'
            object has no attribute 'getchildren'
  S3cmd:   2.1.0
  python:  3.9.0rc1 (default, Aug 12 2020, 00:00:00)

Use the one from the official repositories, which in case of F33
has a downstream fix for the error.

See rhbz#1884607 and s3tools/s3cmd#1137

Patch based on osbuild-composer commit 1a69a891 by Ondřej Budai.
@tirkarthi tirkarthi mentioned this pull request Oct 27, 2020
jbojar referenced this pull request in Homebrew/homebrew-core Oct 30, 2020
Closes #63174.

Signed-off-by: Sean Molenaar <1484494+SMillerDev@users.noreply.github.com>
Signed-off-by: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com>
teg pushed a commit to larskarlitski/osbuild-composer that referenced this pull request Nov 6, 2020
s3cmd from pip doesn't work with Python 3.9. Fortunately, s3cmd in Fedora has
a downstream patch to fix it.

See rhbz#1884607 and s3tools/s3cmd#1137
@KeithCu
Copy link

KeithCu commented Apr 15, 2021

I'm running into this problem with every non-empty bucket in Linode. Can a new release be made soon?

@leematos
Copy link

leematos commented Jul 4, 2021

@KeithCu -- I had the same today which led me to pull master.zip, and if usr/bin/env python (symlink to python3) is available on the system, it can work.

I agree though, A new release will be easier for more folks.

algitbot pushed a commit to alpinelinux/aports that referenced this pull request Sep 6, 2021
The added patch is already merged upstream:
s3tools/s3cmd#1137
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

Successfully merging this pull request may close these issues.

None yet

5 participants