twine: TypeError: expected string or bytes-like object

Hi everyone,

I can’t seem to figure why it is giving error, is it bug:

twine upload dist/*

Uploading distributions to https://upload.pypi.org/legacy/
TypeError: expected string or bytes-like object

I created ~/.pypirc with creds. Also tried Env Vars, no luck 😦

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 37 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Actually it is working for me now, with updated twine:

twine --version
twine version 1.11.0 (pkginfo: 1.4.2, requests: 2.18.4, setuptools: 39.0.1,
requests-toolbelt: 0.8.0, tqdm: 4.21.0)

I was using 1.9.1 earlier.

Same here, upgrading to 1.11 seems to fix this

I started receiving this error after I updated pip from 9.0.1 to 10.0.1.

Upgrading twine to 1.11.0 resolved the problem.

+1 for upgrading twine of 1.11 by pip install -U twine.

@oscar6echo your comment saved me! uinstalling a globally installed twine made it using the one in the virtualenv! cheers!

FYI

I had the same error a very similar situation as @eliasdabbas with the same 2 versions.

I was in a conda env and noticed that the path is modified for python to that twine.__version__ points to version 1.11, conda list twine shows the same but for some reason command line twine did invoke version 1.9.1, although which twine did show a path leading under under my conda env.

Anyway updating twine in the root env solved it. And I could upload.

I had the same issue. Found out that this was confusion between python3.6 and python2.7 packages. My pip pointed to pip3.6 so that pip list nor pip uninstall twine unexpectedly did not found python2.7’s twine which sat in my PATH nevertheless. Uninstalling python2.7 twine solved the problem. Found with sudo find / -name twine