twine: Can't enter password in Windows
Your Environment
Thank you for taking the time to report an issue.
To more efficiently resolve this issue, we’d like to know some basic information about your system and setup.
-
Windows 10
-
Python 3.8.2
-
I used pip.(pip install twine)
-
I don’t know
If you’re having issues uploading a specific package, you must include a copy of the following:
- The package’s
PKG-INFOfile - A redacted version of your
.pypircfile (REMOVE ALL USERNAMES & PASSWORDS BEFORE UPLOADING)
The Issue
The issue is that every time I try to upload, I enter __token__ in username, but I can’t enter ANY text in the password field.
Steps to Reproduce
Use wheel on setup.py
Type in python -m twine upload --repository testpypi dist/*
type in __token__ as the username
Try to type in the password
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 5
- Comments: 49 (23 by maintainers)
@mathstar13 One of these options should work from Command Prompt:
Edit > Pastefrom theCommand PromptmenuProperties > Options > Use Ctrl+Shift+C/V as Copy/Pastein theCommand PromptmenuHere’s an example of option 1 working for me:
In the interest of enabling you to use your token (which is better than username/password) and assisting future Windows Python developers, would you be game to give one of those options a try?
@IVN-tone Excellent! I’m glad you were able to get it working.
One note: after looking at the “properties” suggestion:
I think enabling this means you can use
Ctrl+Shift+Vto paste in the command prompt, but still notCtrl+V. To make it more confusing, this only applies to the command prompt, meaning you’d useCtrl+Cto copy the token from your web browser.I figured out what was going on. Your solution works but when doing the top left menu, edit, paste method in Anaconda Prompt, it sometimes doesn’t paste anything the first try. I just hit enter, get the expected authentication error and try a second time. Then it works on the second try. Also, when pasting the password, nothing is visible. It makes it look as if nothing was pasted, but in actuality, it did paste the password, but it seems to be hidden from view…which I guess makes sense for security, but is confusing for first time users. Thanks for your help!
@sigmavirus24 The four people that reported the issue are https://github.com/pypa/packaging-problems/issues/384 https://github.com/pypa/packaging-problems/issues/376 https://github.com/pypa/packaging-problems/issues/355. Sorry that I was unclear about that. I updated my comment.
Oh, yes, you’re right, I forgot about
Shift, that’s was my fault.@bhrutledge 1 works fine.
@bhrutledge @sigmavirus24 Thanks for helping me out! I got my package uploaded!
I went down the rabbit hole, installed Windows on a virtual machine, and was able to reproduce this when trying to paste the token in Command Prompt or PowerShell. In short, this is a known issue with
getpass(and anything that uses it, like Twine) on Windows. The workarounds include:Edit > Pastefrom theCommand PromptmenuProperties > Options > Use Ctrl+Shift+C/V as Copy/Pastein theCommand Promptmenu@mathstar13 Can you confirm that one of these works for you?
To reproduce, I copied the text
pypi-token, and then ran this code to print the length of the entered value:Typing works fine:
However, I suspect more folks are running into this due to the use of tokens that are difficult to type.
Aside: the
SyntaxErrorin https://github.com/pypa/twine/issues/671#issuecomment-663778973 is due to the single quote; apparently it needs to be a double quote.