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

HTTPError: 401 Client Error: You must be identified to edit package information for url: https://testpypi.python.org/pypi #233

Closed
nihlaeth opened this issue Feb 25, 2017 · 4 comments

Comments

@nihlaeth
Copy link

nihlaeth commented Feb 25, 2017

I'm trying to set up automatic deployment with travis-ci but I keep running into this error no matter what I do: HTTPError: 401 Client Error: You must be identified to edit package information for url: https://testpypi.python.org/pypi.

Relevant debugging steps

  • Whenever I try to use twine from home, it works without problems.
  • Authentication information has literally been copied from my working .pypirc at home
  • The error persists no matter what pypi repository I use
  • I tried using the travis-supplied pypi deployer, but that doesn't expose which commands it uses exactly, so I switched to the script I linked below.
  • I tried generating .pypirc and putting it in a few different locations, hard linking it, etc. with no effect.
  • I tried moving the login information to the [server-login] section Stack overflow
  • I upgraded twine to version 1.8.1
  • I tried using environment variables with an empty .pypirc according to Repository URL weirdness #206

Links and information

@sigmavirus24
Copy link
Member

I wonder if

cat > ~/.pypirc << _EOF_
[testpypi]
repository = https://testpypi.python.org/pypi
username = ${TWINE_USERNAME}
password = ${TWINE_PASSWORD}

[pypi]
repository = https://upload.pypi.org/legacy/
username = ${TWINE_USERNAME}
password = ${TWINE_PASSWORD}
_EOF_

Would work in that script. The key is that instead of cat > .pypirc it does cat > ~/.pypirc and puts the credentials in the section. You could also update your invocation to be twine upload -r pypi dist/*.

To be completely frank, though, I'm not sure why you're seeing this problem.

@nihlaeth
Copy link
Author

nihlaeth commented Feb 25, 2017

I had already tried a variation of all those options before, but not this particular combination. I get a different error message now, which is more than I've been able to do all day. Thanks!

Now it's KeyError: "Missing 'testpypi' section from the configuration file\nor not a complete URL in --repository.\nMaybe you have a out-dated '~/.pypirc' format?\nmore info: https://docs.python.org/distutils/packageindex.html#pypirc\n" which I took to mean that there's a problem with the HOME environment variable since travis docs indicate that it shouldn't be relied on (no further information). Unfortunately overwriting it locally doesn't fix it...

This looks to be a distutils error message. Is it twine that reads the .pypirc file or distutils? Because if it's the latter, I should go bug someone else about this. Thanks for your help.

Edit: forget I said anything, I was missing the [distutils] section, and am now back to our original error

@nihlaeth
Copy link
Author

I found out what the problem was. My password contained symbols which should be escaped in the shell. This wasn't a problem in my (plaintext) local .pypirc, but on travis it was stored in an environment variable. I foolishly quoted my password to counteract this, only then the quotes were interpreted as part of the password apparently.

I fixed it by changing my password to shell-safe one, rather than mucking about with backslashes.

@taiya
Copy link

taiya commented May 17, 2020

Same problem, there was a "$3" in the password, and it was interpreted as "third argument" xD
Thanks for the issue, saved me.

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