floydhub/floyd-cli

Login fails due to failing invisible input

iver56 opened this issue · 3 comments

Environment: Windows 10, Python 2.7. Problem occurs in both cmd.exe and Git Bash

To reproduce:

  1. floyd login
  2. Type Y and press enter. Copy the auth token.
  3. Paste the auth token by pressing Shift + Insert (Git Bash) or right clicking (cmd.exe)
  4. The program stops with the following error message:
$ floyd login
Authentication token page will now open in your browser. Continue? [Y/n]: y
Please copy and paste the token from the welcome page.
This is an invisible field. Paste token and press ENTER:
Traceback (most recent call last):
  File "c:\Python27\Scripts\floyd-script.py", line 9, in <module>
    load_entry_point('floyd-cli==0.8.9', 'console_scripts', 'floyd')()
  File "c:\python27\lib\site-packages\click\core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "c:\python27\lib\site-packages\click\core.py", line 697, in main
    rv = self.invoke(ctx)
  File "c:\python27\lib\site-packages\click\core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\python27\lib\site-packages\click\core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\python27\lib\site-packages\click\core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "c:\python27\lib\site-packages\floyd\cli\auth.py", line 26, in login
    user = AuthClient().get_user(access_code)
  File "c:\python27\lib\site-packages\floyd\client\auth.py", line 18, in get_user
    headers={"Authorization": "Bearer {}".format(access_token)})
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0' in position 0: ordinal not in range(128)

By printing access_token in auth.py, you'll find that it's a string with one or two non-ASCII characters. Looks like a byte-representation of the key sequence pressed to paste the token.

This should no longer be happening. Please reopen if that is the case.

I am also getting same error. Is there any solution?

Did you get any solution of the above problem?
Thank you