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

skip-existing option fails for new package #220

Closed
mauritsvanrees opened this issue Nov 8, 2016 · 2 comments
Closed

skip-existing option fails for new package #220

mauritsvanrees opened this issue Nov 8, 2016 · 2 comments
Labels
Milestone

Comments

@mauritsvanrees
Copy link
Contributor

If you call twine upload --skip-existing for a package that has not been registered yet, you get an error:

$ twine upload --skip-existing dist/maurits_cornice_swagger-0.3.tar.gz 
Uploading distributions to https://upload.pypi.org/legacy/
JSONDecodeError: Expecting value: line 2 column 1 (char 1)

This goes wrong in package_is_uploaded. The decode error is because we get html back that displays a 'not found' message. It tries to get this url:
https://pypi.python.org/pypi/maurits-cornice-swagger/json

Note that twine uses a url from the old pypi here, presumably because warehouse does not support this url yet.

This was discovered in zestsoftware/zest.releaser#191
For more information, see there. In that case, zest.releaser calls package_is_uploaded, which fails with this traceback:

  File "/opt/venvs/py3/lib/python3.5/site-packages/zest/releaser/release.py", line 198, in _retry_twine
    if repository.package_is_uploaded(package_file):
  File "/opt/venvs/py3/lib/python3.5/site-packages/twine/repository.py", line 176, in package_is_uploaded
    releases = response.json()['releases']
  File "/opt/venvs/py3/lib/python3.5/site-packages/requests/models.py", line 826, in json
    return complexjson.loads(self.text, **kwargs)
  File "/opt/venvs/py3/lib/python3.5/site-packages/simplejson/__init__.py", line 516, in loads
    return _default_decoder.decode(s)
  File "/opt/venvs/py3/lib/python3.5/site-packages/simplejson/decoder.py", line 374, in decode
    obj, end = self.raw_decode(s)
  File "/opt/venvs/py3/lib/python3.5/site-packages/simplejson/decoder.py", line 404, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.scanner.JSONDecodeError: Expecting value: line 2 column 1 (char 1)
@sigmavirus24
Copy link
Member

Excellent catch!

@sigmavirus24 sigmavirus24 modified the milestone: next Mar 13, 2017
sigmavirus24 added a commit that referenced this issue May 22, 2017
Users may want to use --skip-existing even if this is the first time
they're uploading a package. This allows that use-case to be successful.

Closes gh-220
@ofek
Copy link

ofek commented Aug 15, 2017

Scratch that, pip didn't give me latest. All is well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants