Twine upload TypeError: expected string or bytes-like object
Asked Answered
P

2

21

Has anybody got an error like this when you try to upload your package ?

   $ twine upload dist/*
   Uploading distributions to https://upload.pypi.org/legacy/
   Enter your username: MyUsername
   Enter your password: ********
   TypeError: expected string or bytes-like object

Edit: Got the same error again but this time to fix it I upgraded twine and it started working again.

Pythoness answered 12/4, 2018 at 22:6 Comment(3)
I have Uploading distributions to https://upload.pypi.org/legacy/ - TypeError: expected string or buffer right now...Shit
Updating twine did solve the issue for me (problem showed up with 1.9.1 version; just upgraded to 1.11.0).Fulguration
github.com/pypa/twine/issues/342Luehrmann
T
8

Updating twine solved the problem for me. For this, execute the following command before doing twine upload dist/*:

python3 -m pip install --user --upgrade twine

Triad answered 12/6, 2018 at 19:29 Comment(2)
I'm guessing your response is a command that updates twine. Since that resolved the problem for me, I'm flagging your response as the accepted answer to help other users see it.Pythoness
That's correct. I edited the text accordingly to make this more clear.Triad
S
6

I had the same problem after installing twine by apt. It seems that it installed twine for python2 and my project was python3.

So I've installed twine with pip for python3:

pip3 install twine

and used the following command:

python3 -m twine upload dist/*

Worked perfectly fine

Segment answered 7/10, 2019 at 9:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.