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

AttributeError: module 'pkginfo.distribution' has no attribute 'must_decode' #940

Closed
snowman2 opened this issue Nov 29, 2022 · 11 comments · Fixed by #941
Closed

AttributeError: module 'pkginfo.distribution' has no attribute 'must_decode' #940

snowman2 opened this issue Nov 29, 2022 · 11 comments · Fixed by #941

Comments

@snowman2
Copy link

snowman2 commented Nov 29, 2022

Your Environment

Thank you for taking the time to report an issue.

To more efficiently resolve this issue, we'd like to know some basic information about your system and setup.

  1. Your operating system: Docker image python:3.9-slim

  2. Version of python you are running: 3.9

  3. How did you install twine? pip

  4. Version of twine you have installed:
    4.0.1

  5. Which package repository are you targeting?
    internal artifactory

The Issue

Traceback (most recent call last):
  File "/usr/local/bin/twine", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/twine/__main__.py", line 33, in main
    error = cli.dispatch(sys.argv[1:])
  File "/usr/local/lib/python3.9/site-packages/twine/cli.py", line 123, in dispatch
    return main(args.args)
  File "/usr/local/lib/python3.9/site-packages/twine/commands/upload.py", line 198, in main
    return upload(upload_settings, parsed_args.dists)
  File "/usr/local/lib/python3.9/site-packages/twine/commands/upload.py", line 123, in upload
    packages_to_upload = [
  File "/usr/local/lib/python3.9/site-packages/twine/commands/upload.py", line 124, in <listcomp>
    _make_package(filename, signatures, upload_settings) for filename in uploads
  File "/usr/local/lib/python3.9/site-packages/twine/commands/upload.py", line 77, in _make_package
    package = package_file.PackageFile.from_filename(filename, upload_settings.comment)
  File "/usr/local/lib/python3.9/site-packages/twine/package.py", line 96, in from_filename
    meta = DIST_TYPES[dtype](filename)
  File "/usr/local/lib/python3.9/site-packages/twine/wheel.py", line 42, in __init__
    self.extractMetadata()
  File "/usr/local/lib/python3.9/site-packages/pkginfo/distribution.py", line 121, in extractMetadata
    self.parse(data)
  File "/usr/local/lib/python3.9/site-packages/twine/wheel.py", line 89, in parse
    fp = io.StringIO(distribution.must_decode(data))
AttributeError: module 'pkginfo.distribution' has no attribute 'must_decode'

Steps to Reproduce

twine upload --verbose --repository-url <INSERT URL HERE> --username <INSERT USERNAME HERE> --password <INSERT PASSWORD HERE> dist/*'
@snowman2
Copy link
Author

Note: pkginfo 1.9.0 was released 30 minutes ago.

@jamadden
Copy link
Member

jamadden commented Nov 29, 2022

This commit removed must_decode.

/cc @tseaver

mhsmith added a commit to mhsmith/toga that referenced this issue Nov 29, 2022
effigies added a commit to effigies/smriprep that referenced this issue Nov 29, 2022
@darklow
Copy link

darklow commented Nov 29, 2022

Having same error, downgrade to pkginfo==1.8.3 worked.

@cboots
Copy link

cboots commented Nov 29, 2022

Same error

@tseaver
Copy link
Contributor

tseaver commented Nov 29, 2022

Note that must_decode was defined in pkg_info/_compat.py, and was thus never an API: before 1.9.0, it was only imported and used in `pkginfo/distribution.py'.

Nevertheless, I will push out a 1.9.1 release of pkginfo which restores a deprecated compatibility alias.

@pllim
Copy link

pllim commented Nov 29, 2022

I encountered the same error and thought I was going crazy. Thanks for this issue!

@tseaver
Copy link
Contributor

tseaver commented Nov 29, 2022

https://pypi.org/project/pkginfo/1.9.1/

@cboots
Copy link

cboots commented Nov 29, 2022

@tseaver thanks for the hotfix!
Always a relevant XKCD

@effigies
Copy link
Contributor

@tseaver Thanks for the incredibly quick fix!

Btw, Was hoping to submit a quick bug report saying that the wheels are still universal, so you're getting pkginfo-1.9.1-py2.py3-none-any.whl instead of pkginfo-1.9.1-py3-none-any.whl. (Would report this on Launchpad, but lost my login...)

@Julian
Copy link
Contributor

Julian commented Nov 29, 2022

There's a PR for this here: #941. Sorry, should have filed an issue first I guess so others were more likely to find it.

@tseaver
Copy link
Contributor

tseaver commented Nov 29, 2022

@effigies

Btw, Was hoping to submit a quick bug report saying that the wheels are still universal, so you're getting pkginfo-1.9.1-py2.py3-none-any.whl instead of pkginfo-1.9.1-py3-none-any.whl. (Would report this on Launchpad, but lost my login...)

Hmm, I'm not sure how I'm supposed to fix that: neither the Trove classifiers nor the python_requires in setup.py include anything indicating Python2 support. Can you point to docs which specify what would control that?

Funnily enough, removing the _compat.py module didn't actually break anything for Python2, although getting coverage up to snuff afterward did (since I removed the if sys.version checks elsewhere).

Update: https://pypi.org/project/pkginfo/1.9.2/ fixes this, by dropping the [bdist_wheel] stanza from setup.cfg.

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 a pull request may close this issue.

8 participants