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

Unable to upload to a project using an API token #990

Closed
vsajip opened this issue May 5, 2023 · 6 comments
Closed

Unable to upload to a project using an API token #990

vsajip opened this issue May 5, 2023 · 6 comments

Comments

@vsajip
Copy link

vsajip commented May 5, 2023

Environment

  1. Running on Linux Mint 19.1 (Ubuntu Bionic) 64-bit.

  2. Python 3.6.7.

  3. Twine installed using pip install -U twine.

$ twine --version
twine version 3.8.0 (pkginfo: 1.9.6, readme-renderer: 24.0, requests: 2.27.1,
requests-toolbelt: 0.9.1, urllib3: 1.26.15, tqdm: 4.31.1, importlib-metadata:
4.8.1, keyring: 21.2.1, rfc3986: 1.4.0, colorama: 0.4.3)
  1. PyPI

PKG-INFO: See attached.

PKG-INFO.txt

Redacted version of .pypirc: See attached.

pypirc.txt

The Issue

Twine fails to upload:

$ python -m twine upload -s -i 339A9B86 --repository sphinx-sizzle-theme  dist/*0.1.2*
InvalidConfiguration: Missing 'sphinx-sizzle-theme' section from ~/.pypirc.
More info: https://packaging.python.org/specifications/pypirc/ 

The failure occurs repeatably, but I was able to upload using my PyPI username and password (though I received an email later asking me to use tokens). I regenerated the token for sphinx-sizzle-theme and tried again, with the same result.

Note that configparser reads ~/.pypirc OK:

$ python
Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os, configparser
>>> fn = os.path.expanduser('~/.pypirc')
>>> cp = configparser.ConfigParser()
>>> cp.read(fn)
['/home/vinay/.pypirc']
>>> cp.sections()
['distutils', 'testpypi', 'config', 'python-gnupg', 'distlib', 'sphinx-sizzle-theme', 'sarge', 'pypi']
>>> 

Steps to Reproduce

As described above.

@sigmavirus24
Copy link
Member

Duplicate of #924 I suspect

@bhrutledge
Copy link
Contributor

@vsajip The contents of pypirc.txt look correct to me. Can you try upgrading to the latest version of Twine, and re-running the upload command with the --verbose option?

@vsajip
Copy link
Author

vsajip commented May 6, 2023

As I'm using Python 3.6, I think 3.8.0 is the latest Twine version I can use. Version 4.0.0 and later require Python >= 3.7.

But even with Twine 4.0.2 (I installed it in a different venv), the same thing happens:

$ twine upload -s -i 339A9B86 --repository sphinx-sizzle-theme  dist/*0.1.2* --verbose
INFO     Using configuration from /home/vinay/.pypirc                                                                                                                                                              
ERROR    InvalidConfiguration: Missing 'sphinx-sizzle-theme' section from ~/.pypirc.                                                                                                                               
         More info: https://packaging.python.org/specifications/pypirc/                                                                                                                                            
$ twine --version
twine version 4.0.2 (importlib-metadata: 6.6.0, keyring: 23.13.1, pkginfo: 1.9.6, requests: 2.29.0, requests-toolbelt: 1.0.0, urllib3: 1.26.15)

@vsajip
Copy link
Author

vsajip commented May 6, 2023

Duplicate of #924 I suspect

Not quite - all my sections are also listed in index-servers, so the failure seems to be for a different reason.

@vsajip
Copy link
Author

vsajip commented May 7, 2023

There seems to have been some problem with both venvs I was using. When I created a fresh venv with Python 3.8 and installed twine into it and used that, I didn't get the error. Sorry for the noise.

@vsajip vsajip closed this as completed May 7, 2023
@sigmavirus24
Copy link
Member

No worries @vsajip . Glad you got things sorted

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

3 participants